I am trying to bind some interleaved vertex attributes from this structure:
struct GPUVertex
{
float position[4];
float texcoords[4];
signed char normaltangent[4];
unsigned char boneindices[4];
unsigned char boneweights[4];
signed char tessnormal[4];
};
My code looks like this. For some reason, all the texture coordinates are showing up as 0.0 in the shader, although I know they are not that in client-side memory.
//Vertex buffers
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer->GetHandle());
//Vertex attributes
for (int n = 0; n < 1; ++n) glEnableVertexAttribArray(n);
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(GPUVertex), nullptr);
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(GPUVertex), (void*)(offsetof(GPUVertex, texcoords)));
glVertexAttribPointer(2, 4, GL_BYTE, GL_TRUE, sizeof(GPUVertex), (void*)(offsetof(GPUVertex, normaltangent)));
glVertexAttribPointer(3, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(GPUVertex), (void*)(offsetof(GPUVertex, boneindices)));
glVertexAttribPointer(4, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(GPUVertex), (void*)(offsetof(GPUVertex, boneweights)));
glVertexAttribPointer(5, 4, GL_BYTE, GL_TRUE, sizeof(GPUVertex), (void*)(offsetof(GPUVertex, tessnormal)));
And then in the vertex shader:
//Attributes
layout(location = 0) in vec4 vertex_position;
layout(location = 1) in vec4 vertex_texcoords;
Any ideas why the tex coords aren’t getting through to the vertex shader?