Why are state attributes applied when they are off?

42 views
Skip to first unread message

Alexandre Vaillancourt

unread,
Apr 3, 2020, 8:21:05 AM4/3/20
to OpenSceneGraph Users
Hello all!

I’m not sure I totally understand what I’m currently doing. 

I’m trying to make one of our models displayable only with the “core” profile (using 3.3, 4.2, etc.), I seem to be able to build OSG for that (e.g., the code that is in ’OSG_GL_FIXED_FUNCTION_AVAILABLE’ defines is correctly left out), and create contexts for 3.3+.

I’m using the osgsimplegl3 example as a basis, and one of the simple models that we have here (converted to osgt for my tests). 

Now, my test model contains stuff like “quads,” which I managed to remove manually (for now, will fix that later), and it also contains attributes like
osg::Material {
    UniqueID 4 
    Name "default" 
    Ambient  TRUE Front 0.50 0.50 0.50 1 Back 0.50 0.50 0.50 1 
    Diffuse  TRUE Front 0.91 0.91 0.91 1 Back 0.91 0.91 0.91 1 
    Specular TRUE Front 0.72 0.72 0.72 1 Back 0.72 0.72 0.72 1 
    Emission TRUE Front 0 0 0 1 Back 0 0 0 1 
    Shininess TRUE Front 10 Back 10 
  }
  Value OFF
osg::TexEnv {
    UniqueID 8 
  }
  Value OFF 


When I run the example, I get errors like those:

Warning: Material::apply(State&) - not supported.
Warning: TexEnv::apply(State&) - not supported.

Looking at the code, this indicates that it’s an “error” caught by OSG, and it doesn’t call the OpenGL API.

Now, I’m wondering, if the Value is OFF (and it also appears to be off when I debug the code), why is the attribute applied anyway? What would I need to do to have the attribute not applied?

Thanks!

I'm using OSG 3.6.3.

--
Vaillancourt

OpenSceneGraph Users

unread,
Apr 3, 2020, 8:48:08 AM4/3/20
to OpenSceneGraph Users
Hi Vaillancourt, 
I can try to answer some of your questions:

> I’m not sure I totally understand what I’m currently doing. 
- Sorry, I don't know either

> Now, I’m wondering, if the Value is OFF (and it also appears to be off when I debug the code), why is the attribute applied anyway?
- That's how this works, the attribute is applied with (boolean) value OFF.
  This might be because the default value is ON, or somewhere above your node in the tree the attribute is set to ON.

> What would I need to do to have the attribute not applied?
  Remove it from your osgt file.

Regards, Laurens.

--
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/82b35a1a-e591-4187-9883-d3710400e851%40googlegroups.com.
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Alexandre Vaillancourt

unread,
Apr 6, 2020, 8:34:01 PM4/6/20
to OpenSceneGraph Users
Laurens, thanks for the reply; 
 
> What would I need to do to have the attribute not applied?
  Remove it from your osgt file.

The rationale for keeping it in our osgt file is that we use those values to set them to the uniforms in the shaders. I guess we could toss them once we have read them and applied them to the shader.

Would there be a way to keep them there and not have them applied?

I admit that this is not the biggest of the issues I'm facing with trying to use 4.2 in our software. 

Chris Djali / AnyOldName3

unread,
Apr 7, 2020, 4:03:45 AM4/7/20
to OpenSceneGraph Users
Hi,

You could just set uniforms in the osgt file if you want an osgt file that says uniforms.

Cheers,

Chris

Alexandre Vaillancourt

unread,
Apr 7, 2020, 8:35:31 PM4/7/20
to OpenSceneGraph Users
Hi Chris,


You could just set uniforms in the osgt file if you want an osgt file that says uniforms.


That's an option we could look into, thanks!

--
Vaillancourt 
Reply all
Reply to author
Forward
0 new messages