int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix
glTranslatef(-1.5f,0.0f,-6.0f); //move left 1.5 units
glBindTexture(GL_TEXTURE_2D, texture[0]); // Select Our Texture
glBegin(GL_QUADS); // Draw A Quad
glTexCoord2f(0.0f, 1.0f); glVertex3f(-5.0f, 4.0f, 0.0f); // Top Left
glTexCoord2f(1.0f, 1.0f); glVertex3f( 5.0f, 4.0f, 0.0f); // Top Right
glTexCoord2f(1.0f, 0.0f); glVertex3f( 5.0f,-4.0f, 0.0f); // Bottom Right
glTexCoord2f(0.0f, 0.0f); glVertex3f(-5.0f,-4.0f, 0.0f); // Bottom Left
glEnd(); // Done Drawing The Quad
return TRUE; // Keep Going
}
im having trouble putting a texture on my 2d image heres the code its code from the nehe tutorials
whats wrong with it i think it has to do with the gltexcoord2f cause i dont think i have them right
- Do you have a valid OpenGL context before you create the texture?
- Do you generate and bind a valid texture name before texture upload?
- Do you provide all mipmaps or specify a non-mipmap dependant minimisation filter?
- Did you enable texturing?
Enigma
Quote:Original post by tHiSiSbOb
What is the problem? Do you see anything at all or just a white box?
What Engima said...If you are using someone else's cose (and you know it works), make sure you have the file paths correct.
And that your texture has power-of-two dimensions, e.g. 64x64, 128x128, etc. (Note: They don't have to be square. For example you could use 64x128).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement