View Full Version : glPixelZoom accuracy

01-19-2004, 08:09 AM
I've inherited a project from one of my predecessors that is using openGL as a 2D graphics drawing tool. I'm placing maps on the backs of displays, and need them to be accurate. The maps that I am placing are roughly 4096x4096 pixels, and as such, when zoomed out, are using a zoom factor of approximately 0.05 (in some cases). However, using glPixelZoom, I can set these values using GLfloats, but when I draw the map, the scale is not quite right, and performing glGet(GL_ZOOM_X) or glGet(GL_ZOOM_Y) results in the zoom being set to a multiple of 0.015625 (which for the mathematically enclined of you is 1/64). At these scales, the map is very noticable out (by some 50 miles on the map at some stages).

Is there any way that I can either change the accuracy of the glPixelZoom function to be more accurate (and stop rounding off to multiples of 1/64, or change my implementation method without having to worry about regenerating images at different resolutions or mipmapping)?

Many thanks.

PS. I'm running Irix 6.5 on an O2 machine (silicon graphics)

01-19-2004, 08:26 AM
The 1/64 step zoom factors look like a bug or implementation limitiation to me. (I haven't used an O2 or Irix.)
If you use pixelzoom today you don't need to care for mipmaps or regeneration of textures, because pixelzoom is not prettier than using nearest filtering with textures. Pixels are not filtered when zooming out, just left away.
The quick and ugly route to mimic that would be to download the backdrops as textures and drawing them as screen aligned quads. You actually get an improvement in zoom quality if you use GL_LINEAR minification filtering.
Depending on the limit of GL_MAX_TEXTURE_SIZE on your O2 you'd need to split the image into multiple patches.

01-19-2004, 08:33 AM
I wouldn't rely on pixel zoom accuracy at this level. Load the images to texture (in tiles if need be) and zoom them using texcoords and polygon vertex values.