Re: [osg-users] Bug in initial renderer compile?

2014-01-23 Thread Michael Jensen
You are welcome, Robert. And thank you for providing a patch. It worked
like a charm! :-)

Yes you may suggest upgrading to 3.2 ;-). It is indeed a good time since we
have shipped our product to the customer and it will be a while until the
next release. We are using osgEarth, osgBullet (and thus osgWorks) so we
have a lot of rebuilding ahead of us, though.

Thank you,

Michael


On Thu, Jan 23, 2014 at 10:44 AM, Robert Osfield
wrote:

> Thanks for the example Michael.  Using this example I recreated the
> problem with svn/trunk and fixed it by adding a clean up of an osg::Program
> that are applied during the GLObjectVisitor traversal.  I have checked the
> fix into svn/trunk and OSG-3.2 branch.  I have also attached a diff file of
> the changes.  Might I suggest this would be a good time to try out the
> OSG-3.2 branch or svn/trunk :-)
>
>
> On 23 January 2014 07:46, Michael Bach Jensen  wrote:
>
>> Hi Robert and Nick,
>>
>> It does very much look like a missing cleanup after compilation.
>>
>> The following things need to be present:
>> - a geometry shader
>> - a uniform
>> - rendering the node using the above after an object that is not
>> compatible with the shader program.
>>
>> I have attached a modified version of osgshape.cpp that causes the
>> failure.
>>
>> Thank you for looking into it!
>>
>> Cheers,
>> Michael
>>
>> --
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=57961#57961
>>
>>
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


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


Re: [osg-users] CompositeViewer with multiple RTT camera views

2014-01-23 Thread Trajce Nikolov NICK
Hi Conan,

the code seam correct to me. I am not familiar with slave cameras (I never
used them, always created my own), so not sure if the CameraManipulators
are affecting them. Can you try to set manually the View matrix of the
right camera so it points to the scene you are attaching? Just an idea,
might not be that though

Nick


On Thu, Jan 23, 2014 at 9:20 PM, Conan Doyle  wrote:

