PDA

View Full Version : GLDrawPixels doesn't draw if the origin is offscreen



halo
01-25-2004, 04:41 PM
If GLRasterPos2f is used to place the image offscreen (but some of the image is still onscreen) the image will not be drawn. What is the fastest/best/standard way around this?

Thanks.

chowe6685
01-25-2004, 06:04 PM
Use textured quads

halo
01-25-2004, 06:08 PM
I know you can do that, but textures always come out looking blurry, and have requirements for the size. I want sharp, crisp images of any dimensions, even if it is slower.

[This message has been edited by halo (edited 01-25-2004).]

ZbuffeR
01-26-2004, 12:01 AM
Mmmh, you can have sharp looking texture mapped quads, you know.
The image you what to draw seems to have the same resolution as the screen. So first disable filtering :
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_NEAREST);

Then, if the texture is rectangular and/or non power of two, try GL_ARB_texture_non_power_of_two or GL_EXT_TEXTURE_RECTANGLE or GL_TEXTURE_RECTANGLE_NV, see http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/015190.html .
If none of these above extensions are available, well put you image to an enclosing larger power of 2 texture, try to draw a quad in ortho 2D projection having the same size as your image, and compute carefully the texture coordinates to match the useful part of the texture. You will waste some texture memory, and having the right projection and coordinates might be tricky, but it should work.

Edit: spelling



[This message has been edited by ZbuffeR (edited 01-26-2004).]

Bob
01-26-2004, 12:45 AM
Or use glWindowPos to place the raster position instead. It will not invalidate the raster position if it's outside the view volume, as glRasterPos will.

Obli
01-28-2004, 02:35 AM
Originally posted by halo:
If GLRasterPos2f is used to place the image offscreen (but some of the image is still onscreen) the image will not be drawn. What is the fastest/best/standard way around this?

No, it is a limitation of RasterPos2f, you have to use the extension which Bob named. It was designed to address specifically that issue.



[This message has been edited by Obli (edited 01-28-2004).]