Using Nehe's 3D World Tutorial
I know this may sound like a stupid question, but how do I bind different textures to the world created in Nehe''s 3D World tutorial? I''ve loaded two different textures, one called
glBindTexture(GL_TEXTURE_2D, texture[1]), and the other glBindTexture(GL_TEXTURE_2D, texture[0]).
I''ve tried tacking on the glBindTexture command to tons of different places in the code, but nothing works. I''ve tried placing it before the glBegin(GL_TRIANGLES) statement, putting it in the glBegin(GL_TRIANGLES) block of code, but to no avail. Anyone have any ideas?
Mr Bugg
March 26, 2002 03:11 PM
You usually bind the texture right before drawing, right before the triangles. If it doesn''t work, you probably did not correctly load the texture, or need to glEnable(GL_TEXTURE_2D),
assuming they are 2d textures.
The problem I''m having is that there is only one triangle statement for all the data loaded, and I want a different texture for the floor, etc. I''ve tried making each sector a seperate triangle statement, then binding the texture, but the screen goes black.
Mr Bugg
Mr Bugg
It sounds like you need to do this
--------------------------
Those who dance are considered insane by those who cannot hear the music.
glBindTexture(GL_TEXTURE_2D, tex[0]);glBegin(GL_TRIANGLES);...Draw walls....glEnd();glBindTexture(GL_TEXTURE_2D, tex[1]);glBegin(GL_TRIANGLES).....draw floor.......glEnd()
--------------------------
Those who dance are considered insane by those who cannot hear the music.
Those who dance are considered insane by those who cannot hear the music.
Make sure you''re calling glTexCoord with different values before drawing each vertex.
---visit #directxdev on afternet <- not just for directx, despite the name
Terminate, your solution was one of the first things I tried- but the screen is blank, even when I don''t bind the second texture.
Set your clear color to red to see if you actually are drawing your geometry.
Try to change your glTexParameter''s. For example, change your filtering parameters.
Try to change your glTexParameter''s. For example, change your filtering parameters.
---visit #directxdev on afternet <- not just for directx, despite the name
Blank texture == No texture.
Check the validity of how you set your texture in OpenGL, especially check that your texture size is a power-of-two.
Check the validity of how you set your texture in OpenGL, especially check that your texture size is a power-of-two.
Man, I''ve tried everyone''s suggestions, but nothing works. I know for a fact the textures work, as I tested them individually. The problem starts even before I bind the second texture, and I''ve done Terminate''s solution. Nothing draws!
Mr Bugg
Mr Bugg
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement