PDA

View Full Version : Pixel Perfect accuracy?



03-29-2005, 10:30 AM
Does anyone know how to have an ortho projection, and use logical coordinates (e.g: glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0)) and yet retain perfect pixel accuracy of the original texture?

It only really matters in fullscreen mode (800x600, 1024x768 etc) but if it extended to windowed aswell that would be even better.

At the moment I have a simple glViewport(0, 0, width, height) followed by (on the projection matrix) glOrtho(0.0, width, 0.0, height, -1.0, 1.0). This retains pixel perfect accuracy (as expected) regardless of resolution, but it also means things get smaller/bigger as resolution is changed. I wanted things to stay the same size across all display modes. Is it even possible?

Anyone have any ideas?

Cheers :)

ZbuffeR
03-29-2005, 04:06 PM
You have both "perfect pixel accuracy of the original texture" and "things to stay the same size across all display modes".

A single pixel in 640*480 becomes a 1.25 wide square in 800*600.

What do you want to do really ?

03-29-2005, 04:23 PM
The question was both, so I guess the answer is no :)

dorbie
03-29-2005, 04:30 PM
The answer is yes but you need to be specific about what you want. Obviously some stuff is impossible because of fundamental principals of scaling but you can scale a window and draw textured stuff in that window at a pixel scale of 1:1.

The most obvious way is glDrawPixels, but there are efficient things you could do to draw textured quads under scaling transformations to preserve scale very easily.

Adjusting texture coordinates to compensate for 1:1 mapping would also work, texgen could also be used. The question needs to be clearer though.

I assume this isn't just something obviously impossible and stupid like asking if you can display low res at high resolution with 1:1 pixels.