Hi all,
I've made some investigations. First of all, I've tested several OSG
versions with the following code :
osgViewer::Viewer viewer;
viewer.setThreadingModel(osgViewer::ViewerBase::SingleThreaded);
osg::DisplaySettings::instance()->setCompileContextsHint(true);
osg::DisplaySettings::instance()->setMaxNumberOfGraphicsContexts(1);
viewer.setUpViewInWindow(100, 100, 800, 600);
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
viewer.realize();
if (osg::GraphicsContext::getCompileContext(0) != NULL)
{
osg::Image *image = osgDB::readImageFile("test.jpg");
osg::StateSet *stateset = new osg::StateSet();
osg::Texture2D *texture = new osg::Texture2D();
texture->setImage(image);
texture->setUnRefImageDataAfterApply(true);
texture->setInternalFormatMode(osg::Texture::USE_S3TC_DXT5_COMPRESSION);
stateset->setTextureAttributeAndModes(0, texture,
osg::StateAttribute::ON);
osg::GraphicsContext::getCompileContext(0)->makeCurrent();
stateset->compileGLObjects(*osg::GraphicsContext::getCompileContext(0)->getState());
osg::GraphicsContext::getCompileContext(0)->releaseContext();
if (texture->getImage() == NULL)
{
osg::notify(osg::NOTICE) << "Texture successfully applied !" <<
std::endl;
}
viewer.setSceneData(createTexturedQuad(0, 0, 100, 100, stateset));
}
viewer.run();
(the createTexturedQuad function just returns a geode with a quad and the
texture applied on it).
Here are my results :
- OSG 2.2 and OSG 2.4 : it seems to work, I have the "Texture successfully
applied !" message and my quad have the texture on it. Note : if I don't
specify the setMaxNumberOfGraphicsContexts, my image is not unref but it
still works.
- Latest SVN : If setMaxNumberOfGraphicsContexts is not set to 1, it crash.
If it's set, I got the "Texture successfully applied !" message but my quad
has no texture applied on it.
Robert, have you any hint on where to look next ? You told it works on
Linux, so do you think it will be usefull to start looking at the
modifications on the Win32 implementation of osgViewer since OSG 2.4 ?
On Mon, Aug 4, 2008 at 2:14 PM, Serge Lages <[EMAIL PROTECTED]> wrote:
> Some time ago it worked for me (the same time when we were able to make
> glGetString calls outside a draw callbacks).
>
> I'll try to make some tests this afternoon and let you know how it goes.
>
>
> On Mon, Aug 4, 2008 at 1:56 PM, Glenn Waldron <[EMAIL PROTECTED]> wrote:
>
>> FWIW I have never been able to get compile contexts to work on Windows
>> since the feature was introduced. So I believe the issue goes back a ways
>> (i.e., is not particular to 2.6).
>>
>> HTH- Glenn
>>
>>
>> On Mon, Aug 4, 2008 at 6:17 AM, Adrian Egli OpenSceneGraph (3D) <
>> [EMAIL PROTECTED]> wrote:
>>
>>> Hi Robert,
>>>
>>> i just come tested under windows vista, same as problem as Serge reported
>>> :-(
>>>
>>> PixelBufferWin32::makeCurrentImplementation, wglMakeCurrent error: The
>>> requested resource is in use.
>>>
>>>
>>> 2008/8/4 Robert Osfield <[EMAIL PROTECTED]>
>>>
>>> Hi Serge,
>>>>
>>>> I've been doing testing the compile context support using osgviewer on
>>>> paged database I have and it all works without error so far. I'm
>>>> using Kubuntu 7.10 and 7800GT. I enable compile contexts via:
>>>>
>>>> export OSG_COMPILE_CONTEXTS=ON
>>>> osgviewer pagedmodel.ive --SingleThreaded
>>>>
>>>> I tried the whole range of threading models without incident.
>>>>
>>>> So this problem looks to be a Windows issue. My guess is that the
>>>> error report of about a problem with make current is what is the early
>>>> warning of something not working quite right. I'm afraid I can't do
>>>> much to investigate this myself though as I have no Windows box to
>>>> test against.
>>>>
>>>> Robert.
>>>>
>>>>
>>>> On Thu, Jul 31, 2008 at 9:44 AM, Serge Lages <[EMAIL PROTECTED]>
>>>> wrote:
>>>> > Hi all,
>>>> >
>>>> > I am currently trying to use CompileContexts on my application, but
>>>> just
>>>> > doing this :
>>>> >
>>>> > osgViewer::Viewer viewer;
>>>> >
>>>> > viewer.setThreadingModel(osgViewer::ViewerBase::SingleThreaded);
>>>> > osg::DisplaySettings::instance()->setCompileContextsHint(true);
>>>> > return (viewer.run());
>>>> >
>>>> > The application crash into glExtensions.cpp line 46 (trying to get the
>>>> GL
>>>> > version with glGetString( GL_VERSION )).
>>>> > Before the crash I have this error message :
>>>> >
>>>> > PixelBufferWin32::makeCurrentImplementation, wglMakeCurrent error: La
>>>> > ressource demandé est en cours d'utilisation.
>>>> > or in english something like that :
>>>> > PixelBufferWin32::makeCurrentImplementation, wglMakeCurrent error: the
>>>> > wanted resource is already being used.
>>>> >
>>>> > Any idea on what's happening ?
>>>> > My system : WinXP with SVN head, VS 8 Express, NVIDIA 8600GTS
>>>> >
>>>> > Thanks in advance !
>>>> >
>>>> > --
>>>> > Serge Lages
>>>> > http://www.tharsis-software.com
>>>> >
>>>> > _______________________________________________
>>>> > osg-users mailing list
>>>> > [email protected]
>>>> >
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>> >
>>>> >
>>>> _______________________________________________
>>>> osg-users mailing list
>>>> [email protected]
>>>>
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>
>>>
>>>
>>>
>>> --
>>> ********************************************
>>> Adrian Egli
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> [email protected]
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>
>>
>> --
>> Glenn Waldron : Pelican Mapping : http://pelicanmapping.com :
>> +1.703.652.4791
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
>
> --
> Serge Lages
> http://www.tharsis-software.com
>
--
Serge Lages
http://www.tharsis-software.com
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org