Hi Robert,

I managed to solve the problem, thanks a lot for pointing me in the right
direction!
I am using OSG version 2.6, and did see that in the destructor of the
CompositeViewer, there is a call to GraphicsContext::close() which flushes
the objects... But, as you said, I was removing some parts of the scene
graph before closing the context. 
Thanks again for your help.

Juan




-----Mensaje original-----
Date: Fri, 26 Sep 2008 09:44:15 +0100
From: "Robert Osfield" <[EMAIL PROTECTED]>
Subject: Re: [osg-users] Textures not displaying properly when you
        open the        OSG window the second t ime arround in a Win32
application
To: "OpenSceneGraph Users" <osg-users@lists.openscenegraph.org>
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

Hi Juan,

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.

Robert.

On Fri, Sep 26, 2008 at 9:13 AM, Juan Sebastian Casanueva
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> 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
> Juan
> 


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to