QGLWidget paintGL function in Qt 5.1.1 not working
I just try to move from Qt 4.8.2 to Qt 5.1.1 today. I install the complete offline installer from Download page. Qt 5.1.1 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB).
I want to open my old project with QGLWidget on it.
But it seems I didn't work fully.
After searching I found that I can't draw primitive geometries in Qt 5.1.1
Even a simple code like this :
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glVertex3f( 0.0f, 1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
It won't work. I won't see any triangle there.
Maybe someone know how to fix this? I've been searching the forums and google. I can't find anything :(
Are you doing it in the paint method and putting that code between these two functions?
I wrote that in paintGL().
Using Qt 5.1.1 + MinGW 4.8.1 I can see the triangle but it's very big,
But if I use Qt 4.8.4 + MinGW 4.8.0 the triangle will be small.
Here are the screenshots I made :
https://www.dropbox.com/s/jsh3f66tgcw7xko/1.png -> Small WindowQt 4.8.4 + MinGW 4.8.0
https://www.dropbox.com/s/14iexplqhsadzqg/4.png -> Big Window Qt 4.8.4 + MinGW 4.8.0
https://www.dropbox.com/s/dl4zktcf19bn3fm/2.png -> Small Window Qt 5.1.1 + MinGW 4.8.1
https://www.dropbox.com/s/1gl0ugtwknrs3l9/3.png -> Big Window Qt 5.1.1 + MinGW 4.8.1
Anyone know why?
Not sure then, I never used 4.8.1 sorry.
Are you sure you got this in your pro file?
QT += opengl
I did that.
I found it. It's working. It's different. It's not the same with qt 4.8.1. I read it a couple days ago
Glad to hear it is working for you now.