Hi Eric,
When using multiple shaders you must always have just one shader
containing the main - just like a C program, and the other shaders are
just like seperate source files that define functions that the main
uses.
Robert.
On 11/30/06, E. Wing <[EMAIL PROTECTED]> wrote:
Okay, I think I figured out where my color problem was coming from. I
didn't realize I needed to specify values for color and texture
coordinates even when I didn't want to do anything with them except
pass-through to get the default fixed-pipeline behavior.
This is what I came up with for my vertex shader. Can somebody do a
sanity check to see if this is the right/best way to do it.
void main()
{
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_Color = gl_Color;
vec4 v = vec4(gl_Vertex);
v.x = log2(v.x) * 0.301029995664;
gl_Position = gl_ModelViewProjectionMatrix * v;
}
Doing this gave me my texture and color back (with anti-aliasing)
which is what I wanted.
I have a new problem though. When I add additional vertex shaders to
my program, only one vertex program seems to work (sometimes nothing
appears to work so I'm not even sure if that's working). Basically, I
want 3 different vertex shaders, one to transform each axis
independently (as there are 8 possible combinations for 3 axes with 2
states).
So I create 1 osg::Program and attach it to a stateset that belongs to
the geometry I want to transform.
I create 3 Vertex shaders with the program above (except I use v.y and v.z).
I call program->addShader() for each program when I need it.
I call program->removeShader() for each program when I don't need it.
Is the problem that I can't add multiple vertex shaders with this API?
If so, how would you recommend I approach this instead?
Thanks,
Eric
_______________________________________________
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/