PDA

View Full Version : help, OGL crash



ascripnik
08-12-2002, 01:18 AM
I've added PFD_DRAW_TO_BITMAP OpenGL support and after that the OGL crashes appeared. I have multithreaded rendering, and my first thinking is bad synchronization with device context changes, because maybe GL rendering exist when I try to resize or reallocate bitmap for DC. I'm trying glFlush and CriticalSection but with no result, maybe you can give me some advices or which can be a reason of my problem?

Relic
08-12-2002, 03:07 AM
Start your debugger and pinpoint the exact codeline that crashes, perhaps?
DRAW_TO_BITMAP is probably only supported by the generic MS OpenGL implementation. Are you using any OpenGL functions not in version 1.1?
Do you check all extension functions got via wglGetProcAddress for correct pointers?

ascripnik
08-13-2002, 05:15 AM
There is no exact line where is crash appeared, more often this is a glGetIntegerv(GL_VIEWPORT...). I don't use any function which are not OpenGL 1.1.

Relic
08-14-2002, 03:26 AM
It's impossible to tell what's wrong by your description.
The multithreaded aspect of this is disturbing. If you say it crashes while you're resizing the window and the crash appears more often in glGetIntegerv(GL_VIEWPORT,), well, that sounds like a sychronization issue.
If you reallocate the bitmap while you're drawing onto it with a parallel thread using OpenGL, all sorts of bad things could happen.
The same thread that draws must be responsible for the bitmap it draws onto, or you must serialize drawing with window resizes. Don't allow resize until other thread has finished drawing.

ascripnik
08-14-2002, 06:30 AM
Ok, thank you
I have fixed the problem!

In fact I synchronized only bitmap drawing early, so using glFinish and synchronizing all OGL drawing resolves the problem.