Archived

This topic is now archived and is closed to further replies.

Mithoric

Lesson #26 (stencil buffer)

Recommended Posts

Ok, now I''m almost all the way through lesson 26 (just occured to me I''d only ever skimmed over it before). Now, you (NeHe) were talking about placing a &1 into the stencil buffer, now if I understand what you were talking about you are just setting bits (or summit) in the stencil buffer by which the address is referenced using the & on the 1 so it puts a 1 at that specific address which will overwrite the 0 which we put in there earlier when we cleared the stencil buffer after setting the clear value to 0 in the glInit function? So it know where to map somethin'' by going through the buffer doing stuff when it comes to a 1?

Share this post


Link to post
Share on other sites
quote:
Original post by Mithoric
Ok, I''ve finished the tutorial now. And I must say it seems extremely, well wrong. All that for a reflection? It doesn''t seem to be very dynamic either, I mean it''s alright with set values but I mean a completely dynamic scene with all sorts of objects, you''d have to do the stencil stuff for every single one of them manually like that???

Very weird.

I''m going to play with the stencil buffer a little more though, to build up my confidence.

Tutorial was easy to follow though, I understood it all, just didn''t seem like very efficient code. :\


I think you confused some stuff . You would only have to play with the stencil buffer for multiple reflective surfaces, all the objects that are being reflected on the plain would al compare against the same buffer, this buffer basically marks out where the mirror/reflective surface is so the objects reflections don''t get drawn outside this area. So, you can easily place as many dynamic objects you want around a reflective surface with only rendering to the stencil buffer once.

Share this post


Link to post
Share on other sites
lol, I hoped nobody had read that post. As soon as I posted it and alt+tabbed into dev-c++ again and looked at my code I realised that I''d been mistaken and it was actually very workable... I think it was just the time I took to do the tutorial (as I was also building my basecode and making textures at the same time) it just seemed like a long time and I thought I''d coded a lot more than I did for the reflection.

Share this post


Link to post
Share on other sites