Question

This information doesn't exist on Google somehow.

I need to transfer texture coordinates to my shader programs but ATTRIB_TEXCOORD doesn't exist. What do I do with glVertexAttribPointer?

Thank you.

Was it helpful?

Solution

Given a shader program and the name of the texture attribute (in this example the attribute is named “textureCoords”) you get the index like this:

int a_texture = glGetAttribLocation(program, "textureCoords");

and then use a_texture in glVertexAttribPointer like this:

glVertexAttribPointer(a_texture, 2, GL_FLOAT, 0, 0, textureVertices);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top