Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Layers / Mapping

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2000

    Layers / Mapping

    Is it possible to use layers in OpenGL? I want to display maps and am wondering if it's possible to show them as a set of layers -transparent apart from the objects(polygons/lines /bitmaps etc) on them. If so how do I go about creating them?

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000

    Re: Layers / Mapping

    Shouldn't be a problem...

    If the contents of each layer are fixed:

    Create each layer as an RGBA texture. The A component (alpha) should be zero where you want the layers beneath to show through, 255 where you don't.

    Enable blending:
    glEnable( GL_BLEND );

    Set the texture mode to let the background show through where the texel alpha is zero:
    glTexEnv( GL_REPLACE );

    Then just draw the layers in order as textured quads, bottom to top.

    If you're redrawing each layer every frame, then none of this should be necessary - as long as you're drawing the layers in order it should come out OK.

    Hope this helps, feel free to mail me if any problems.

Posting Permissions

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