Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Writing directly to the stencil buffer

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    21

    Writing directly to the stencil buffer

    Instead of the standard increment, replace etc operations on the stencil buffer I'd like to be able to write arbitrary values directly from a shader. I don't mind of this is during typical rendering with the stencil buffer bound via a frame buffer or the image_load_store extension or anything else. I just want to assign varying values in a single pass. I'm not aware of a way to do this, does anyone here have any ideas?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Dec 2009
    Posts
    206
    Unless you have a driver supporting GL_ARB_shader_stencil_export there's no easy way to do that. When I needed a certain pattern in the stencil buffer for stencil routing I ended up with an 8-pass implementation that wrote one stencil bit per pass using the standard stencil ops.


  3. #3
    Junior Member Regular Contributor tksuoran's Avatar
    Join Date
    Mar 2008
    Location
    Cambridge, UK
    Posts
    224

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •