PDA

View Full Version : Pixel precise



Michael Steinberg
05-10-2000, 10:00 AM
I ended up programming a windows-like window system for my opengl engine. Every window gets a new glViewport as well as a call to glOrtho to setup a plain 2d resolution with the size of the window.
For example: The window has 100x100 pixels.
I set up glViewport with the correct window size. Now I do a call to glOrtho, with parameters 0 for left, 0 for top and width and height for the remaining viewport planes.
Now, I end up creating some rectangles for the window-frames, but some lines simply draw over the others even if I specify their coordinates with 1 distance (which should be 1 Pixel - theoretically?).
Any ideas are appreciated!

Michael Steinberg

dmy
05-11-2000, 12:12 AM
welcome back michael!

i didn't tried any of these ideas... let me know if they work.

try to specify pixel-centered coordinates, like (0.5,0.5) for the bottom-left pixel.

or else, try to pass coordinates as integers.

Dolo/\/\ightY

Michael Steinberg
05-11-2000, 10:27 AM
Hey dmy!
I think I know you from the old board!
Cool to see some known faces here, because the nicks I see here now are all a bit confusing and they make the board look somewhat unprofessional...
I'll try your thoughts! The pixel centering with 0.5 in each direction didn't work when I tried but I'll try that integer one. If that doesn't help, that destroys my view of actual accelerators/vendors. BTW: I've got still my Viper550 with RivaTNT on Detonator 2.08. Is that known to be unprecise?

Thanks!

lgrosshennig
05-11-2000, 02:11 PM
Hi Michael!

Glad to see you back!

Well, I have the same gfx card as you, but I still remenber that the texel midpoint was set to something like 0.2 to 0.3 in older versions of the driver.

Well, just a thought!

Regards,

LG http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Michael Steinberg
05-13-2000, 06:39 AM
Cool man!
Gonna try that.

cya

lgrosshennig
05-13-2000, 10:47 AM
Hi there.

This may sound a bit silly or extreme, but did you changed the mode of the fpu?

By default it internaly works with:
64bit/round to nearest/exections

You could try 32Bit/truncate/execptions

to see what comes out (should give you a little speedboost as well)

Don't panic, the other programms are not affected by this change (a context change also safes the cpu/fpu states)

Just a thougt.

Regards,

LG http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Michael Steinberg
05-15-2000, 07:27 AM
Hey man!
Oh my god! Trying to change FPU mode? Isn't that a bit dirty? Oh well, anyway. How to do that? Is it bad to drop the precision? I mean, my C manual told me that the float type would take 4 bytes, why does the compiler use 8 then? Wouldn't that be the double type? I'm not too much into the theories of pc's/cpu's so can anybody tell me?

thnx -Michael

lgrosshennig
05-15-2000, 11:31 PM
Hehehe, somebody may call it dirty, I think it is cool http://www.opengl.org/discussion_boards/ubb/cool.gif

Well, let me explain, it doesn't have anything to do with your compiler (it still generates 4bytes for a float).

It is only affecting the internal behavior of the fpu. By default a float (32bit) is converted into a double (64bit) when loaded into the fpu then your operations are excuted and when you store the result as a float again, it is converted back to 32bit acordinf to the rounding mode you specified.

And the good think this converion is for free (means takes no extra cycles).

I can send you some code to do it, If you really want "dirty code" http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Regards,

LG http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Eric
05-15-2000, 11:57 PM
Hi Michael !

It's been a long time since we heard something from you !!!
I am a bit curious and I wondered if you tried your code on various machines/graphics cards to see if the behaviour was the same in every case...
Well, this is of no help to you but, as I said, I was a bit curious !

Regards.

Eric

Michael Steinberg
11-02-2000, 05:12 PM
Hey guys! Well it has been a long time... I'm still havin' that problem, and I have no other graphics cards here (tell my parents my allowances would not be enough if you like).
But more basically, I wanted to say hello to all I know!!!!