[osg-users] Textures not displaying properly when you open the OSG window the second t ime arround in a Win32 application
robert.osfield at gmail.com
Fri Sep 26 01:44:15 PDT 2008
This problem has arisen before and is related to the scene graph
reusing the contextID from the previous context in the new context
with the scene graph being flushed of OpenGL objects related to the
original graphics context so the OSG then tries to use these OpenGL
objects in the new context, but of course these objects have really
been deleted so things don't work.
The solution is to flush the GL objects for the context scene graph on
closing of the first context, and the OSG will now do this, so should
just work automatically, but if you detach parts of the scene graph
before closing the context you'll need to flush these parts manually
as the context itself won't know about them unless that are nested
below a Camera that the context has.
This leads to next question, which OSG version are you using? If it
isn't 2.6 then upgrade to 2.6 as there is good chance you problem will
disappear as it does a better job at cleaning up on context closure.
On Fri, Sep 26, 2008 at 9:13 AM, Juan Sebastian Casanueva
<jscasanueva at espelsa.es> wrote:
> We are implementing a Windows application that opens an OSG viewer on
> a Windows window (lets call it 3d window) and displays some 3d graphics.
> The way we are implementing the application is similar to the MFC example
> (although I am not using MFC, but Win32 API instead), the only difference is
> that I use a CompositeViewer instead of a Viewer.
> Everything works fine when you open the 3d window for the first time, but if
> you close the 3d window and open it again (note that you don't close
> the main application, only the 3d window), the textures do not display
> properly anymore. Sometimes some textures are dark, sometimes some are
> white, sometimes they do not show at all, and sometimes some textures are
> swapped between objects. If you close and open again and again, you get a
> combination of those problems. If you exit the main application, start it
> again and open the 3d window, everything is displayed perfectly.
> I don't really know were the problem might be, so if somebody can guide me
> in the right direction as to where the problem might be, I will appreciate
> it .
> Thanks very much
> osg-users mailing list
> osg-users at lists.openscenegraph.org
More information about the osg-users