So I decided to go again and try to use a generic vertex attribute to store my 
index numbers.  I noticed from another osg forum thread that there is currently 
a problem using int values for vertex attributes but that floats are working 
and can be converted to ints in the shader.  With that in mind, I implemented 
Christian's code snippet up to the part where I've already added a vec2 float 
vertex attribute to the 6th position.  I have a couple of questions though:

1.  in osg there is no Vec1Array (which makes sense), but then if I only wanted 
to store 1 float value for each vertex, what would I use?  osg::array ?

2.  I need to access the vertex values from a frag shader instead of the vertex 
shader as seen in Christian's code snippet.  If I have a generic vertex shader 
like this:


Code:

void main(void)
{ 
    gl_FrontColor = gl_Color; 
    gl_Position = ftransform(); 
}




then can I access the vertex attribute in the frag shader like this?



Code:

in vec2 indices; 
void main(void)
{
        //get index from vertex attribute 6
        vec2 index = indices;
}



[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=46137#46137





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to