Hi again, thanks, now with this information it changes all my perspective about the textures (I'm less concerned :) ).
the example I was talking about was GLSL example, and I think it worked only because probably the default value for the uniform sampler is zero and the texture unit in the stateset was zero. thanks a lot, Guy. ----- Original Message ----- From: "Ulrich Hertlein" <[EMAIL PROTECTED]> To: "osg users" <[email protected]> Sent: Thursday, June 07, 2007 11:53 AM Subject: Re: [osg-users] Re: Re: Asking again about states in shaders, andtexturing issues (Ulrich Hertlein) > Hi Guy, > > Guy Lifchitz wrote: > > ... Thanks for answering. I looked at the samples. Please help me verify that I understand > > correctly the texturing process: 1. The samplers uniforms are only integers for the texture unit. > > > Yes. > > > 2. When creating osg::Texture{nD} object the actual glGenTexture function is called and the > > object is created on the graphics card. > > Exactly. The osg::Texture objects contain the OpenGL texture IDs. > (Actually a list of IDs, one for each context.) > > > 3. When binding texture to stateset you only state the texture unit. > > You state the texture unit that the osg::Texture should be bound to. > > > 4. When rendering, the stateset binds the texture object using the id generated with the > > osg::Texture object, and bind it to the texture unit set with for that object in the stateset. > > > > am I right? > > Yes. > > > To use the texture in the shader I need to add uniform with the sampler name I'm using in the > > shader and set it's value to the texture unit I gave the stateset with the osg::Texture? > > Yes. > > > now if all the above is true I still have two questions: 1. to bind 2 texture units to the same > > texture object I only need to pass the same pointer of osg::Texture{nD} with two different calls > > to StateSet::setTextureAttribute that has different texture units? > > Yes. (Boy, you're systematic. ;-) > > > 2. I saw in some examples usage of sampler texUnit0 as the sampler of the texture, but I haven't > > seen in the C code any reference to that name, so I thought it might be a built in uniform but I > > also haven't seen it in the quick_ref. How does it work? > > I'm not aware of any built-in uniforms concerning textures in OSG. > Do you mean an OSG example (if so, which) or a GLSL example. > > Cheers! > /Ulrich > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
