[Qt5.1 beta] OpenGL, white screen
I am a complete beginner in OpenGL (Windows x64)
I used this example from KDAB :
The code is exactly the same, except a dynamic_cast on this line:
@m_funcs = m_context->versionFunctions()@
And whatever I do, I get a white window.
A @m_funcs->glClearColor(0.0f, 0.0f, 0.0f, 1.0f)@
is expected to show a black background, isn't it ? It's always a white background, nothing is displayed.
I also tested with a OpenGL 3.3 context.
My drivers are updated, there must be something I did not understand ...
(sorry, my English must be deplorable)
you must perform some other calls in order to see something into the screen.
@m_context->makeCurrent( this ); // Make sure you make the context current
m_funcs->glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Specify the color that glClear(...) will use
m_funcs->glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Actually, clear the window with the color mentioned above
m_context->swapBuffers( this ); // Send the data to the window
Edit: I recommend you to download the tesselation example at the bottom of the "5th Qt5.1 post at KDAB":http://www.kdab.com/opengl-in-qt-5-1-part-5/