Jump to content
  • Advertisement
Sign in to follow this  
Hip_notic

Texture

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

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

Share this post


Link to post
Share on other sites
Advertisement
  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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!