Texture

Started by
5 comments, last by Hip_notic 18 years, 8 months ago
im having trouble putting a texture on my 2d image heres the code its code from the nehe tutorials

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
}


whats wrong with it i think it has to do with the gltexcoord2f cause i dont think i have them right
Advertisement
What is the problem? Do you see anything at all or just a white box?
----------------------------------------------------"Plant a tree. Remove a Bush" -A bumper sticker I saw.
ya just a white box

[Edited by - Hip_notic on August 6, 2005 7:44:09 PM]
  1. Do you have a valid OpenGL context before you create the texture?

  2. Do you generate and bind a valid texture name before texture upload?

  3. Do you provide all mipmaps or specify a non-mipmap dependant minimisation filter?

  4. 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.
----------------------------------------------------"Plant a tree. Remove a Bush" -A bumper sticker I saw.
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).
ok i figured it out thanks guys

This topic is closed to new replies.

Advertisement