PDA

View Full Version : implement multiple windows in multiple threads



jayaprakash
04-06-2009, 12:34 AM
Dear all,
I am trying to implement multiple windows in multiple threads using openGL.
I am creating one openGL window in each thread using glutCreateWindow(). And in final thread I am launching glutMainLoop().While running application frequently I am facing one of the following error:
1. X Error of failed request: GLXBadContextTag
Major opcode of failed request: 143 (GLX)
Minor opcode of failed request: 5 (X_GLXMakeCurrent)
Serial number of failed request: 101
Current serial number in output stream: 103

2. Xlib: unexpected async reply (sequence 0x67)!

Please help me for how to solve this problem. Or any other way to implement this concept?

Thanks & Regards,
Jayaprakash

Nighthawk
04-06-2009, 02:02 AM
The problem is, Glut is not threadsafe.

Creating one window+OpenGL context in each thread should work in general. Each OpenGL context is thread-specific: to render in one context, the thread which created that context must call the paint() function.

Can't help you with Linux-specific windows creation though.

Dark Photon
04-06-2009, 03:09 PM
Can't help you with Linux-specific windows creation though.

Try this code (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=241530#Post241530).

SANTOS_GL
04-20-2009, 11:02 AM
Hi,

I have not tried with threads, but wt i want to share is that, when u create a new window or sub window, in open GL each and every sub window is capable of handling, event handlers, display functions. So i think, even the loop back also possible. It is just like main() call.

Hope the above try will solve your problem.
thanks,
Santosh