Hi,

I am not sure if this is the same problem I came accorss many years ago when
we were developing our Java wrappers of OSG objects. We also has issues that
were caused by the finalizer deleting OSG peer objects from its own thread.
To get around the problem we simply changed the code in our finalize method
to simply queue the deletion opertion. This queue is then processed, and the
delete of the native osg object is done on our main update / render thread. 

It sounds like the issue you are having is trying to delete OpenGL obejcts
from a different thread that the one used to create them (which will always
be the case if it is done from the finalizer).

Hope this helps.

Cheers,

Brad

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Eron Steger
Sent: Friday, 6 July 2007 12:19 AM
To: osg users
Subject: [osg-users] Trouble with OpenGL context from another thread (java)

Hello,

I've got a Java program which during an object's finalizer deletes an osg
Viewer object.  From what I understand, this may be occurring a different
thread than the thread the viewer was originally created in.  
Upon deletion of the viewer, I get the following error:

Windows Error #170: [Screen #1]
GraphicsWindowWin32::makeCurrentImplementation() - Unable to set current
OpenGL rendering context. Reason: The requested resource is in use.

The callstack is:
osgViewer::Viewer::~Viewer -> osg::GraphicsContext::close ->
osg::GraphicsContext::makeCurrent ->
osgViewer::GraphicsWindowWin32::makeCurrentImplementation

 From the look of it, another thread must currently has the opengl context
current.  However, the main thread isn't calling 'update' or something like
that at this point, and is basically complete.

I'd like to know if there is a way to do this properly with multiple
threads?  Is OpenSceneGraph careful with how it uses an OpenGL context such
that it can be shared by multiple threads, or is it just assumed that all
such work is in a single thread?

- Eron


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/



DISCLAIMER:---------------------------------------------------------------------------
This Email may contain confidential and/or privileged information and is 
intended 
solely for the addressee(s) named. If you have received this information in 
error, or
are advised that you have been posted this Email by accident, please notify the 
sender by return Email, do not redistribute it, delete the Email and keep no 
copies.
--------------------------------------------------------------------------------------

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to