glVertexAttribPointer or.. ?

Hello all :slight_smile:
The last days I’ve been asked to make a project in OpenGL. I haven’t touch OpenGL since 2005. I was looking an OpenGL Engine of mine from the past and I realized that I was passing some vertex data to the VertexBufferObject using glTexCoordPointer() (tangents and bitangents) instead of glVertexAttribPointer(). But I can’t remember why! :stuck_out_tongue:
So… now I want to use VBO for a mesh with this data structure:


struct VertexTBN
{
   vector3 pos;
   vector2 texCoord;
   vector3 normal;
   vector3 tangent;
   vector3 bitangent;
};

What is better to use for Tagnents and Bitangents? glTexCoordPointer()? or glVertexAttribPointer()?

I guess for pos, texCoord and normal is best to use glVertexPointer(), glTexCoordPointer(), glNormalPointer() respectively. right?

If I try to glDrawElements() that VBO without a glsl shader will it work?(skiping the tangent and bitangent ofc). or it will fail?

Thanks for your time!

You can only use generic attributes (defined through glVertexAttribPointer) if you’re using glslang (or ARB_vertex_program). So if you have need of the fixed-function pipeline, you’ll need to use glTexCoordPointer.