PDA

View Full Version : Life using stencil buffer



OddJob
10-09-2000, 09:09 PM
In the OpenGL Programming Guide there's an description of how to implement life using stenciling. Has anyone ever created working code using this method? Why is the depth buffer needed? I'm sure the author must have skipped a few critical steps or I would'nt be ripping my hair out trying to decipher 3 short paragraphs.


The book is online at: http://shiva.missouri.edu:88/SGI_Developer/OpenGL_PG/19487.toc

Don't Disturb
10-10-2000, 03:13 AM
Your link gives an access denied message, and you need to be specific about what your problem is.
Stencil buffering isn't difficult at all, but it isn't used as much as it could be, because some hardware (like Voodoo3s) doesn't support it properly.

Khrob
10-10-2000, 05:52 AM
Which part of the process dont you follow?
(page 526 or 527, if you're reading the second edition?)

Basically you're using the stencil buffer to add up how many 'live' neighbours a cell has, by offsetting the image 8 times (1 cell/pixel/unit of your choice in each direction) and each live cell accumulates in the stencil buffer, then you know that any cell in the stencil buffer with a value of 2 (I think) should be alive in the next generation.

Hope this helps!