View Full Version : Repeating / Reusing normal / texcoord data

08-29-2008, 12:41 AM
If I have a set of 4 normals which repeat over and over again in a buffer, but pair up with varying vertex data. Is there a way to 'loop' the normal data? I am drawing these using glDrawArrays so do not have control from the client side over each primitive.

I cannot find an example of doing this, nor can I find any reference to it in Google, or here... but I am guessing it is something that people must have wanted to do before. Surely?

I guess (although I don't know) that instancing in GL3.0, Geometry shaders and Shader 4 gl_instanceID would allow this, and obviously using uniforms you could preset 1 or more repeated data structures.. but as it stands in GL2.0 and shader 3 I can't see a way to do it as each time you enter the vertex shader it doesn't know anything about the identity of each specific vertex..

Any suggestions I would be very grateful for..

EDIT : I have considered passing just instance variables into the vertex shader from another buffer, which in turn could access an array of uniforms. Is this the most elegant solution? Is it even possible as the data would be float and accessing an array requires an integer...