PDA

View Full Version : bind tangent array?



supagu
05-04-2004, 12:14 AM
im curently using vbo's in my application, and have got shaders working, but seems there is no glTangentPointer,

now im using vbo's for performance, and dont want to have to manually go a bind a tangent for each vertex when using shaders, surely there must be some way to bind an array to a shader parameter?

some 1 suggested BindAttributeLocation but there aint really much info on this on the net yet.

ideas?

azazello
05-04-2004, 12:55 AM
the right solution is VertexAttrib/VertexAttribPointer;

but it is possible to use MultiTexCoord(in fact, it's just another interface to the same data array)

table from ARB_vertex_program spec:


Generic
Attribute Conventional Attribute Conventional Attribute Command
--------- ------------------------ ------------------------------
0 vertex position Vertex
1 vertex weights 0-3 WeightARB, VertexWeightEXT
2 normal Normal
3 primary color Color
4 secondary color SecondaryColorEXT
5 fog coordinate FogCoordEXT
6 - -
7 - -
8 texture coordinate set 0 MultiTexCoord(TEXTURE0, ...)
9 texture coordinate set 1 MultiTexCoord(TEXTURE1, ...)
10 texture coordinate set 2 MultiTexCoord(TEXTURE2, ...)
11 texture coordinate set 3 MultiTexCoord(TEXTURE3, ...)
12 texture coordinate set 4 MultiTexCoord(TEXTURE4, ...)
13 texture coordinate set 5 MultiTexCoord(TEXTURE5, ...)
14 texture coordinate set 6 MultiTexCoord(TEXTURE6, ...)
15 texture coordinate set 7 MultiTexCoord(TEXTURE7, ...)
8+n texture coordinate set n MultiTexCoord(TEXTURE0+n, ...)

yooyo
05-04-2004, 01:05 PM
Try to to following:
1. in your vertex program define a new verex attribute:
attribute vec4 vTangent;

2. BEFORE LINKING do following
glBindAttribLocationARB(ProgramObject, INDEX, "vTangent");

3. Now, tangent will take INDEX position. Use glVertexAttribPointerARB(INDEX, ...) to setup your tangent array.

yooyo