Hello,
i have strange Problems with OpenGL on older Graphic Cards with lower OpenGL Version as 2.0. First i will show you the code that i used to draw Images on a 2D Texture. I use Qt4.5 with the QGLWidget as Framework and Windows XP as OS.
The following Code works perfekt on newer versions of Graphic Cards like ATI or NVIDIA.
INIT:
initializeGL()
{
// setup viewport, projection etc.:
glViewport(0, 0, (GLint)width(), (GLint)height());
glEnable(GL_TEXTURE_2D);
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glRotatef(180.0f, 180.0f,0.0f,0.0f); // Rotate
}
DRAW:
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glTexImage2D(
GL_TEXTURE_2D,
0,
GL_LUMINANCE,
m_image.width(),
m_image.height(),
0, GL_LUMINANCE,
GL_UNSIGNED_BYTE,
m_image.bits());
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS); // Start Drawing A Textured Quad
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 0.0f); // Bottom Right
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
glEnd(); // Done Drawing The Quad
glDisable(GL_TEXTURE_2D);
The same code on my Laptop with a intel graphic card and a lower version of OpenGL don´t work. The only thing i see is a white texture. I don´t have any idea why this only works on higher maschines. The Image is scaled to a power of 2.
It would be great if someone could help me.
Regards,
Treehouse