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 3 of 3

Thread: stencil.c : eerie behavior ?

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2004
    Posts
    14

    stencil.c : eerie behavior ?

    I took the stencil.c example and I made a little modification.

    http://www.opengl.org/resources/code...book/stencil.c

    I made this change in the display function :

    void display(void)
    {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    /* draw blue sphere where the stencil is 1 */
    glStencilFunc (GL_EQUAL, 0x1, 0x1);
    glStencilOp (GL_KEEP, GL_ZERO, GL_ZERO);
    glCallList (BLUEMAT);
    glutSolidSphere (0.5, 15, 15);

    /* draw the tori where the stencil is not 1 */
    glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
    glStencilFunc (GL_NOTEQUAL, 0x1, 0x1);
    glPushMatrix();
    glRotatef (45.0, 0.0, 0.0, 1.0);
    glRotatef (45.0, 0.0, 1.0, 0.0);
    glCallList (YELLOWMAT);
    glutSolidTorus (0.275, 0.85, 15, 15);
    glPushMatrix();
    glRotatef (90.0, 1.0, 0.0, 0.0);
    glutSolidTorus (0.275, 0.85, 15, 15);
    glPopMatrix();
    glPopMatrix();
    }

    Resize the window a few times and you will notice a very eerie behavior. Anyone can explain why ?

  2. #2
    Intern Newbie
    Join Date
    Feb 2005
    Location
    South Africa
    Posts
    46

    Re: stencil.c : eerie behavior ?

    By eerie do you mean messy?

    I compiled stencil.c with and without your changes, for me it runs messy both ways...
    I doubt those changes have much to do with it after all you never changed anything in the resize function so I don't why it should mess up if you resize the window.

    I would guess it's just a buggy graphics driver.
    After all in my case .. I use Linux and a Nvidia card - NVidia Linux drivers are _always_ buggy
    (even though I've had no problems.. yet)

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2004
    Posts
    14

    Re: stencil.c : eerie behavior ?

    True. I also have the problem with the original example

    So I guess that it is not the stencil buffer that causes the problem

Posting Permissions

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