Jump to content
  • Advertisement
Sign in to follow this  
Elotemuygrande

Accidental Transparency with GL texturing

This topic is 5465 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

I've been trying to load an MD2 model, and I've come up against a very odd problem. The mesh displays properly, however when I try to apply a texture the result is a partially see-through model and the wrong texture data applied. Any ideas what the problem might be? I'm using GL vertex/texture arrays for the drawing. Thanks for any ideas. Relevant code bits: current_skin = SDL_LoadBMP("igdosh.bmp"); glEnable(GL_TEXTURE_2D); glGenTextures(1, &texid); glBindTexture(GL_TEXTURE_2D, texid); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glTexImage2D(GL_TEXTURE_2D, 0, 3, current_skin->w, current_skin->h, 0, GL_RGB, GL_UNSIGNED_BYTE, current_skin->pixels); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(3, GL_FLOAT, 0, Vertices ); glTexCoordPointer(2, GL_FLOAT, 0 , TexCoords); glColor4f(255,0,0,1); glBindTexture(GL_TEXTURE_2D, texid); glTranslatef( P->getVn(1), P->getVn(2), P->getVn(3) ); glScalef(.1,.1,.1); glDrawElements(GL_TRIANGLES, num_tris * 3, GL_UNSIGNED_SHORT, Indices);

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!