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@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;
cyrille henry wrote:
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};
oops, i forgot: i have already committed these changes (yesterday, or the day before) to the cvs...(and also for w32)
mfg.ads.r IOhannes
hello, i made this change prior to your modification, but i've got a crappy connection here, and I spend 2 day to send this mail...
i'll make a cvs update as soon as i can.
any idea to clear the buffer??? thanks
Cyrille
IOhannes m zmoelnig a écrit :
cyrille henry wrote:
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};
oops, i forgot: i have already committed these changes (yesterday, or the day before) to the cvs...(and also for w32)
mfg.ads.r IOhannes
cyrille henry wrote:
hello, i made this change prior to your modification, but i've got a crappy connection here, and I spend 2 day to send this mail...
i'll make a cvs update as soon as i can.
well, don't bother (as long as your connection is so crappy) since the changes are really almost the same.
any idea to clear the buffer???
i have to read the red book first :-)
mfg.asdr. IOhannes
On Mar 7, 2006, at 7:55 AM, cyrille henry wrote:
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?
...hmm, doesn't work here, either :-( I'm not really familiar with stencil buffer operations, so I guess it's time to hit the red book; unfortunately I'm really busy atm with other things, so this goes on the "to-do" list...
jamie
james tittle a écrit :
On Mar 7, 2006, at 7:55 AM, cyrille henry wrote:
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?
...hmm, doesn't work here, either :-( I'm not really familiar with stencil buffer operations, so I guess it's time to hit the red book;
i'm not familar either, and i already read the red book...
unfortunately I'm really busy atm with other things, so this goes on the "to-do" list...
ok.
thanks anyway.
cyrille
jamie
GEM-dev mailing list GEM-dev@iem.at http://lists.puredata.info/listinfo/gem-dev
cyrille henry wrote:
james tittle a écrit :
On Mar 7, 2006, at 7:55 AM, cyrille henry wrote:
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.
btw, i have committed a change some time ago which i believe to enable the stencil buffer (at least on linux); could you try again?
mfg.adsr IOhannaes
hello,
i made a mistake in my previus post caused by the Z buffer. in fact, the stencil buffer does not look active now.
anyway, i cant find your change in the sources. and in the curent cvs, i don't see in gemWinCreateXwin.cpp the creation of the stencil buffer.
attachement is my test patch
cyrille
IOhannes m zmölnig a écrit :
cyrille henry wrote:
james tittle a écrit :
On Mar 7, 2006, at 7:55 AM, cyrille henry wrote:
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.
btw, i have committed a change some time ago which i believe to enable the stencil buffer (at least on linux); could you try again?
mfg.adsr IOhannaes
GEM-dev mailing list GEM-dev@iem.at http://lists.puredata.info/listinfo/gem-dev
#N canvas 405 92 741 639 10; #X obj 64 50 gemhead 44; #X obj 64 495 translateXYZ 0 0 -1; #X obj 64 28 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 ; #X obj 64 470 GEMglStencilOp; #X obj 64 380 GEMglStencilFunc; #X floatatom 172 470 5 0 0 0 - - -; #X obj 157 436 GLdefine GL_KEEP; #X obj 165 415 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X floatatom 211 289 5 0 0 0 - - -; #X obj 203 244 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 203 265 GLdefine GL_NEVER; #X msg 171 354 1; #X obj 331 242 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 331 265 GLdefine GL_ALWAYS; #X obj 157 218 loadbang; #X obj 64 546 square 3; #X obj 64 520 color 1 0 0; #X text 197 126 enable the stencil buffer; #X msg 451 51 create , 1; #X msg 459 76 0 , destroy; #X obj 64 124 GEMglEnable; #X floatatom 147 124 5 0 0 0 - - -; #X obj 136 80 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 136 103 GLdefine GL_STENCIL_TEST; #X obj 167 74 loadbang; #X obj 64 203 translateXYZ; #X floatatom 90 182 5 0 0 0 - - -; #X floatatom 129 182 5 0 0 0 - - -; #X floatatom 168 182 5 0 0 0 - - -; #X floatatom 342 294 5 0 0 0 - - -; #X obj 451 99 gemwin; #X text 230 327 the red square should not be seen , unless setting the StencilFunc to "GL_ALWAYS".; #X connect 0 0 20 0; #X connect 1 0 16 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 13 0; #X connect 13 0 4 1; #X connect 13 0 29 0; #X connect 14 0 10 0; #X connect 14 0 6 0; #X connect 14 0 11 0; #X connect 16 0 15 0; #X connect 18 0 30 0; #X connect 19 0 30 0; #X connect 20 0 25 0; #X connect 22 0 23 0; #X connect 23 0 21 0; #X connect 23 0 20 1; #X connect 24 0 23 0; #X connect 25 0 4 0; #X connect 26 0 25 1; #X connect 27 0 25 2; #X connect 28 0 25 3;
cyrille henry wrote:
hello,
i made a mistake in my previus post caused by the Z buffer. in fact, the stencil buffer does not look active now.
how is this patch supposed to work? i can turn on/off the red square by clicking on the GL_ALWAYS (on) resp. GL_NEVER (off); i guess this is how it is supposed to work?
anyway, i cant find your change in the sources. and in the curent cvs, i don't see in gemWinCreateXwin.cpp the creation of the stencil buffer.
hmm, there are no more changes in GemWinCreateXWin.cpp (apart from adding GLX_STENCIL_SIZE to the glx-hints; but you already have this)
there was 2 tiny change to GemMan.cpp (setting the clear-mask) which where added in revision 1.49 (i just saw that the anonymous cvs-browser on sourceforge is still at 1.47; i submitted rev1.49 on april 11th...)
basically it is just adding GL_STENCIL_BUFFER_BIT to the m_clear_mask-flags in GemMan.cpp:70 and adding a line glClear(GL_STENCIL_BUFFER_BIT & m_clear_mask); around GemMan.cpp:862
mfg.adr. IOhannes