PDA

View Full Version : Problems running GraphicsView sample for QtQuarterly Issue 26



gclayton
24th March 2010, 18:11
Qt Quarterly issue 26 had an article called "Accelerate your Widgets with OpenGL" which I downloaded and compiled the sample code using Qt 4.5.2 and VS 2008. I am running Vista Ultimate x64.

The article in question is located here: http://qt.nokia.com/doc/qq/qq26-openglcanvas.html

When I compile and run the app from within VS 2008 IDE everything works just fine. However if I run the very same openglscene.exe by double-clicking on the exe, the window does not display the OpenGl objects that are loaded.

I also have Qt 4.6.2, and have also compiled the same code with VS 2008 and Qt 4.6.2 and when I try to run the openglscene.exe either inside VS 2008 or by double-cleicking on the exe, I do not see the OpenGl objects.

Please see the attached jpgs for what I am experiencing.

Please note, the example code has not been modified in any way.

What am I missing when I try to run the openglscene.exe when not in VS 2008?

Thanks in advance for any help.

Gil

JD2000
24th March 2010, 19:25
At a guess I would say that when the programme is compiled and run from within VS2008, the IDE is supplying the OpenGL objects to be displayed.

The standalone version needs to be know where to find these at run time, either by being supplied with the path to them or by having them compiled in.

I am not familiar with VS2008 but I expect that there is an option or switch to have these statically linked when compiling.

gclayton
24th March 2010, 19:35
The actual files displayed in the OpenGl window are located in a folder separate from the application. You can browse to open whichever .obj file you want to display.

If you look at the window that is not showing the opengl objects, you can see that the "model" dialog shows that the object has been loaded but it is not being displayed.

Also note that the order of the dialogs in the window is reversed compared to the window that is working.

Gil

krvwa
20th July 2010, 12:13
I have the same problem.

The OpenGL part of my application is based on the GraphicsView sample of QtQuarterly Issue 26. I'm now trying to switch from Qt 4.5.2 to Qt 4.6.3 but when compiling in Qt 4.6.3 the openGL objects are no longer visible.

Does anybody has an idea on how to make objects visible again?

Thanks

mgb
3rd August 2010, 18:34
Partial solution
With Qt4.7 the default painter type for OpenGL is OpenGL2 (at least on my machine)

So line 138 in OpenGLScene.cpp needs to be

if (painter->paintEngine()->type() != QPaintEngine::OpenGL2) {

Or probably better to check against OpenGL and OpenGL2
This will draw the model, still having some issues with the dialog decoration

schr
20th August 2010, 12:44
Same problem here. The above gets me "something" in the viewport when I load a model (and gets rid of the openGL context not present error), but it is distorted and flashing.
Also on qt 4.6.3