I’m zooming in on a texture w/ something like this…
zoomFactor = zoomFactor+.1;
if (slider_moving == true){
if (xvalue <(int)(SLIDER_X_PCT*width)-50)
{
xvalue=(int)(SLIDER_X_PCT*width-50);
}
if (xvalue >(int)(SLIDER_X_PCT*width+140))
{
xvalue=(int)(SLIDER_X_PCT*width+140);
}
xhold=xvalue;
xtemp=xvalue;
//Zoom Code
glPushMatrix();
glTranslatef(width/2, height/2, 0);
glScalef(4,4,0);
glEnable(GL_TEXTURE_RECTANGLE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, slides[0].textureName);
glBegin(GL_QUADS);
{
glTexCoord2f(0.0, 0.0) ;
glVertex2f(x_offset - 50.0, y_offset + thumb_height - 50);
glTexCoord2f(0.0, slides[0].image_h_o/zoomFactor);
glVertex2f(x_offset - 50.0, y_offset - 50 );
glTexCoord2f(slides[0].image_w_o/zoomFactor, slides[0].image_h_o/zoomFactor) ;
glVertex2f(x_offset + thumb_width - 50.0, y_offset - 50.0);
glTexCoord2f(slides[0].image_w_o/zoomFactor, 0.0);
glVertex2f(x_offset + thumb_width - 50.0, y_offset + thumb_height - 50.0);
} glEnd();
glDisable(GL_TEXTURE_RECTANGLE_ARB);
glPopMatrix();
So I’m zooming in by changing the zoomFactor variables. Unfortunately, this does not zoom in on the center of the image (instead, it’s the top left corner, I believe). Any suggestions on how to zoom to the center?