Any support for stencil buffer?

BlitzMax Forums/BlitzMax Beginners Area/Any support for stencil buffer?

Ryan Burnside(Posted 2009) [#1]
I was just wondering if there is any type of stencil buffer in Blitzmax? I would like to have some odd shapes textured if possible.


GfK(Posted 2009) [#2]
There is a parameter in CreateGraphics to add a stencil buffer but I have no idea how its used.


ImaginaryHuman(Posted 2009) [#3]
You can use the stencil buffer if you know how to write your own OpenGL or DX programs. In OpenGL you have full support for writing to the stencil buffer using any geometry you like, and using the stencil to test/discard incoming pixels against based on the stencil values.


Matt Vinyl(Posted 2011) [#4]
Sorry to resurrect a two-year old thread, but is there any advance on this more recently?

I'll admit I've only just awoken my interest surrounding stencil-buffers, but they sound extremely useful and have a few ideas as to where they could be implemented in a few of the things I'm working on.

All the best,
M.


Kryzon(Posted 2011) [#5]
In my case I'm setting it up like so:
SetGraphicsDriver GLMax2DDriver(),GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER|GRAPHICS_ALPHABUFFER|GRAPHICS_STENCILBUFFER
Note the last flag, GRAPHICS_STENCILBUFFER.
Then you can use CreateGraphics or Graphics to create the context.

The stencil-buffer can be used for plenty of masking effects. For instance, I can't use Klepto2's MiniB3DExtNew's stencil shadows extension without setting that flag. And they work great.
Under the hood this engine is using glEnable(GL_STENCIL_TEST) and other API commands, which you need to educate yourself with.

If you're looking for using the stencil buffer with any of the DirectX versions, make sure you read this thread.


kfprimm(Posted 2011) [#6]
I posted this a while ago.

It adds depth, stencil buffer, and 16 bit support. Should work for you.