[osg-users] [forum] passing material properties to shader uniforms

Goran Pantar gpantar at logicbricks.com
Thu Jun 1 02:39:03 PDT 2017


I'm using OpenGL ES 2.0 and having dificulties to pass the old style material properties (ambient, difusse, specular, shininess) to the uniforms used in my fragment shader.

For the 3d model I use models in 3ds format with multiple materials and multiple drawables. 

As a dirty hack I changed the Material.cpp Material::apply(State&) function. This worked properly and I was able to modify this several global uniforms used by my shader.

Now I'm trying to do this the OSG way using updateCallbacks and visitors but the uniform are not updated during the rendering. Probably only the last drawable material properties are set to the uniform and than this is used when rendering.

I expect that there is some perfectly elegant way to do this, so please point me in the right direction.

Thank you!


Read this topic online here:

More information about the osg-users mailing list