I use this code to load a texture:
glGenTextures( 1, (GLuint*) &m_handle );
glBindTexture( GL_TEXTURE_2D, (GLuint) m_handle );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap->GetPixelBuffer() );
And I use this code to render a texture:
glBindTexture( GL_TEXTURE_2D, (GLuint) tex.GetHandle() );
glBegin( GL_QUADS );
glTexCoord2i( 0, 0 );
glVertex3i( x, y, depth );
glTexCoord2i( 1, 0 );
glVertex3i( x + width, y, depth );
glTexCoord2i( 1, 1 );
glVertex3i( x + width, y + height, depth );
glTexCoord2i( 0, 1 );
glVertex3i( x, y + height, depth );
glEnd();
But I get that horrible white rectangle where the texture should be on the screen. I've done some debugging, and the "handle" is 1, like it should be. Does it appear that the error is in the code above? Thanks for your time.
[Edited by - Daggerbot on June 17, 2008 1:24:14 AM]