Original Post
glEnable(GL_NEWBE); Hello! I'm currently making a comeback to opengl after about a year in directx. I didn't remember much of the API so I found myself noobified :). So, I am currently working on a very basic application that is supposed to be showing a textured quad. I got the quad part easily and I just have to map it now! I followed NeHe's tutorials for loading TGA, and I am very confident that my application is now capable of loading these files. However, the problem would be in the way I act to actually show this texture on-screen. It might also be related to device states. Anyways, here's my code : So with this code I get a yellow rotated and translated quad, but no evidence of texture. I've tried to set it white or to omit glColor4f but I still get an untextured sprite. Can anyone help? glDisable(GL_NEWBE);
// WinMain
glEnable(GL_TEXTURE_2D);
while(!g_Window.HasClosed())
{
if(HandleMessages()) continue; // Handles window messages, works fine
g_Environment.ClearColorBuffer(); // Calls ::glClear
g_Sprite.Render(); // see further
g_Device.SwapBuffers(); // ::calls SwapBuffers
}
// Sprite::Render()
glLoadIdentity();
glTranslatef(150.0f, 150.0f, 0.0f);
glRotatef(45.0f, 0.0f, 0.0f, 1.0f);
glBindTexture(GL_TEXTURE_2D, texid); // Texture id of loaded TGA
glBegin(GL_QUADS);
float halfwidth = 50.0f;
float halfheight = 50.0f;
// texrect = { 0.0f, 0.0f, 1.0f, 1.0f } u1,v1,u2,v2
glColor4f(1.0f, 1.0f, 0.0f, 1.0f);
glTexCoord2f(texrect.u1, texrect.v1); glVertex3f(-halfwidth, -halfheight, 0.0f);
glTexCoord2f(texrect.u2, texrect.v1); glVertex3f(halfwidth, -halfheight, 0.0f);
glTexCoord2f(texrect.u2, texrect.v2); glVertex3f(halfwidth, halfheight, 0.0f);
glTexCoord2f(texrect.u1, texrect.v2); glVertex3f(-halfwidth, halfheight, 0.0f);
glEnd();