Commit c3a4883e authored by Sylvain Thery's avatar Sylvain Thery

remove QGLViewer postDraw (crash with modern GL context)

parent f6a1f2bf
...@@ -338,68 +338,68 @@ draw(), the user can rely on the OpenGL context he defined. Respect this convent ...@@ -338,68 +338,68 @@ draw(), the user can rely on the OpenGL context he defined. Respect this convent
different attributes) if you overload this method. */ different attributes) if you overload this method. */
void QGLViewer::postDraw() void QGLViewer::postDraw()
{ {
// Reset model view matrix to world coordinates origin // // Reset model view matrix to world coordinates origin
glMatrixMode(GL_MODELVIEW); // glMatrixMode(GL_MODELVIEW);
glPushMatrix(); // glPushMatrix();
camera()->loadModelViewMatrix(); // camera()->loadModelViewMatrix();
// TODO restore model loadProjectionMatrixStereo // // TODO restore model loadProjectionMatrixStereo
//
// Save OpenGL state // // Save OpenGL state
glPushAttrib(GL_ALL_ATTRIB_BITS); // glPushAttrib(GL_ALL_ATTRIB_BITS);
//
// Set neutral GL state // // Set neutral GL state
glDisable(GL_TEXTURE_1D); // glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D); // glDisable(GL_TEXTURE_2D);
#ifdef GL_TEXTURE_3D // OpenGL 1.2 Only... //#ifdef GL_TEXTURE_3D // OpenGL 1.2 Only...
glDisable(GL_TEXTURE_3D); // glDisable(GL_TEXTURE_3D);
#endif //#endif
//
glDisable(GL_TEXTURE_GEN_Q); // glDisable(GL_TEXTURE_GEN_Q);
glDisable(GL_TEXTURE_GEN_R); // glDisable(GL_TEXTURE_GEN_R);
glDisable(GL_TEXTURE_GEN_S); // glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T); // glDisable(GL_TEXTURE_GEN_T);
//
#ifdef GL_RESCALE_NORMAL // OpenGL 1.2 Only... //#ifdef GL_RESCALE_NORMAL // OpenGL 1.2 Only...
glEnable(GL_RESCALE_NORMAL); // glEnable(GL_RESCALE_NORMAL);
#endif //#endif
//
// glDisable(GL_COLOR_MATERIAL); //// glDisable(GL_COLOR_MATERIAL);
// qglColor(foregroundColor()); //// qglColor(foregroundColor());
//
if (cameraIsEdited()) // if (cameraIsEdited())
camera()->drawAllPaths(); // camera()->drawAllPaths();
//
// Pivot point, line when camera rolls, zoom region // // Pivot point, line when camera rolls, zoom region
drawVisualHints(); // drawVisualHints();
//
if (gridIsDrawn()) { glLineWidth(1.0); drawGrid(camera()->sceneRadius()); } // if (gridIsDrawn()) { glLineWidth(1.0); drawGrid(camera()->sceneRadius()); }
if (axisIsDrawn()) { glLineWidth(2.0); drawAxis(camera()->sceneRadius()); } // if (axisIsDrawn()) { glLineWidth(2.0); drawAxis(camera()->sceneRadius()); }
//
// FPS computation // // FPS computation
const unsigned int maxCounter = 20; // const unsigned int maxCounter = 20;
if (++fpsCounter_ == maxCounter) // if (++fpsCounter_ == maxCounter)
{ // {
f_p_s_ = 1000.0 * maxCounter / fpsTime_.restart(); // f_p_s_ = 1000.0 * maxCounter / fpsTime_.restart();
fpsString_ = tr("%1Hz", "Frames per seconds, in Hertz").arg(f_p_s_, 0, 'f', ((f_p_s_ < 10.0)?1:0)); // fpsString_ = tr("%1Hz", "Frames per seconds, in Hertz").arg(f_p_s_, 0, 'f', ((f_p_s_ < 10.0)?1:0));
fpsCounter_ = 0; // fpsCounter_ = 0;
} // }
//
// Restore foregroundColor // // Restore foregroundColor
float color[4]; // float color[4];
color[0] = foregroundColor().red() / 255.0f; // color[0] = foregroundColor().red() / 255.0f;
color[1] = foregroundColor().green() / 255.0f; // color[1] = foregroundColor().green() / 255.0f;
color[2] = foregroundColor().blue() / 255.0f; // color[2] = foregroundColor().blue() / 255.0f;
color[3] = 1.0; // color[3] = 1.0;
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color); // glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
glDisable(GL_LIGHTING); // glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST); // glDisable(GL_DEPTH_TEST);
//
if (FPSIsDisplayed()) displayFPS(); // if (FPSIsDisplayed()) displayFPS();
if (displayMessage_) drawText(10, height()-10, message_); // if (displayMessage_) drawText(10, height()-10, message_);
//
// Restore GL state // // Restore GL state
glPopAttrib(); // glPopAttrib();
glPopMatrix(); // glPopMatrix();
} }
/*! Called before draw() (instead of preDraw()) when viewer displaysInStereo(). /*! Called before draw() (instead of preDraw()) when viewer displaysInStereo().
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment