Stencil drawing
BlitzMax Forums/BlitzMax Programming/Stencil drawing
| ||
Anyone know how well supported stencil drawing is on computers in general? (esp the stencil buffers of one bit [on/off]) |
| ||
I think most (if not all) DX7 generation GFX cards have a stencil buffer. 'Fossil' cards probably have a 1bit stencil :P |
| ||
As far as I understand it, EVERY OpenGL implementation MUST have at least a) An RGBA color buffer b) An RGBA accumulation buffer c) A stencil buffer d) A depth buffer e) An Index-mode color buffer f) An Index-mode accumulation buffer g) maybe also index-mode stencil and depth (if that differs?) I think that's meant to be a minimal requirement of any implementation, so you should be able to rely on it existing. If your graphics card doesn't support such a thing then maybe the OpenGL driver for it will implement that part of things in software? |
| ||
There are even hardware implementations of stencil that are that deadly slow that software could be better with a usefull cpu |
| ||
Stencil ops are fairly well supported even on older hardware. However, the number of bits in the stencil buffer varies. If possible try and make sure that your code can handle smaller stencil buffers (if something has less bits, would way say that it has a "lower resolution"?) |
| ||
Well I have done a little reading and from what I understand 8 bits per pixel stencils are quite common (now a days). |
| ||
Right, I whipped up this lump of code...'Number of bitplanes in the stencil buffers Graphics 800,600,0 num=0 glGetIntegerv(GL_STENCIL_BITS,Varptr num) Print "Number of stencil bits = "+num End Reports that my Radeon 9800 pro has 8 bits, how about you lot? |
| ||
0 (Zero) on a GeForce4-Ti4200. If I'm not mistaken you have to set some flags to make sure a stencil buffer is created. Look up the bglCreateContext command to see the different flags. Using: bglCreateContext(800,600,0,0,BGL_BACKBUFFER|BGL_DEPTHBUFFER|BGL_STENCILBUFFER)I get 8 stencil bits. |
| ||
bglCreateContext(800,600,0,0,BGL_BACKBUFFER|BGL_DEPTHBUFFER|BGL_STENCILBUFFER) num=0 glGetIntegerv(GL_STENCIL_BITS,Varptr num) Print "Number of stencil bits = "+num End Does it give you a different result? |
| ||
I get 8 stencil bits. |
| ||
:o) Ta, what else do you other lot get? |
| ||
8 bits, ati radeon 9800 pro. |
| ||
My old Radeon 7200 reports 8 as well |
| ||
My even older Tnt1 card also reports 8! (and also works on winxp!) |
| ||
Number of stencil bits = 8 , FX5900 |
| ||
GeForce 4 Mx has 8 as well :) |
| ||
Cool to know you need to specify it in the context creation. From what I read, EVERY implementation of OpenGL should have an stencil buffer but not necessarily 8-bit. ... "Your particular OpenGL implementation determines which buffers are available and how many bits per pixel each holds. Additionally, you can have multiple visuals, or window types, that have different buffers available. At a minimum, you're guaranteed to have one color buffer for use in RGBA mode with associated stencil, depth, and accumulation buffers that have color components of nonzero size, and one color buffer for use in color-index mode with associated depth and stencil buffers. Table 10-1 lists the parameters to use with glGetIntegerv() to query your OpenGL system about per-pixel buffer storage for a particular visual. If you're using the X Window System, you'll probably want to use glXGetConfig() to query your visuals; see Appendix D and the OpenGL Reference Manual for more information about this routine. " |
| ||
Yep, what im trying to work out is there going to be a major problem for me to use more then 1 stencil bit. The more computer the game works on, the bigger the market!. As you can see so far, all above have reported 8 bits. What I would like to see if some older hardware posted here. Anyone willing to try for me (and the good of the blitzy world :P) |
| ||
I get 8 bits on an older Radeon Mobility (7xxx series I think). |
| ||
radeon 9600, 8 bits. |
| ||
if it's for shadows then just have blob fallback on <8bits and be damned with them! |
| ||
Radeon 9600 Pro, 8 bits |
| ||
old FX5200 8 bits |