> I am running into some difficulties setting this up... I am trying to set
> up a regular, i.e. non-RTT camera in the left view and the RTT camera in
> the right view...  The left view renders fine, but the right view is just
> black... running the app through gDEBugger it looks like the texture is
> empty... It isn't obvious to me what hte problem is... can anyone provide
> help?
>
>
> Code:
>
>
> // use an ArgumentParser object to manage the program arguments.
> osg::ArgumentParser arguments( &argc, argv );
>
>
> arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
> arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+"
> rttCompositeViewer ");
> arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+"
> [options] filename ...");
>
> osg::ref_ptr scene = osgDB::readNodeFiles( arguments );
> if ( !scene ) scene = osgDB::readNodeFile("cessna.osg");
>
>
> unsigned int windowX = 10;
> unsigned int windowY = 10;
> unsigned int windowWidth = 1024;
> unsigned int windowHeight = 512;
>
> osg::ref_ptr traits = new
> osg::GraphicsContext::Traits;
> traits->x = windowX;
> traits->y = windowY;
> traits->width = windowWidth;
> traits->height = windowHeight;
> traits->windowDecoration = true;
> traits->doubleBuffer = true;
> traits->sharedContext = 0;
>
> osg::ref_ptr gc =
> osg::GraphicsContext::createGraphicsContext(traits.get());
> osgViewer::GraphicsWindow* gw =
> dynamic_cast(gc.get());
> if (!gw)
> {
> osg::notify(osg::NOTICE)<<"Error: unable to create graphics
> window."< return 1;
> }
>
> osgViewer::CompositeViewer viewer(arguments);
>
> //
> // Left View
> osgViewer::View *leftView = new osgViewer::View;
> leftView->setName("Left View");
>
> osg::ref_ptr leftCamera = new osg::Camera;
> leftCamera->setCullMask(1);
> leftCamera->setName("Left");
> leftCamera->setGraphicsContext(gc.get());
> leftCamera->setViewport(new osg::Viewport(0, 0, windowWidth/2,
> windowHeight));
> leftCamera->setClearColor(osg::Vec4(0.0f,0.0f,1.0f,1.0f));
> GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
> leftCamera->setDrawBuffer(buffer);
> leftCamera->setReadBuffer(buffer);
>
> leftView->addSlave(leftCamera.get(), osg::Matrixd(), osg::Matrixd());
> leftView->setSceneData(scene.get());
>
> viewer.addView(leftView);
>
> //
> // Right View
> osgViewer::View *rightView = new osgViewer::View;
> rightView->setName("Right View");
>
> // Create Texture
> osg::ref_ptr tex2D = new osg::Texture2D;
> tex2D->setTextureSize( 512, 512 );
> tex2D->setInternalFormat( GL_RGBA8 );
> tex2D->setSourceFormat( GL_RGBA );
> tex2D->setSourceType( GL_UNSIGNED_BYTE );
>
> // Create RTT Camera
> osg::ref_ptr rttCamera = new osg::Camera;
> rttCamera->setGraphicsContext(gc.get());
> rttCamera->setName("RTT Camera");
> rttCamera->setClearColor( osg::Vec4() );
> rttCamera->setClearMask( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
> rttCamera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT
> );
> rttCamera->setRenderOrder( osg::Camera::PRE_RENDER);
> tex2D->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
> tex2D->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
> rttCamera->setViewport( 0, 0, tex2D->getTextureWidth(),
> tex2D->getTextureHeight() );
> rttCamera->attach( osg::Camera::COLOR_BUFFER, tex2D );
> rttCamera->addChild( scene.get() );
> rightView->addSlave(rttCamera, osg::Matrixd(), osg::Matrixd());
>
> // Create HUD Camera
> osg::ref_ptr hudCamera = new osg::Camera;
> hudCamera->setGraphicsContext(gc.get());
> hudCamera->setName("HUD Camera");
> hudCamera->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
> hudCamera->setClearMask( GL_DEPTH_BUFFER_BIT );
> hudCamera->setRenderOrder( osg::Camera::POST_RENDER );
> hudCamera->setAllowEventFocus( false );
> hudCamera->setProjectionMatrix( osg::Matrix::ortho2D(0.0, 1.0, 0.0, 1.0) );
> hudCamera->getOrCreateStateSet()->setMode( GL_LIGHTING,
> osg::StateAttribute::OFF );
>
> osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(),
> osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(0.0f,1.0f,0.0f),0.0f, 0.0f, 1.0f, 1.0f
> );
> osg::ref_ptr quad = new osg::Geode;
> quad->addDrawable( geom );
>
> int values = osg::StateAttribute::OFF|osg::StateAttribute::PROTECTED;
> quad->getOrCreateStateSet()->setAttribute(new
> osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::FILL),
> values );
> quad->getOrCreateStateSet()->setMode( GL_LIGHTING, values );
>
> 

Re: [osg-users] Unable to bind a Texture2DMultisample to a StateSet

2014-01-23 Thread Frank Sullivan
Shader bug. I was using sampler2D instead of sampler2DMS. Fixed it now, and it 
works great!

Frank

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





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


Re: [osg-users] Unable to bind a Texture2DMultisample to a StateSet

2014-01-23 Thread Frank Sullivan
Yes, Wojtek, you are correct. I habitually used setTextureAttributeAndModes. 
After changing it to just setTextureAttribute, the error goes away.

I am getting a black screen still, but that's probably another issue, as you 
said.

Thanks!

Frank

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





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


Re: [osg-users] Unable to bind a Texture2DMultisample to a StateSet

2014-01-23 Thread Wojciech Lewandowski
Hi Frank,

