[Qt-interest] UpdateGL() not working from WheelEvent()

Till Oliver Knoll till.oliver.knoll at gmail.com
Thu Jun 9 21:50:54 CEST 2011



Am 09.06.2011 um 12:39 schrieb Mike Hunt <ionel71089 at yahoo.com>:

> I'm making a rubik-cube game in Qt using OpenGL.
> I'm trying to move the "camera" (using gluLookAt) around the cube using the mouse

Note that many functions - especially matrix transformation functions like glrotate and vertex functions like glvertex - have been deprecated since OpenGL 3. That includes the GLU viewpoint functions as well.

You are supposed to calculate model/view-matrices with your own matrix library - good thing there is now QMatrix and Co ;) - and pass the final matrix to GL!

Likewise for geometry points: you use now vertex buffers and download them at once into the graphic memory.

But this just as a sidenote...

> In the mouseMoveEvent() of my widget I change the camera pitch and yaw, and then call updateGL(), 

Try simply calling update(), make sure your wheel/mouse event handler actually returns to the Qt event queue.

And only modify the underlying data such as view angle, do not issue GL commands in your event handler, unless you absolutey have to (very unlikely). And if you do, don't forget to call makeCurrent() as to activate the GL context.

Cheers, Oliver
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110609/31e3d51c/attachment.html 


More information about the Qt-interest-old mailing list