PDA

View Full Version : Render Every Second Line?



MacDaddy
12-14-2003, 08:15 PM
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.

TIA

ZbuffeR
12-15-2003, 01:49 AM
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).]

Relic
12-16-2003, 04:48 AM
Sounds like vertical interlaced stereo.
See here http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/010918.html
Search for my nickname and "stereo" to find more answers.