Friday 15 May 2015

c++ - OpenGL Incorrect glRasterPos position -


So I'm playing with OpenGL and pulling bitmap and it seems that by one pixel glRasterPos is off when I GL_CURRENT_RASTERPOSITION, I can see that Rudding (Flo) is causing this error, for example, when I set the x-pause to 110, the result is 109.9998, due to which the bitmap is at pixel 109 Is drawn. Any ideas why I can not drag on Pixel 110? See examples and outputs below:

  glMatrixMode (GL_PROJECTION); GlLoadIdentity (); Glouatho 2D (0, 800, 800, 0); GlMatrixMode (GL_MODELVIEW); GlLoadIdentity (); GlViewport (0, 0, 800, 800); GlRasterPos2f (100.0, 12); Glagfluate (GL_CURRENT_RASTER_POSITION, position); Printf ("% f \ n", position [0]); GlRasterPos2f (110.0, 30.0); Glagfluate (GL_CURRENT_RASTER_POSITION, position); Printf ("% f \ n", position [0]); GlRasterPos2f (111.0, 45); Glagfluate (GL_CURRENT_RASTER_POSITION, position); Printf ("% f \ n", position [0]); Console Output: 100.000000 109.999992 111.000015   

UPDATE: This is using the Ortho2D and glViewport values. = "Post-text" itemprop = "text">

Instead try using "code" glrasterpos2i and specify integer coordinates.

No comments:

Post a Comment