PDA

View Full Version : OpenGL in threaded program



12-05-2000, 10:49 PM
Hello. I am writing a multithread app that use OpenGL(and GLUT) to draw to windows. Each thread has its own window to draw to, but sometimes the app crashes, sometimes it draw in wrong window, do some other bizarre things, but sometimes work fine. Is it a bad idea to use OpenGL in this kind of program? or is there any Right Way to do it?
I am using MS VC++ version 6 on win2000.
Thanks for any help.
---
vachi

Eric
12-05-2000, 11:17 PM
I think the common error when using threaded OpenGL applications is to forget the wglMakeCurrent before drawing anything... That could explain that there are things rendered in the wrong window...

My advice is: check your code by ensuring that the proper rendering context is active when you issue any GL command.

There is no RIGHT WAY to write such an application. You just need to pay attention to your OpenGL state.

Regards.

Eric

12-06-2000, 02:21 AM
Um...active context before issuing gl calls...<looking in source code>
glutSetWindow() won't suffice?
---
vachi

Eric
12-06-2000, 03:45 AM
Aie...

I am not too familiar with GLUT (I use it from time to time but that's all).

I am not sure if GLUT is thread-safe... Perhaps other people reading this could help ???

I might try it when I have a minute !

Regards.

Eric