Hi, osg::Material pretty much encapsulates OpenGL's fixed-function material state, so things like glMaterialfv (that controls material settings for whole draw calls) and glColorMaterial (that controls what vertex colours actually affect). If you're using a suitably old GLSL version, you can access this state through the built-in uniforms. These aren't featured prominently in lots of the modern OpenGL documentation like the wiki as they're removed in modern OpenGL, but I have this bookmarked and it at least says what's there: http://mew.cx/glsl_quickref.pdf. Once you know an actual uniform name, relevant stuff should show up in a search engine. The one problem you'll hit is that there's no built-in uniform to say whether glColorMaterial is enabled or what mode it's in, so you'll have to set that up yourself with a uniform or shader define.
I *think* that with the right combination of settings, OSG exposes similar uniforms in newer OpenGL/GLSL versions where the fixed function pipeline has been removed, so that's something to look into. I've never needed this, though, so don't know if it just happens when OSG is compiled with GL3 support, or whether there's more that you need to do. Hope this helps, Chris On Wednesday, 8 January 2020 22:53:28 UTC, Armin Samii wrote: > > Does openscenegraph provide easy access to osg::Material values in the > shaders? If so, in which Uniforms are the various properties set? If not, > is the best path forward to set my own Uniforms based on osg::Material? > > For context: I had an OBJ/MTL that loaded and rendered fine by default, > but when I turn on `setUseVertexAttributeAliasing`, the texture coordinates > seem to break. I am trying to replace the default rendering with my own > shader instead, but can't reproduce the original look and feel. While > texture coordinates and texture loading does work with shaders, I cannot > seem to find how to access the colors specified in the MTL files. > > (A google search shows several results for "openscenegraph material > shaders" which looks helpful, but they are all in the forum, which is now > inaccessible. Apologies if this question has been asked and answered > elsewhere.) > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/5b4d4380-6d02-4726-a13f-2068c47d70d6%40googlegroups.com.
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

