Hi All,
Why am I getting such low FPS when I try to draw a Non power of 2 texture? I am using a Radeon Mobility x700 which supports OpenGL 2.0.
I initialise the textures and OpenGL where I already have a bitmap loaded into memory:
glGenTextures( 1, &this->texId );
glBindTexture( GL_TEXTURE_2D, this->texId );
glTexImage2D(GL_TEXTURE_2D, 0, 3, imgWidth(), imgHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, imgBuffer );
glEnable(GL_TEXTURE_2D);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glShadeModel(GL_FLAT);
this->object = glGenLists( 1 );
glNewList( this->object, GL_COMPILE );
glTranslatef(-1.5f,0.0f,-15.0f);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
glTexCoord2f(1.0f, 0.0f);
glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
glTexCoord2f(1.0f, 1.0f);
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glEnd();
glEndList();
I then run a timer which updates the scene:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glCallList( this->object );
If I use an image with a resolution of 512x512 then everything runs nice and fast, if I use an image of 500x500 then it just slows down to like 5 FPS!
What am I doing wrong?
Thanks in advance
Andy