Hi,
I’m trying to map a basic texture of a box to a quad.
However all I’m seeing is what is in image 1.
If I draw a dot of 1 pixel size in the image, then I start seeing what is in image 2.
My code is:
void gl::initializeGL()
{
LoadGLTexture();
#ifndef QT_OPENGL_ES_2
glEnable(GL_TEXTURE_2D);
#endif
glClearColor(0, 0, 0, 0); //black background with 0 alpha
BuildList();
}
void gl::paintGL()
{
glClearColor(0, 0, 0, 0); //black background with 0 alpha
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//Draw Background texture
glBindTexture(GL_TEXTURE_2D, texture[0]);
glCallList(m_iBackgroundSquare);
}
void gl::BuildList()
{
//Background display list
m_iBackgroundSquare = glGenLists(1);
glNewList(m_iBackgroundSquare, GL_COMPILE); //New Compiled box Display List
glBegin(GL_QUADS);
//Bottom Left
glTexCoord2f(-1.0f, -1.0f);
glVertex2f(-1.0f, -1.0f);
//Bottom Right
glTexCoord2f(1.0f, -1.0f);
glVertex2f(300,-1.0f);
//Top Right
glTexCoord2f(1.0f, 1.0f);
glVertex2f(300, 300);
//Top Left
glTexCoord2f(0.0f, 1.0f);
glVertex2f(0.0f, 300);
glEnd();
glEndList();
}
I re-used the code from another program that I have that loads images just fine, no idea why I’m getting such wierd results all of a sudden.
The image I’m trying to display is in image 3.
So to me it looks like the mapping went awry and it’s massively zoomed in.