Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Hardware accelerated background image

  1. #1
    Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Huntsville, AL. USA
    Posts
    302

    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();
    Obsessive - A word used by the lazy to describe the motivated.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,982

    Re: Hardware accelerated background image

    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.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    montreal
    Posts
    105

    Re: Hardware accelerated background image

    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
    V--man

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •