Thanks a lot. Honestly, I don’t understand every line of the code I have.
Here is what I’m doing:
int InitGLGLvoid)
{
if (!LoadGLTextures())
{
return FALSE;
}
glEnable(GL_TEXTURE_2D);
return TRUE;
}
int LoadGLTextures()
{
// prepare
// Load The Bitmap
if (TextureImage[0]=LoadBMP(“bitmap.bmp”))
{
// OK
glGenTextures(1, &texture[0]);
// Create The Texture
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3,
TextureImage[0]->sizeX, TextureImage[0]-
>sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE,
TextureImage[0]->data);
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
// Free The Image Structure
return Status;
}
GLvoid ReSizeGLScene(GLsizei width, GLsizei height)
{
// both dims are power of 2
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, 1.0, 0.1f, 100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, zoom);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glEnd();
return TRUE;
}
Using the code above, the bitmap is shown (not normal size!) and I can zoom in and out by changing the “zoom” var.
Now if I comment the gluPerspective call line from the ReSizeGLScene function (called once at init), and set zoom = 0.0f, the bitmap is shown in the normal size (very good) but changing the zoom var now do not affect the view (no zoom in / out !!)
thanks again for any comment