Hi everyone,
Ok, am having trouble drawing the textured image
to the screen. Here is how I am using it right now:
// Creating the texture
glGenTextures(1, &m_Texture);
glBindTexture(GL_TEXTURE_2D, m_Texture);
glTexImage2D(GL_TEXTURE_2D, 0, 3, bitmap.bmWidth,
bitmap.bmHeight, 0, GL_RGB, GL_UNSIGNED_BYTE,
bitmap.bmBits);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
Now I have an OpenGl window of given width and height. What I want to
do is draw the texture into this OpenGL screen. So; I try:
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_Texture);
glBegin(GL_QUADS);
glTexCoord2i(0, 0);
glVertex2i(0, height);
glTexCoord2i(1, 0);
glVertex2i(width, height);
glTexCoord2i(1, 1);
glVertex2i(width, 0);
glTexCoord2i(0, 0);
glVertex2i(0, 0);
glEnd();
glDisable(GL_TEXTURE_2D);
This, however just colors my screen with a white background and does not draw the texture. I would really appreciate some help here.
Thanks and cheers,
xargy