PDA

View Full Version : glRasterPos() woes



Tokage
08-07-2003, 05:39 PM
I'm creating a bitmap-drawing function and I want it to draw just the part of the bitmap that's in my window when it's partially offscreen. It works fine on the top and right sides but not on the left or bottom. If I give glRasterPos() values that are offscreen it simply doesn't draw the bitmap. Is there any way around this?

al_bob
08-07-2003, 07:02 PM
Clamp the raster pos to the edge of the screen, then offset the texture coordinates (or pixel coordinates) to compensate?

vincoof
08-07-2003, 10:53 PM
Originally posted by Tokage:
If I give glRasterPos() values that are offscreen it simply doesn't draw the bitmap.
That's exactly the behaviour specified in OpenGL.

Originally posted by Tokage:
Is there any way around this?
Yes, first setup a valid raster position, that is inside the frustum. Then call glBitmap(0, 0, 0, 0, offset_x, offset_y, NULL);
This will offset the raster position is screen coordinates. If that offset leads the position outside the screen, the bitmap rasterization will NOT be discarded (though it may be partially clipped obviously).

It's explained better in the OpenGL FAQs. Check out the FAQs section at www.opengl.org (http://www.opengl.org)

Relic
08-08-2003, 12:51 AM
Or use http://oss.sgi.com/projects/ogl-sample/registry/IBM/rasterpos_clip.txt if available.

Bob
08-08-2003, 04:45 AM
glWindowPos will set the raster position in window coordinated, and keep it valid if it's outside view viewport.