Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Opengl and maximing viewport
I am trying to make a basic opengl app using QGLWidget and qt examples. I managed to make it show a basic grid on viewport and even change the viewpoint , but when i maximize the window it keeps showing a portion of the last rendered image in front of the actual view. This happens only when i maximize the window , resizing in any other way (minimize , change it in x,y direction) works fine.
I put breakpoing inside resizegl and it is activated when any resizing happens.
Below are some shots of what it looks like
when i start program
when i maximize (1920X1080)
void GL_Renderer_Widget::resizeGL(int width, int height)
glClear (GL_COLOR_BUFFER_BIT);//i put this here, trying to force clear screen on each resize
int side = qMin(width, height);
glViewport((width - side) / 2, (height - side) / 2, side, side);
glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
glViewport(0,0, width(), height());
glLoadIdentity (); // Reset The Projection Matrix
gluPerspective(PerspectiveAngle, (GLfloat)(width())/(GLfloat)(height()), 0.1f, FarPlane );
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );// | GL_STENCIL_BUFFER_BIT );
SetViewPort(); glMatrixMode (GL_MODELVIEW); glLoadIdentity (); gluLookAt( EyePosition,EyePosition,EyePosition, EyeDir ,EyeDir ,EyeDir , LookUpV,LookUpV,LookUpV); glEnable(GL_TEXTURE_2D); glPolygonMode(GL_FRONT_AND_BACK , GL_FILL); //Typing in White Color glColor3f(1.0f,1.0f,1.0f); renderText(5,10,QString(VendorInfo)); renderText(5,20,QString(RendererInfo)); renderText(5,30,QString(VersionInfo)); renderText(5,40,QString("X: %1").arg(MouseXYZ)); renderText(55,40,QString("Y: %1").arg(MouseXYZ)); DrawBasicGrid(); glFlush ();
I made a button in main window that activates clear screen and updateGL() so when i maximize and click it, it all shows right.
What am i missing here ?
I am using qt on windows 7 64bit with ming and my drivers are up to date.
Just noticed what whenever i maximize view , and problem occurs , but i click anywhere else except the actual opengl rendering windows , coming back restores proper rendering view.
1)i maximize and problem occurs
2)i click on windows start bar
3)i click back inside the render window
4)view is restored correctly
Dont know what it was that caused this , but now it works ...
I tried the following things but cant get any of these to recreate the problem (so i dont really know if any of those were creating the issue in the first place) :
1)Used old windows theme
2)Disabled ATI AI from catalyst
3)Change vertical refresh from gpu properties
4)Run exactly the same apps as before while running the program
I think it was just a glitch caused from undefined conditions (thought im sure reboot-clean all must have helped more)
Anyways if somene can , close this thread