[GEM-dev] stencil

cyrille henry cyrille.henry at la-kitchen.fr
Tue Mar 7 13:55:51 CET 2006


hello,

copiing your modifications, i've change lines 33 and 34 of the
GemWinCreateXWin.cpp file to this :

static int snglBuf24[] = {GLX_RGBA, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 16, GLX_STENCIL_SIZE, 8, None};
static int dblBuf24[] = {GLX_RGBA, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, GLX_STENCIL_SIZE, 8,
GLX_DOUBLEBUFFER, None};

the buffer is now active, and the red square of the example is not draw
when the test is active.
now, i'm tryng to clear the stencil buffer in order to be able to draw a
shape in this buffer.

this exemple patch does not work.

any ideas?

thanks
Cyrille

james tittle a écrit :


>> hey cyrille,
>>
>> On Mar 3, 2006, at 8:54 AM, cyrille henry wrote:
>>
>>> does anyone have succefully used stencil buffer with GEM?
>>>
>>> here is what i'm trying to do, without succes...
>>
>>
>>
>> ...this is easy:  it's not working because the gemwindow creation  
>> doesn't request a stencil buffer (at least on osx and linux)!   
>> However, I just committed a small change to the osx code that indeed  
>> does enable the stencil buffer, and it should be just as easy to do  
>> for linux and windows...after doing so, the patch works as expected...
>>
>> ...this does bring up an issue:  should we always create the  
>> additional buffers (ie. depth, stencil, accumulation, aux), or should  
>> we create a message for gemwin to selectively enable/disable these  
>> before window creation?  Currently on osx, 24bit depth and 8bit  
>> stencil buffers are created, and on linux it just creates a 16bit  
>> depth buffer...
>>
>> time to go out,
>> jamie
>>
>>
>> _______________________________________________
>> GEM-dev mailing list
>> GEM-dev at iem.at
>> http://lists.puredata.info/listinfo/gem-dev
>>
>>
> 
> 
> ------------------------------------------------------------------------
> 
> #N canvas 0 0 1198 875 10;
> #X obj 54 112 gemhead 44;
> #X obj 54 403 translateXYZ 0 0 -1;
> #X obj 54 90 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
> ;
> #X obj 54 374 GEMglStencilOp;
> #X obj 54 295 GEMglStencilFunc;
> #X floatatom 194 367 5 0 0 0 - - -;
> #X obj 147 340 GLdefine GL_KEEP;
> #X obj 148 319 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
> -1;
> #X floatatom 196 236 5 0 0 0 - - -;
> #X obj 188 191 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
> -1;
> #X obj 188 212 GLdefine GL_NEVER;
> #X msg 161 269 1;
> #X obj 54 230 GEMglEnable;
> #X floatatom 137 184 5 0 0 0 - - -;
> #X obj 126 140 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
> -1;
> #X obj 126 163 GLdefine GL_STENCIL_TEST;
> #X obj 316 189 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
> -1;
> #X obj 316 212 GLdefine GL_ALWAYS;
> #X obj 732 155 gemhead 31;
> #X obj 732 131 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
> 1;
> #X obj 732 281 GEMglClear;
> #X obj 797 240 GLdefine GL_STENCIL_BUFFER_BIT;
> #X obj 797 219 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
> -1;
> #X floatatom 806 262 5 0 0 0 - - -;
> #X obj 822 217 loadbang;
> #X obj 188 132 loadbang;
> #X obj 54 454 square 3;
> #X obj 54 428 color 1 0 0;
> #X text 219 282 enable the stencil buffer;
> #X obj 520 95 gemwin;
> #X msg 520 47 create \, 1;
> #X msg 528 72 0 \, destroy;
> #X obj 732 191 GEMglClearStencil 0;
> #X text 220 303 the red square should not be seen \, unless setting
> the StencilFunc to "GL_ALWAYS". This work as expected.;
> #X obj 454 473 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
> 1;
> #X obj 454 543 GEMglStencilMask;
> #X msg 561 520 1;
> #X obj 454 643 GEMglStencilFunc;
> #X msg 561 618 1;
> #X floatatom 503 609 5 0 0 0 - - -;
> #X obj 489 563 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
> -1;
> #X obj 489 586 GLdefine GL_ALWAYS;
> #X obj 582 406 loadbang;
> #X obj 454 744 square 1;
> #X obj 454 497 gemhead 32;
> #X msg 453 450 0;
> #X text 459 766 to draw in the stencil buffer. this does not work because
> the buffer is full of 1;
> #X obj 454 722 GEMglStencilOp;
> #X floatatom 594 715 5 0 0 0 - - -;
> #X obj 548 667 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
> -1;
> #X obj 547 688 GLdefine GL_REPLACE;
> #X text 732 307 to clear the stencil buffer. this should make the stencil
> test always be inactive. did not work...;
> #X connect 0 0 12 0;
> #X connect 1 0 27 0;
> #X connect 2 0 0 0;
> #X connect 3 0 1 0;
> #X connect 4 0 3 0;
> #X connect 6 0 5 0;
> #X connect 6 0 3 1;
> #X connect 6 0 3 2;
> #X connect 6 0 3 3;
> #X connect 7 0 6 0;
> #X connect 9 0 10 0;
> #X connect 10 0 8 0;
> #X connect 10 0 4 1;
> #X connect 11 0 4 3;
> #X connect 11 0 4 2;
> #X connect 12 0 4 0;
> #X connect 14 0 15 0;
> #X connect 15 0 13 0;
> #X connect 15 0 12 1;
> #X connect 16 0 17 0;
> #X connect 17 0 4 1;
> #X connect 18 0 32 0;
> #X connect 19 0 18 0;
> #X connect 21 0 20 1;
> #X connect 21 0 23 0;
> #X connect 22 0 21 0;
> #X connect 24 0 21 0;
> #X connect 25 0 10 0;
> #X connect 25 0 15 0;
> #X connect 25 0 6 0;
> #X connect 25 0 11 0;
> #X connect 27 0 26 0;
> #X connect 30 0 29 0;
> #X connect 31 0 29 0;
> #X connect 32 0 20 0;
> #X connect 34 0 44 0;
> #X connect 35 0 37 0;
> #X connect 36 0 35 1;
> #X connect 37 0 47 0;
> #X connect 38 0 37 3;
> #X connect 38 0 37 2;
> #X connect 40 0 41 0;
> #X connect 41 0 39 0;
> #X connect 41 0 37 1;
> #X connect 42 0 36 0;
> #X connect 42 0 41 0;
> #X connect 42 0 38 0;
> #X connect 42 0 45 0;
> #X connect 44 0 35 0;
> #X connect 45 0 34 0;
> #X connect 47 0 43 0;
> #X connect 49 0 50 0;
> #X connect 50 0 48 0;
> #X connect 50 0 47 1;
> #X connect 50 0 47 2;
> #X connect 50 0 47 3;
> 




More information about the GEM-dev mailing list