Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Let's say I want to make a really simple artillery game, something like Gorillas. I don't have any experience in games, just some basic understanding of OpenGL. I want to do this for fun and to learn something.

I figured out how to simulate gravity and generate simple terrain and how to do some collision detection. But I have no idea how do they mask out the part of the terrain that is hit with a projectile that leaves a hole in form of a circle.

I tried enabling stencil buffer and put a quad which has a circle texture on it expecting to mask out only the circle part, but it masked out the whole quad -- I mean it was a rectangle shaped hole and not a circle shaped one. Next I thought maybe some blending will do the trick but I didn't figure it out how. Or should I just draw a polygon with many edges to look like a circle and use that instead (with the stencil buffer)? I'm just curious how it is done. Can someone point me in the right direction?

share|improve this question
2  
Related, probable dupe: gamedev.stackexchange.com/questions/6721/… –  Tetrad May 2 '11 at 6:18
    
Thanks, will look into it. –  gyozo kudor May 2 '11 at 6:38
    
It seems that is the way I want. I should probably use a single large texture for the terrain, I was planning to do it with quads or maybe triangles. –  gyozo kudor May 2 '11 at 7:24
    
Not a dupe, as kudor gyozo wants to use a polygon based destructible environment, instead of an arbitrary bitmap. –  AttackingHobo Jul 5 '11 at 16:08
    
Not sure if you've tried these or if they would work but have you made the polygon transparent and/or used a square texture where the area outside of the circle is transparent? –  Gary Buyn Jul 5 '11 at 22:56

1 Answer 1

up vote 1 down vote accepted

I ended up using only one texture and I drew holes in it. Circles with 0 alpha values. My original idea was to separate the mask from the terrain somehow but I'm a total noob to opengl, I don't know what can be and can't be done. I used the information from here: Implementing a 2D destructible landscape (like Worms) and this also helped How do I draw anti-aliased holes in a bitmap..

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.