View Full Version : Blitting

06-27-2003, 04:05 PM
What is the easiest way to blit a large bitmap (800x600) from a file to the screen? I have tried loading the bitmap onto a textured quad, but it will only accept power-of-two dimensions, and I've heard that glDrawPixels() is unacceptably slow.

06-27-2003, 05:19 PM
Try rectangle textures with GL_NEAREST filtering. There are two extensions for this, NV_texture_rectangle and EXT_texture_rectangle (seen on ATI cards, it works quite well and is much faster there than glDrawPixels).
Note that these two extensions are actually identical, the defined enumerant values are even the same. Ie you can handle both with a single code path.

Note that EXT_texture_rectangle isn't quite official yet, there's so far only a preliminary spec on the apple website. This has already been discussed here (a few topics below atm).

06-27-2003, 06:34 PM
Alternatively, create a large power of 2 texture (large enough to contain your image - which may be significantly bigger than your image), and use glTexSubImage to upload your image into the texture, then when you render your big screen sized quad, adjust the texture coordinates to match the image area in the texture.
This requires zero use of opengl extensions.

06-27-2003, 06:47 PM
Will older graphics cards be able to handle texture dimensions as big as 800x600 or 1024x1024?

06-27-2003, 07:50 PM
Will older graphics cards be able to handle texture dimensions as big as 800x600 or 1024x1024?

Depends on how old http://www.opengl.org/discussion_boards/ubb/wink.gif. The thing to do is query the maximum supported texture size and then split up your image into tiles if it's too large.

Another way to do what you want would be to render each pixel as geometry via GL_POINTS.

Which of the three methods is the fastest will depend on the hardware and screen resolution.

-- Zeno

06-28-2003, 12:43 AM
NVIDIA Riva TNT, ATI Rage 128, Matrox G200, integrated Intel controlers (i810, Solano, etc...) all support 1024x1024. Voodoo3 does not.

06-28-2003, 05:52 AM
Thanks, the help is much appreciated.