OpenGL raster

Apprentice
Posts: 13
Joined: 2006.09
Post: #1
Hi guys!
I'm again here looking for your precious help!
I'm working at a 2d engine using the openGL (with glDrawPixels) and I've met a peculiar problem during the development:
Positioning the raster (with glRasterPos2i) from the middle to the end of the screen lenght (e.g., if the screen resolution is 800x600, you call a value >= 400 as x coordinate) the position is increased of a pixel!
glRasterPos2i(200, 50) positions the raster at 200 on the axis
glRasterPos2i(399, 50) ppositions the raster at 399 on the axis
glrasterPos2i(400, 50) positions the raster at 401 on the axis
glRasterPos2i(504, 50) positions the raster at 505 on the axis and so on..
How is it possible?
Practically, I'm not able to position the raster exactly in the middle of the screen. Is there anything I'm not considering??
Thanks in advice Grin
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #2
RasterPos goes through the normal coordinate transform, so it is possible error is introduced.

Use WindowPos instead.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #3
Yeah, but glDrawPixels is very slow, so why use it at all? I'd use textures instead.
Quote this message in a reply
Apprentice
Posts: 13
Joined: 2006.09
Post: #4
arekkusu Wrote:RasterPos goes through the normal coordinate transform, so it is possible error is introduced.

Use WindowPos instead.
Thank you Wink
Quote this message in a reply
Member
Posts: 59
Joined: 2007.12
Post: #5
AnotherJake Wrote:Yeah, but glDrawPixels is very slow, so why use it at all? I'd use textures instead.

Yes, that would be much faster (and probably easier).
Quote this message in a reply
Apprentice
Posts: 13
Joined: 2006.09
Post: #6
Thanks for your advice, i will try it Wink
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Vector versus raster graphics in openGL WhatMeWorry 2 4,180 Dec 29, 2005 01:23 AM
Last Post: WhatMeWorry