I believe that GL_TEXTURE_2D_MULTISAMPLE should not applied as mode. Its
the same situation as with GL_TEXTURE_2D_ARRAY. These texture types are
only availalble to programmable pipeline.  Setup of Texture modes are
neccessary for  fixed pipeline. GL_TEXTURE_2D_ARRAY should be set only via
setTextureAttribute and setting setTextureMode( GL_TEXTURE_2D_ARRAY)
results in GL error. I believe GL_TEXTURE_2D_MULTISAMPLE is similar case...

So going back to your original post I believe that
GL_TEXTURE_2D_MULTITEXTURE could be correctly applied by
setTextureAttribute.  And I suspect that it was applied with
setTextureAttributeAndModes even though mode was not actually set and
warning was displayed. Fact that code was not working as intended was
probably caused by some other factor.

Just my 2 cents.

Cheers,
Wojtek Lewandowski


2014/1/24 Frank Sullivan 

> Hi again Robert and others,
>
> I am now getting a glError that occurs in osg::State::applyModeOnTexUnit.
> It is trying to pass GL_TEXTURE_2D_MULTISAMPLE TO glEnable, resulting in an
> invalid enum error. I'm working to track down the source of it, but this is
> code that I'm less-familiar with so it might take a while. I'll keep you
> posted.
>
> Frank
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57976#57976
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Unable to bind a Texture2DMultisample to a StateSet

2014-01-23 Thread Frank Sullivan
Hi again Robert and others,

I am now getting a glError that occurs in osg::State::applyModeOnTexUnit. It is 
trying to pass GL_TEXTURE_2D_MULTISAMPLE TO glEnable, resulting in an invalid 
enum error. I'm working to track down the source of it, but this is code that 
I'm less-familiar with so it might take a while. I'll keep you posted.

Frank

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





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


Re: [osg-users] Unable to bind a Texture2DMultisample to a StateSet

2014-01-23 Thread Frank Sullivan
Thanks very much, Robert!

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





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


Re: [osg-users] CompositeViewer with multiple RTT camera views

2014-01-23 Thread Conan Doyle
I am running into some difficulties setting this up... I am trying to set up a 
regular, i.e. non-RTT camera in the left view and the RTT camera in the right 
view...  The left view renders fine, but the right view is just black... 
running the app through gDEBugger it looks like the texture is empty... It 
isn't obvious to me what hte problem is... can anyone provide help?  


Code:


// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments( &argc, argv );

arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+"
 rttCompositeViewer ");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+"
 [options] filename ...");

osg::ref_ptr scene = osgDB::readNodeFiles( arguments );
if ( !scene ) scene = osgDB::readNodeFile("cessna.osg");


unsigned int windowX = 10;
unsigned int windowY = 10;
unsigned int windowWidth = 1024;
unsigned int windowHeight = 512;

osg::ref_ptr traits = new 
osg::GraphicsContext::Traits;
traits->x = windowX;
traits->y = windowY;
traits->width = windowWidth;
traits->height = windowHeight;
traits->windowDecoration = true;
traits->doubleBuffer = true;
traits->sharedContext = 0;

osg::ref_ptr gc = 
osg::GraphicsContext::createGraphicsContext(traits.get());
osgViewer::GraphicsWindow* gw = 
dynamic_cast(gc.get());
if (!gw)
{
osg::notify(osg::NOTICE)<<"Error: unable to create graphics window."setCullMask(1);
leftCamera->setName("Left");
leftCamera->setGraphicsContext(gc.get());
leftCamera->setViewport(new osg::Viewport(0, 0, windowWidth/2, windowHeight));
leftCamera->setClearColor(osg::Vec4(0.0f,0.0f,1.0f,1.0f));
GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
leftCamera->setDrawBuffer(buffer);
leftCamera->setReadBuffer(buffer);

leftView->addSlave(leftCamera.get(), osg::Matrixd(), osg::Matrixd());
leftView->setSceneData(scene.get());

viewer.addView(leftView);

//
// Right View
osgViewer::View *rightView = new osgViewer::View;
rightView->setName("Right View");

// Create Texture
osg::ref_ptr tex2D = new osg::Texture2D;
tex2D->setTextureSize( 512, 512 );
tex2D->setInternalFormat( GL_RGBA8 );
tex2D->setSourceFormat( GL_RGBA );
tex2D->setSourceType( GL_UNSIGNED_BYTE );

// Create RTT Camera
osg::ref_ptr rttCamera = new osg::Camera;
rttCamera->setGraphicsContext(gc.get());
rttCamera->setName("RTT Camera");
rttCamera->setClearColor( osg::Vec4() );
rttCamera->setClearMask( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
rttCamera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
rttCamera->setRenderOrder( osg::Camera::PRE_RENDER);
tex2D->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
tex2D->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
rttCamera->setViewport( 0, 0, tex2D->getTextureWidth(), 
tex2D->getTextureHeight() );
rttCamera->attach( osg::Camera::COLOR_BUFFER, tex2D );
rttCamera->addChild( scene.get() );
rightView->addSlave(rttCamera, osg::Matrixd(), osg::Matrixd());

// Create HUD Camera
osg::ref_ptr hudCamera = new osg::Camera;
hudCamera->setGraphicsContext(gc.get());
hudCamera->setName("HUD Camera");
hudCamera->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
hudCamera->setClearMask( GL_DEPTH_BUFFER_BIT );
hudCamera->setRenderOrder( osg::Camera::POST_RENDER );
hudCamera->setAllowEventFocus( false );
hudCamera->setProjectionMatrix( osg::Matrix::ortho2D(0.0, 1.0, 0.0, 1.0) );
hudCamera->getOrCreateStateSet()->setMode( GL_LIGHTING, 
osg::StateAttribute::OFF );

osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(), 
osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(0.0f,1.0f,0.0f),0.0f, 0.0f, 1.0f, 1.0f );
osg::ref_ptr quad = new osg::Geode;
quad->addDrawable( geom );

int values = osg::StateAttribute::OFF|osg::StateAttribute::PROTECTED;
quad->getOrCreateStateSet()->setAttribute(new 
osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::FILL), 
values );
quad->getOrCreateStateSet()->setMode( GL_LIGHTING, values );

hudCamera->addChild( quad );
hudCamera->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );

rightView->addSlave(hudCamera, osg::Matrixd(), osg::Matrixd());

viewer.addView(rightView);


return viewer.run();








robertosfield wrote:
> Hi Conan,
> On 23 January 2014 12:58, Conan < ()> wrote:
> 
> > I thought the prefered method to handle multiple independent views was with 
> > a composite viewer.  Can I add slave cameras to a composite viewer
> > 
> 
> 
> Yes, this is why I was referring to View rather than View(er) in my previous 
> reply.  osgViewer is deliberately designed so that each View "has a" master 
> Camera that controls the overall view, and an optional set of slave Camera's 
> that are used to render that view.  The osgViewer::CompsoiteViewer composes a 
> set

[osg-users] space partitioning

2014-01-23 Thread Trajce Nikolov NICK
Hi Community,

is there a way to do this with osg (not with engineering) maybe something
built in

Thanks a bunch!

Nick

-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] CompositeViewer with multiple RTT camera views

2014-01-23 Thread Conan Doyle
Ok.  Thanks for the clarification.
CD


robertosfield wrote:
> Hi Conan,
> On 23 January 2014 12:58, Conan < ()> wrote:
> 
> > I thought the prefered method to handle multiple independent views was with 
> > a composite viewer.  Can I add slave cameras to a composite viewer
> > 
> 
> 
> Yes, this is why I was referring to View rather than View(er) in my previous 
> reply.  osgViewer is deliberately designed so that each View "has a" master 
> Camera that controls the overall view, and an optional set of slave Camera's 
> that are used to render that view.  The osgViewer::CompsoiteViewer composes a 
> set of View objects, while osgViewer::Viewer for ease of use just inherits 
> from View but can't handle multiple views obvious as it's just a single View 
> under the hood.
> 
> 
> You can mix and match multiple View, multiple Scenes, multiple Contexts, 
> multiple slave Camera in any way that you choose.
> 
> 
> Robert.
> 
>  --
> Post generated by Mail2Forum


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





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


