Results 1 to 2 of 2

Thread: Layers / Mapping

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2000
    Location
    Tunstall,Staffordshire,England
    Posts
    2

    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
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    London
    Posts
    503

    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 );
    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

    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.

Similar Threads

  1. blending between the layers in FS
    By debinair in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 02-01-2016, 05:18 PM
  2. Layers on z axis
    By 2Gatunek in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 05-26-2011, 09:16 AM
  3. No more mapping layers, or arbitrary ones
    By Korval in forum OpenGL: General
    Replies: 31
    Last Post: 10-09-2008, 04:49 AM
  4. Layers
    By ramana in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 10-15-2003, 02:59 PM
  5. Layers
    By MemLeak in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 03-12-2003, 07:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean