Just trying to use the stencil buffer and stencil ops to render every second line of my scene. Is there any quick way to do this? Anyone have a quick’n’dirty code listing for this? I think PolyStipple might be the way to go as far as the stencil buffer but either I get nothing in the stencil buffer or garbage.
The pixel mask ordering is a bit strange, but I managed to get the effect of ‘every other line’ with this code :
GLubyte a[128] ;
for (i=0;i<128;i+=1) {
a[i]=0xFF; // init to ‘draw all’
}
i=0;
do {
a[i]=0x00; // clear 4*8 pixels
a[i+1]=0x00;
a[i+2]=0x00;
a[i+3]=0x00;
i+=8; // jump a line
} while (i<128);
glPolygonStipple(a);
glEnable(GL_POLYGON_STIPPLE);
Good luck.
EDIT: and if you use only polygons (no lines or glBitmaps) you won’t need a stencil buffer mask. Just enable stippling and draw everything, it will work.
[This message has been edited by ZbuffeR (edited 12-15-2003).]