Skip to content

Commit

Permalink
Fix shading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ickby committed Jun 22, 2017
1 parent 38495e5 commit 79561af
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/Gui/Quarter/QuarterWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,11 @@ void QuarterWidget::setExternGlViewport(QGLWidget* vp)

//delete the gl viewport and us a normal qwidget
setViewport(NULL);

//make sure we initilaaize the new context
QObject* quarteritem = rootObject()->findChild<QObject*>("scene3d");
if(quarteritem)
static_cast<QuarterDrawDeclarativeItem*>(quarteritem)->resetInitialisation();
}


Expand Down Expand Up @@ -1397,11 +1402,9 @@ void QuarterDrawDeclarativeItem::paint(QPainter* painter, const QStyleOptionGrap
PRIVATE(this)->sorendermanager->setViewportRegion(vp);
}

painter->beginNativePainting();
glPushAttrib(GL_ALL_ATTRIB_BITS);

painter->beginNativePainting();
std::clock_t begin = std::clock();

if(!initialized) {
glEnable(GL_DEPTH_TEST);
quarterwidget->getSoRenderManager()->reinitialize();
Expand Down Expand Up @@ -1452,11 +1455,19 @@ void QuarterDrawDeclarativeItem::paint(QPainter* painter, const QStyleOptionGrap
std::clock_t end = std::clock();
quarterwidget->renderTime = double(double(end-begin)/CLOCKS_PER_SEC)*1000.0;

glPopAttrib();
//make sure the ui is drawn on top of the 3dscene
glDisable(GL_DEPTH_TEST);

painter->endNativePainting();

}

void QuarterDrawDeclarativeItem::resetInitialisation()
{
initialized = false;
}


QuarterInteractionDeclarativeItem::QuarterInteractionDeclarativeItem(QDeclarativeItem* parent): QDeclarativeItem(parent),
m_eventfilter(NULL), m_interactionMode(NULL)
{
Expand Down
1 change: 1 addition & 0 deletions src/Gui/Quarter/QuarterWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class QuarterDrawDeclarativeItem : public QDeclarativeItem {

protected:
void setRenderContext(QuarterWidget* w, QuarterWidgetP* wp);
void resetInitialisation();

friend class QuarterWidget;
private:
Expand Down

0 comments on commit 79561af

Please sign in to comment.