Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Unique Masks in a Stencil Buffer

This topic is 4774 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know whether it is possible to affect bits in an 8bit stencil buffer in a bitwise fashion ie several bits per pixel on at the same time? I have masking objects that are written to the stencil buffer by setting each stencil pixel to 0x1, normal objects are then rendered if they do not fall in the same region as the stencil bits set to 0x1. If I only have one masking object then everything is fine, but I need to have multiple masking objects that are uniquely identified by their value in the stencil buffer, I figure that I should be able to have 7 unique masking indexes in an 8bit stencil buffer (0x1 for no masking, 0x1 to 0x7 for unique masks). But I don't know if it is possible to do these kinds of bitwise operations on a stencil buffer in opengl. Ie could a certain pixel in the stencil buffer have the bits 0x1 and 0x5 or 0x2 and 0x3 and 0x7 turned on, meaning that if object A is affected by any masks in the stencil buffer with those bits, then it will not be rendered?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!