View Full Version : glScalef()

08-12-2005, 06:50 AM
Hi everyone,

I am displaying images on texture mapped quads in orthographic projection mode. In order to achieve zooming in and out, it was suggested to me that I should use glScalef(). This does the job in that it looks like I am zooming in and out.

I would like to ask if there is a way to control where the scaling takes places from though - it seems like the scaling takes place from the origin of the viewport, so my quad goes up and to the right. Can I pick a point (center of the viewport most likely) to do the scale on?

Also, do we still have to use powers of 2 bitmaps with textures nowadays, or can I use a 284 x 122 pix bitmap for example?


08-12-2005, 09:32 AM
glscalef() multiples the verticies of your quads
if you have a quad at 1,1,0; 1,2,0; 2,2,0; 2,1,0 i then becomes 2,2,0; 2,4,0; 4,4,0; 4,2,0

your best bet if your not using gllookat is to do the glscalef first and then the gltranslate statments

there is a way to use textures that are or a diffrent size other than powers of 2. even thou i have heard it is much slower. u might want to read the thread i have going on textures

08-12-2005, 11:00 AM
Hi ninjarider,

Thanks for the info. May I ask what gluLookAt() can do? I have no restrictions on what I can use. Does this center the viewport on a point in the world space or something?

I currently do my scale first then my translate. And this is what results in the effect of the quad being expanded from the origin. Is there someway I can capture the point the user clicked to begin my zoom in function, and keep issuing pan operations to keep moving the quad to be centered on that point while it is scaling?

If gluLookAt() did that more easily I would love to use that!

For the texture map sizes, I'll check your thread,