PDA

View Full Version : Context OpenGL



mickey
22nd February 2006, 20:04
Hi,
my app has 5 widgets with the same cube. Every widget calls its initializeGL() paintGL()....but....I don't understand good what is a context openGL: every widget have a context (in this case the context it's the same)? Should widgets shared the same context? How do I code it (idea)?

Thanks

mickey
23rd February 2006, 19:01
Any hints?

KShots
3rd March 2006, 18:02
1. What is a "cube" that you are referring to? Is this a drawn cube, or do you mean a square arrangement of widgets?

2. The OpenGL context stores the state for that window - all your matrices (projection, modelview, etc.) are associated with a device context. To have multiple OpenGL windows, you need multiple unique device contexts.

3. There are some things that can be shared. These include textures and display lists. Everything else should be unique.

mickey
3rd March 2006, 20:37
cube is my drawn object (with openGL). I insert 5 drawn 5 widget from qtDesinger.
Are there 5 different GL context? Each widgetx dislplay the same scene.So in my program 5 instance of myGLWidget starts. All widgets refere to the same context or have they one? thanks

KShots
3rd March 2006, 21:13
They each get their own unique contexts. Each widget will have to re-draw the scene independently. They can use the same data to build the scene, but the OpenGL context must be different.