Any support for stencil buffer?
BlitzMax Forums/BlitzMax Beginners Area/Any support for stencil buffer?
| ||
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. |
| ||
There is a parameter in CreateGraphics to add a stencil buffer but I have no idea how its used. |
| ||
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. |
| ||
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. |
| ||
In my case I'm setting it up like so:SetGraphicsDriver GLMax2DDriver(),GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER|GRAPHICS_ALPHABUFFER|GRAPHICS_STENCILBUFFERNote 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. |
| ||
I posted this a while ago. It adds depth, stencil buffer, and 16 bit support. Should work for you. |