I would like to build a generic fragment shader that can handle up to 4 texture units, instead of building fragment shaders for each number of used texture units.
Is there a way to figure out in my fragment shader if a texture unit is used or not ? When a uniform sampler contains no valid texture, it seems that its values are 0. And by fragment code like
vec4 color = texture2D( baseTexture, gl_TexCoord[0].xy );
color *= texture2D( baseTexture2, gl_TexCoord[1].xy );
color *= texture2D( baseTexture3, gl_TexCoord[2].xy );
color *= texture2D( baseTexture4, gl_TexCoord[3].xy );
the fragments get black as soon as a uniform sampler is not bound to a texture…
Von: [email protected] [mailto:[email protected]] Im Auftrag von Sergey Polischuk
Gesendet: Dienstag, 20. März 2012 16:50
An: OpenSceneGraph Users
Betreff: Re: [osg-users] texture sampler uniforms
Hi
you need to manually create them and add to statesets. If you'll save model after that - they will be saved correctly and will be there on model load.
20.03.2012, 17:15, "Daniel Schmid" <[email protected]>:
Hi there
I was searching osg to find out what happens with textures when a model node is loaded from file (for example openflight *.flt model). Does osg automatically create uniforms samplers for shaders to access the textures? Do these uniforms have specific names ? or do I have to manually create and bind uniforms for the textures ?
Regards
Daniel
_______________________________________________
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
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

