Jump to content
  • Advertisement
Sign in to follow this  

Vertex Arrays and Texture Mapping.

This topic is 2974 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


Is this technically correct when using vertex arrays?

// Bind the correct texture.

glBindTexture(GL_TEXTURE_2D, _tex_ids[mesh->texture]); <- This

glVertexPointer(3, GL_FLOAT, GLsizei(sizeof(Vertex)), mesh->verts[0].pos);
glNormalPointer(GL_FLOAT, GLsizei(sizeof(Vertex)), mesh->verts[0].n);
glTexCoordPointer(2, GL_FLOAT, GLsizei(sizeof(Vertex)), mesh->verts[0].tc);

glDrawElements(GL_TRIANGLES, GLsizei(mesh->tris.size()*3), GL_UNSIGNED_INT, &mesh->tris[0]);

The texture mapping isn't working, my model is only being displayed as a grey (sort of) shadow. This is the first time I've tried using vertex arrays.

I've checked that the images are loaded correctly and that texturing is enabled.

Share this post

Link to post
Share on other sites
I figured out that it doesn't have anything to do with the texture binding. I'm using GLFW to load a tga image and it's giving me nonsense.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!