Skip to main content
gamedev.net
🔒 Locked

Texture Mapping Question.

Started by swampfoetus 2 replies 300+ views
Original Post
swampfoetus
swampfoetus
Hi, Noob here please bear with me :-) Discovered this site at the weekend after a relatively painless search and I have a feeling it might keep me up late for a good few nights to come. I''ve been working through NeHe''s Tutorials and I''m currently trying to implement a ''simple'' project based on lesson''s #5 & #6, the texture mapped cube. I decided I wanted to render ''The Alien Quad'' DVD Boxset as a spinning texture mapped polygon. I''ve managed to derive the appropriate co-ords to render a coloured cuboid, instead of a bog-standard cube (lesson #5) and I was quite pleased with that. I haven''t managed to photograph the quad boxset yet, but I thought I''d test my texture mapping skills by using a .bmp taken from Amazon, to add a texture to ONE SIDE of the cuboid. So taking the amendments from lesson #6, I''ve enabled texture mapping and i''m loading the bitmap before displaying the polygon. However now that I''ve done this the coloured polygon has vanished and all I get on screen is the face of the cuboid with the bmp glued onto it. What am I doing wrong, how do I get a mixture of textured & non textured faces? Apologies if I''m not providing enough specifics, if you need anything else from me please ask.
void*
void*
Is your texture coordinate specification in the same glBegin() and glEnd() grouping as the quads specification for the rest of the box?

I''ve never tried only texture mapping one face of a solid, but I suggest trying to use two glBegin() and glEnd() groupings... one for the textured face, and one for the other 5 faces. Just to see if it works...
Greenspun's Tenth Rule of Programming: "Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp."
lazork357
lazork357
I''m not sure about this, but I think you should turn GL_TEXTURE_2D off before rendering the other 5 faces of the cube. Otherwise they will be drawn with the texture on them, but every vertex will have as a texutre coordinate the last one provided, so it would be like stretching the point indicated in glTexCoord to the whole face.
I hope this make sense
swampfoetus
swampfoetus
Fantastic, thankyou very much.

I''ve seperated the textured face from the main glBegin()..glEnd() as suggested and disabled GL_TEXTURE_2D before rendering the non textured faces, then enabled it before rendering the textured face. Works like a charm.

1 hour turnaround as well, I''ll definitely be using this forum more often. Thanks again.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.