This is perhaps not a OSG bug specifically, but I thought I would ask
the community on the chance that someone has run into this problem and
has found a solution --

I have a multithreaded application where the OpenGL graphics window is
embedded in Windows Forms application.  The main thread creates the
control and handles the window messages, while a second thread
continuously renders the scene using OSG.

The problem comes when resizing the window.  On NVidia and Intel cards,
resizing works as one would expect.  On ATI cards (or at least the
Radeon HD 3450 I have here), however, it immediately crashes the on the
next iteration of the rendering loop.  It crashes on an opengl drawing
call, and the stack traces leads through atioglx2.dll.

Some details:

 - The "supportsResize" window trait when creating the graphics context
is true.
 - I am intercepting the WM_WINDOWPOSCHANGING event (which is ostensibly
sent prior to the window changing for real) and acquiring a lock on the
rendering loop, so presumably no rendering occurs while the window is
being resized by the operating system.
 - I'm calling osgViewer::GraphicsWindow::setWindowRectangle() with the
new size
 - I tried osg::GraphicsContext::clear() which sets glViewport and
glScissors, but that didn't seem to help.
 - I'm creating the graphics context in the main thread -- creating the
context in the rendering thread presented its own troubles.
 - I've tried making the graphics context current to the main thread
just for the duration of the resize.  No luck.
 - I have a different single-threaded OSG app which has gives no
difficulties with resizing the rendering context on the same computer.

The workaround I have developed is to completely re-create the graphics
context when the window is resized.  This works, but has a couple severe
drawbacks: it is quite slow (so there is a big hiccup when resizing the
window) and it causes all kinds of problems because the texture, display
list and VBO handles are all invalidated, but osg still thinks they are
valid, so I have to explicitly tell OSG to flush all GL objects (and
even then I get stray reports from users of textures showing up on the
wrong surfaces or 3D models all out of whack...)

So does anyone have any idea how to appease the gremlins inside the ATI
driver so that the OpenGL context can be safely resized?

- Peter
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to