Sign in to follow this  

OpenGL Unique Masks in a Stencil Buffer

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this