Re: [osg-users] CompositeViewer with multiple RTT camera views

2014-01-23 Thread Robert Osfield
Hi Conan,

On 23 January 2014 12:58, Conan  wrote:

> I thought the prefered method to handle multiple independent views was
> with a composite viewer.  Can I add slave cameras to a composite viewer
>

Yes, this is why I was referring to View rather than View(er) in my
previous reply.  osgViewer is deliberately designed so that each View "has
a" master Camera that controls the overall view, and an optional set of
slave Camera's that are used to render that view.  The
osgViewer::CompsoiteViewer composes a set of View objects, while
osgViewer::Viewer for ease of use just inherits from View but can't handle
multiple views obvious as it's just a single View under the hood.

You can mix and match multiple View, multiple Scenes, multiple Contexts,
multiple slave Camera in any way that you choose.

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


Re: [osg-users] CompositeViewer with multiple RTT camera views

2014-01-23 Thread Conan
I thought the prefered method to handle multiple independent views was 
with a composite viewer.  Can I add slave cameras to a composite viewer?


CD

On 2014-01-23 00:55, Robert Osfield wrote:

Hi Conan,

If you have a RTT Camera per View then the natural way to manage it
would be to have a slave camera on each View to do the RTT, and a
slave Camera to render a quad over the full viewport of that View.
 The scene graph for each of the View's would be the same.

Robert.

On 22 January 2014 20:50, Conan  wrote:

I would like to be able render multiple views of an Entity in my 
scene from multiple viewpoints... Left side of entity, Top of entity, 
Front of entity for example I want the camera to be the same 
distance from the entity in each case.


From what I have read today, I think I need to use a Composite Viewer 
to accomplish this.  So I would create the composite viewer and add a 
left view, front view and top view.


It seems easy enough to set this up.  I have a simple test app that 
does this... each view renders the scene (although not from the 
correct viewpoint yet).


What I really need to do though is set up each camera (left side 
camera, top side camera, front side camera) to render to texture then 
render that texture to a full screen quad in each view of the 
composite view.


So basically...

Left Side Camera -> Left Side Texture -> Left Side Quad in Left Side 
View

Top Side Camera -> Top Side Texture -> Top Side Quad in Top Side View
Front Side Camera -> Front Side Texture -> Front Side Quad in Front 
Side View


How do I create the scenegraph for this?  Would all views share the 
same scenegraph?


In past, when I have setup RTT in a single viewer, I have done 
something like this:


    osg::ref_ptr root = new osg::Group;
    root->addChild( rttCamera.get() );
    root->addChild( hudCamera.get() );
    root->addChild( scene.get() );

    osgViewer::Viewer viewer;
    viewer.getCamera()->setComputeNearFarMode( 
osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR );

    viewer.setSceneData( root.get() );

CD
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
[1]




Links:
--
[1] 
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

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


Re: [osg-users] Bug in initial renderer compile?

2014-01-23 Thread Robert Osfield
Thanks for the example Michael.  Using this example I recreated the problem
with svn/trunk and fixed it by adding a clean up of an osg::Program that
are applied during the GLObjectVisitor traversal.  I have checked the fix
into svn/trunk and OSG-3.2 branch.  I have also attached a diff file of the
changes.  Might I suggest this would be a good time to try out the OSG-3.2
branch or svn/trunk :-)


On 23 January 2014 07:46, Michael Bach Jensen  wrote:

