PDA

View Full Version : Object size on the screen



dvm
02-26-2004, 08:24 AM
Hi to everyone, my question is the following:
I'm creating a window with the following reshape function (I use glut):



glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-512, 512, -384, 384, 0.0, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

From what you can see above I chose an aspect ratio of 1024x768.
Now inside this window I create a small square with glRecti(-40, -40, 40, 40);
Just being curious I got a ruler and measured the square appearing on my screen. I found out that usually the x-side was 1mm wider than the x-side. Is this a distortion of my specific hardware? Has anyone come across a similar thing? Thanks in advance.

Bob
02-26-2004, 08:45 AM
If you have a CRT monitor, I can think of two sources that can cause at least a millimeter of error. The picture you see is projected on the back of the glass, but you can only measure on the front. This means there is a possible error source in the measurement becuase you can't exactly determine where on the ruler the square begin/end. The pixel ratio 4:3 requires the picture area to be 4:3 aswell to get a 1:1 pixel size ratio. CRT's usually have the option to stretch the picture in some directions, so if you have done that, you don't have a 1:1 pixel size ratio any more.

I don't find it unlikely that these two sources can add up to a millimeter error for a 80x80 pixel square.

zeckensack
02-26-2004, 09:17 AM
It also depends on your viewport size and physical aspect ratio.
If you have a decorated window with a perfect 4:3 aspect ratio, the decoration (ie title bar and menu) will distort the aspect ratio of the client area.

And then you might have a resolution with non-square pixels. Eg 1280x1024 on a 4:3 CRT produces non-square pixels.

nexusone
02-26-2004, 10:07 AM
Well a monitor is not a precission device, so you could have some distortion or error.
1 mm is not a real big deal since you are looking at the monitor from some distance any way.
I think the most important would be keeping aspect ratio's and the over all image being produced.

dvm
02-26-2004, 03:56 PM
Thanks to everyone for your elaborative answers. It was not a matter of great importance, but sometimes it`s good to know small details like this. I never would of thought that adjusting my screen size would create small errors in the appearance of one's window. The stuff on the window decoration was good to know, because I always wondered why I did not have the window size exactly as I had specified. Once again, thank you.