   How to create 2d terrain???
  First of all this link will show you the kind of effect I am trying to achive.http://www.indierover.com/ktb-tutorial-1-2d-randomly-generated-terrain-for-worms-style-game/I thought I would give making that game a go in opengl using c++.Ok, well I started to play with it and ran into a problems, heres what I was doing.I Loaded four textures (dirt(640x480), map(640x480), sky(640x480), and a hole(40x40)).Each one is applied to a quad.The 'map' and 'hole' textures are just alpha maps so when the 'dirt' texture is drawn, the 'map' is drawn over the top of that then some parts of the 'dirt' are blacked out. And the Same situation with the 'hole' (for explosions and such).So then I have three layers..------- dirt(back)------- map------- hole (when needed)(front)Now this worked fine...until I decided to add a sky layer. It wont go between 'dirt' and 'map' or the 'dirt' wont show. And it cant go behind 'dirt' or you wont see the sky at all. I need the sky layer only to appear only where the 'map' blacks out (where there is alpha).So if anyone could suggest a way around this problem or an entirly different way that would be great. Thanks.[Edited by - jarod_77876 on September 13, 2007 8:22:04 AM]
  Um... link missing?   ;  Haha...link added   ;  I've not actually done anything with it myself, but it sounds like the Stencil Buffer might be what you want.   