iDevGames Forums
OpenGL raster - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: OpenGL raster (/thread-2506.html)



OpenGL raster - MadPsycho - Jul 25, 2008 11:55 AM

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


OpenGL raster - arekkusu - Jul 25, 2008 12:17 PM

RasterPos goes through the normal coordinate transform, so it is possible error is introduced.

Use WindowPos instead.


OpenGL raster - AnotherJake - Jul 25, 2008 12:34 PM

Yeah, but glDrawPixels is very slow, so why use it at all? I'd use textures instead.


OpenGL raster - MadPsycho - Jul 25, 2008 12:42 PM

arekkusu Wrote:RasterPos goes through the normal coordinate transform, so it is possible error is introduced.

Use WindowPos instead.
Thank you Wink


OpenGL raster - _ibd_ - Jul 26, 2008 02:00 AM

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).


OpenGL raster - MadPsycho - Jul 26, 2008 10:19 AM

Thanks for your advice, i will try it Wink