> Hi Robert and Nick,
>
> It does very much look like a missing cleanup after compilation.
>
> The following things need to be present:
> - a geometry shader
> - a uniform
> - rendering the node using the above after an object that is not
> compatible with the shader program.
>
> I have attached a modified version of osgshape.cpp that causes the failure.
>
> Thank you for looking into it!
>
> Cheers,
> Michael
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57961#57961
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
Index: src/osgUtil/GLObjectsVisitor.cpp
===
--- src/osgUtil/GLObjectsVisitor.cpp(revision 14023)
+++ src/osgUtil/GLObjectsVisitor.cpp(working copy)
@@ -31,19 +31,31 @@
 
 }
 
-
 void GLObjectsVisitor::apply(osg::Node& node)
 {
+bool programSetBefore = _lastCompiledProgram.valid();
+
 if (node.getStateSet())
 {
 apply(*(node.getStateSet()));
 }
 
 traverse(node);
+
+bool programSetAfter = 
_renderInfo.getState()->getLastAppliedProgramObject()!=0;
+if (programSetBefore && !programSetAfter)
+{
+osg::GL2Extensions* extensions = 
osg::GL2Extensions::Get(_renderInfo.getState()->getContextID(), true);
+extensions->glUseProgram(0);
+_renderInfo.getState()->setLastAppliedProgramObject(0);
+_lastCompiledProgram = 0;
+}
 }
 
 void GLObjectsVisitor::apply(osg::Geode& node)
 {
+bool programSetBefore = _lastCompiledProgram.valid();
+
 if (node.getStateSet())
 {
 apply(*(node.getStateSet()));
@@ -61,6 +73,15 @@
 }
 }
 }
+
+bool programSetAfter = _lastCompiledProgram.valid();
+if (!programSetBefore && programSetAfter)
+{
+osg::GL2Extensions* extensions = 
osg::GL2Extensions::Get(_renderInfo.getState()->getContextID(), true);
+extensions->glUseProgram(0);
+_renderInfo.getState()->setLastAppliedProgramObject(0);
+_lastCompiledProgram = 0;
+}
 }
 
 void GLObjectsVisitor::apply(osg::Drawable& drawable)
@@ -159,7 +180,7 @@
 
 /
 //
-// GLObjectsVisitor
+// GLObjectsOperation
 //
 
 GLObjectsOperation::GLObjectsOperation(GLObjectsVisitor::Mode mode):
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Unable to bind a Texture2DMultisample to a StateSet

2014-01-23 Thread Robert Osfield
HI Frank,

Good detective work.  GL_TEXTURE_2D_MULTISAMPLE was missing from the
TextureGLModeSet singleton found in OpenSceneGraph/src/osg/Texture.cpp, it
was obviously missed when Texture2DMultisample was submitted and merged.  I
have added this and checked it into svn/trunk and OSG-3.2 branch, the
change is simply:

Index: src/osg/StateSet.cpp
===
--- src/osg/StateSet.cpp(revision 14023)
+++ src/osg/StateSet.cpp(working copy)
@@ -54,6 +54,7 @@
 _textureModeSet.insert(GL_TEXTURE_CUBE_MAP);
 _textureModeSet.insert(GL_TEXTURE_RECTANGLE_NV);
 _textureModeSet.insert(GL_TEXTURE_2D_ARRAY_EXT);
+_textureModeSet.insert(GL_TEXTURE_2D_MULTISAMPLE);

 _textureModeSet.insert(GL_TEXTURE_GEN_Q);
 _textureModeSet.insert(GL_TEXTURE_GEN_R);


Robert.


On 23 January 2014 00:40, Frank Sullivan  wrote:

> By the way, here is the warning message I'm receiving:
>
>
> > Warning: non-textured mode '37120' passed to
> setTextureMode(unit,mode,value), assuming setMode(mode,value) instead.
>
>
> The value '37120' corresponds to GL_TEXTURE_2D_MULTISAMPLE .
>
> I'm not sure if setMode is the desired behavior. I'm only seeing a black
> screen, but I'm not positive that this is the problem.[/quote]
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57960#57960
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org