// start nvmodel rendering code
glNormalPointer( GL_FLOAT, MeshPointer->model.getCompiledVertexSize() * sizeof(float), MeshPointer->model.getCompiledVertices() + MeshPointer->model.getCompiledNormalOffset());
// glTangentPointerEXT( GL_FLOAT, MeshPointer->model.getCompiledVertexSize() * sizeof(float), (void*)(MeshPointer->model.getCompiledVertices() + MeshPointer->model.getCompiledTangentOffset()));
glVertexPointer( MeshPointer->model.getPositionSize(), GL_FLOAT, MeshPointer->model.getCompiledVertexSize() * sizeof(float), MeshPointer->model.getCompiledVertices());
glTexCoordPointer( MeshPointer->model.getTexCoordSize(), GL_FLOAT, MeshPointer->model.getCompiledVertexSize() * sizeof(float), MeshPointer->model.getCompiledVertices() + MeshPointer->model.getCompiledTexCoordOffset());
glEnableClientState( GL_VERTEX_ARRAY);
glEnableClientState( GL_NORMAL_ARRAY);
// glEnableClientState( GL_TANGENT_ARRAY_EXT);
glEnableClientState( GL_TEXTURE_COORD_ARRAY);
glDrawElements( GL_TRIANGLES, MeshPointer->model.getCompiledIndexCount( nv::Model::eptTriangles), GL_UNSIGNED_INT, MeshPointer->model.getCompiledIndices( nv::Model::eptTriangles));
glDisableClientState( GL_VERTEX_ARRAY);
glDisableClientState( GL_NORMAL_ARRAY);
// glDisableClientState( GL_TANGENT_ARRAY_EXT);
glDisableClientState( GL_TEXTURE_COORD_ARRAY); // end nvmodel rendering code
void TangentPointerEXT with Cg ????
whats the deal with this function anyways...
i am trying to pass in tangents and its not working ie segfaulting, and i double check the address and its the same as the normals (cause the use the same array different offset). I am using Cg shaders.
Anyways... here is the code... hopefully someone knows whats up...
is there anymore initialization or anymore info about passing tangents this way?
glTangentPointerEXT is part of which extension?
Also, why don't you submit the tangent through another texcoord?
Also, why don't you submit the tangent through another texcoord?
that makes sense... but im confused how i would use the pointer... i dont see a gltexcoord2pointer.... so how do i call that or use that?
thanks
thanks
You would do something like this (using your code):
Also, last I heard, neither Nvidia nor Ati implements the TangentPointerEXT extension in their drivers.
//for your normal texture coordsglClientActiveTexture(GL_TEXTURE0); //set the active texture to texture0glEnableClientState(GL_TEXTURE_COORD_ARRAY); //enable texture coord array for texture0glTexCoordPointer(MeshPointer->model.getTexCoordSize(), GL_FLOAT, MeshPointer->model.getCompiledVertexSize() * sizeof(float), MeshPointer->model.getCompiledVertices() + MeshPointer->model.getCompiledTexCoordOffset() );//for your tangentsglClientActiveTexture(GL_TEXTURE1); //set the active texture to whatever texture you want to use for tangents, in this example texture1glEnableClientState(GL_TEXTURE_COORD_ARRAY); //enable texture coord array for texture1//make sure to pass 3 as the first argument as tangents have 3 coordinatesglTexCoordPointer(3, GL_FLOAT, MeshPointer->model.getCompiledVertexSize() * sizeof(float), MeshPointer->model.getCompiledVertices() + MeshPointer->model.getCompiledTangentOffset())//do rest of setup and draw here//disableglClientActiveTexture(GL_TEXTURE0);glDisableClientState(GL_TEXTURE_COORD_ARRAY);glClientActiveTexture(GL_TEXTURE1);glDisableClientState(GL_TEXTURE_COORD_ARRAY);
Also, last I heard, neither Nvidia nor Ati implements the TangentPointerEXT extension in their drivers.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement