[osg-users] OSX/X11 graphics context not updating after window resize

Ravi Mathur ravidavi at utexas.edu
Mon Jun 27 14:17:51 PDT 2016


Hi all,

I have an interesting problem to which I found a strange solution. I don't know why the solution works, and I'd like to know if anyone here could shed some light.

I have an OSG-based visualization API that is designed for use from within any user-provided GUI toolkit. All OpenGL rendering is done in a separate thread; the developer just needs to provide SetGLContext and SwapBuffers callback functions. Simple enough, and it works great with several GUI toolkits on Windows and Mac.

I recently started testing its use on OSX with an OpenMotif-based GUI toolkit called Winteracter. The problem I ran across happens when I get a resize message. I process the message in the OpenGL thread using a GUIEventHandler, which changes the appropriate viewport. However, while the viewport size does change, its origin does not shift to match the resized window's corner! So basically if I increase the window size, the newly exposed portions are left blank even though the rendered image does seem to get bigger, as if OSG thinks everything resized correctly. See the attached picture for an example.

After a lot of tinkering, I found that I can fix the problem if I call glXMakeCurrent to release and immediately reattach the context. This happens in the OpenGL thread when it's processing the resize event.

So, does anyone know WHY this solution (hack) works? Interestingly, everything works correctly if I use OSG's own X11-based viewer. It's only if I use Winteracter's OpenMotif-based window management to create a window that the resize issue happens.

Thanks!
Ravi

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67865#67865




Attachments: 
http://forum.openscenegraph.org//files/resize_without_wglselect_117.png





More information about the osg-users mailing list