Hardware accelerated background image

It would be nice to have a hardware accelerated method of blitting an image as a background.

/* Setup background image
*/

MyImage bkgImage("Checkers.rgb");

glLoadBackgroundImage(
	bkgImage.dimensionality(), // e.g. GL_TEXTURE_2D
	bkgImage.channelCount(), // 1,2,3,4 ...
	bkgImage.width(),
	bkgImage.height(),
	bkgImage.dataFormat(), // e.g. GL_RGBA
	bkgImage.dataType(), // e.g. GL_UNSIGNED_BYTE
	bkgImage.imageData() // const void*
)



/* Clear the display and blit the background image.
*/
GLbitfield mask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT;
glClearColor(0,0,0,1);
glClear(mask);

glBlitBackgroundImage();

Have been thinking about this myself, but in a slightly different way though. Since it’s a background, you don’t need to clear the framebuffer, as you do in your code, before showing the background, since the background image will ‘re-clear’ the framebuffer. Instead, you just pass it a texture id/pointer to a bitmap/whatever in a function similar to glClearColor, and the image is automatically shown when calling glClear, when GL_COLOR_BUFFER_BIT bit is set of course.

But some problems will arise. Will this be resolution-dependant? What will happen when the image is smaller/bigger than then vireport? We gonna apply some kind of minification/magnification filter?

And… uuh… bkgImage.dimensionality()? How do we show the background as a 1D image? Horizontal or vertical? And 3D images?

Anyways, haven’t thought much about it, because I can’t come up with enough situations where a static background image is usable.

Overlays can solve this problem, but if only more cards supported this.
Also can be done with glDrawPixels, but again, this function needs to be quicker on the average card.

Your best bet is to use a textured quad that covers the entire scene and also turn off z-buffer test and writing.

V-man