attribute vec3 Tangent;
attribute vec3 BiNormal;
or something similar. How do I set things up so that GLSL knows where to find my tangents and binormals. While I'm at it, does anyone know any good sources for calculating Tangents and BiNormals. I have seen the tutorial @ http://www.terathon.com/code/tangent.html, but the code is a tad hard to follow and it soen't explain the why. I think I can figure it out well enough, I was just curious as to whether anyone has any other links.
Setting up GLSL attributes
Hi everybody, I started messing around with some GLSL today, and I'm a bit stumped. I want to attempt to do some normal mapping, and for that I need to send normals and binormals per vertex. I figure the easiest way to do that is to just shove them into texture coords. My question is, however, how do you setup your own attribute? there is a render monkey example that has the binormal and tangent declared as
hi,
you can use glMutiTexCoord or glVertexAttrib to pass them into your shader.
Before using glVertexAttrib, remember bind the user defined attribute and link the program again.
you can use glMutiTexCoord or glVertexAttrib to pass them into your shader.
Before using glVertexAttrib, remember bind the user defined attribute and link the program again.
So, let me see if I understand this. Do I pass in my attributes with VertexAttrib4f( index, values ), where index is the location of my attribute gotten with GetAttribLocation( my_program, "MyAttribName" )? If anyone knows of an example of how to do this that would help too. Looking at source is always easier. Except when it isn't.
ppl often pass them in with texture coordinates
eg
tangent = gl_MultiTexCoord4.xyz;
bitangent = gl_MultiTexCoord5.xyz;
normal = gl_MultiTexCoord6.xyz;
eg
tangent = gl_MultiTexCoord4.xyz;
bitangent = gl_MultiTexCoord5.xyz;
normal = gl_MultiTexCoord6.xyz;
I can't get attribute location by using glGetAttribLocationARB. Because glGetAttribLocationARB is always return 0. I just pass the index which what I bind to glGetAttribLocationARB.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement