CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2008
    Posts
    32

    2d lighting needed

    Anyone know of good libraries/apis/algorithms for (dynamic) lighting/shadows using C++?


    All I'm basically looking for is something that will work for a top down game with lights and objects in one plane although a more elaborate solution with extras is also welcome. Something like this would be nice

    http://www.youtube.com/watch?v=8jveziFLHyQ
    Last edited by Jarwulf; April 25th, 2010 at 09:09 PM.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: 2d lighting needed

    In order to achieve that sort of effect, you'll need 3D geometry and lights in 3D space, but you can keep it simple: maybe the floor is at z=0 and the walls rise up to z=1, or something equally straightforward.

    In order to get a 2D appearance, simply use glOrtho() to set up your projection matrix.

    OpenGL does not directly support shadows, but there are some techniques for generating them:
    http://www.opengl.org/resources/code...rts/index.html
    Last edited by Lindley; April 25th, 2010 at 09:24 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
  •  





Click Here to Expand Forum to Full Width

Featured