Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Stencil buffer problem

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    13

    Question Stencil buffer problem

    Dear all,

    I am trying to use the stencil buffer for the first time,
    and my test is not really succesfull so far...

    Here is the code I've been added in my "init" function. I am working in Java with JOGL, but I don't think that this is the issue.
    After this code, I would expect that nothing can be drawn on my screen..., since:
    1) I clear the buffer with "1"
    2) I use the glStencilFunc with GL_NEVER.

    Code :
    [SIZE=2] gl.glEnable(GL2[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GL_STENCIL_TEST[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
    [SIZE=2]
    gl.[U]glClearStencil[/U](0x1);
     
    gl.glClear(GL2.
    [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GL_STENCIL_BUFFER_BIT[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);	    [/SIZE]
    [SIZE=2]
    gl.glStencilFunc(GL2.
    [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GL_NEVER[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], 0x1, 0x1);	    [/SIZE]
    [SIZE=2]
    gl.glStencilOp(GL2.
    [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GL_KEEP[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], GL2.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GL_KEEP[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], GL2.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GL_KEEP[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]


    Unfortunately, I can change whatever I want to the stencil function,
    I always have all my objects being displaied on screen.
    What am I missing ?

    Thanks for help,
    Loic

  2. #2
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    13
    never mind,
    it seems that the problem is due to the fact that I can not create a canvas with simultaniously the Stencil buffer and the Stereo (Quard) Buffers
    If I disable the Stereo flag, it works fine

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •