Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: Pixel precise

  1. #1
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,074

    Pixel precise

    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

  2. #2
    Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: Pixel precise

    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
    Dolo/\/\ightY

  3. #3
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,074

    Re: Pixel precise

    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!

  4. #4
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    184

    Re: Pixel precise

    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

  5. #5
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,074

    Re: Pixel precise

    Cool man!
    Gonna try that.

    cya

  6. #6
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    184

    Re: Pixel precise

    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

  7. #7
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,074

    Re: Pixel precise

    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

  8. #8
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    184

    Re: Pixel precise

    Hehehe, somebody may call it dirty, I think it is cool

    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"

    Regards,

    LG

  9. #9
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    880

    Re: Pixel precise

    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

  10. #10
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,074

    Re: Pixel precise

    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!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •