PDA

View Full Version : [fixed] Having problems with QGLWidget and Vertex Buffer Objects



exavi
25th March 2009, 15:09
Hi! I've written a small app for the iPhone and now that I have finished it I wanted to port it to Mac/PC/linux since I wrote it with being portable in mind it did not took me more than twenty minutes to "port" the core of the app.

Now I have almost all the same functionalities that I had in the iPhone and I say almost because the rendering part just does not work well.

My meshes are loaded correctly, the arcball works perfect, but, models are rendered with one color, and this color is the mesh's idColor. Let me explain this...

Since in OpenGL|ES there are no glRender modes, i had to give each mesh an unique color, so when I try to pick this mesh, I render twice the frame, and on the first pass I can know which object has been picked (if any) because I render everything with GL_LIGHTING disabled so I pick perfect pure colors. This is impossible to see since on the same frame is cleared and re-rendered with lighting, materials, and so on. ;)


Now I have ported my code to Qt, and the mesh is rendered but with its unique color, and not with its material color. is this any kind of "known bug" of Vertex Buffer Objects with Qt or am I missing something???

I am asking this because I'm new to Qt (in fact is the first thing I write with it, but its pretty simple to use) and rendering in OpenGL's Immediate mode works ok also in my app, with materials, lights and stuff, but Immediate mode its just NOT AN OPTION for me.

....and all the dumb examples that I have found using QGLWidget use Immediate mode, and not VBOs, and I doubt that any kind of "serious" 3d app uses Immediate, so there must be something that I'm missing...


thanks in advance,

PS: if this helps at all, I'm using osx, libqglviewer and GLC_lib are not an option for me and my app works well on iPhone, and the code ported works also well on GLUT, so its not any OpenGLES thing that I have forgot to unplug...


edit: fixed, seems that Qt does not play well with some GL states, removed a couple of them and it works seamlessly, works perfect, anyways I still dont like Qt's OGL integration, it does not respect the "standards".

typedef
9th November 2009, 14:16
hi,

I'm having the same kind of problems here.
I mix my own opengl object that uses VBO and draw them in a QGraphicsScene. I also use derivated class from QGraphicsWidgets in my graphicScene for my widgets.

I already had a problem with lights, resolved by reseting light states that Qt expected, but i can't find out witch one to reset after the drawing of my VBO.

The problem is that all Qt GraphicsWidget are not draw anymore after I draw my VBO.

can you tell me what states did you enable / disabled after the use of your vbo ?
Or if anyone already had this kind of problems...

thanks