Results 1 to 2 of 2

Thread: Stencil buffer usage

  1. #1

    Stencil buffer usage

    I am trying to learn the usage of stencil buffer. I try to create reflection of an object on a floor.
    But while i introduce the blue block the reflected object is not rendered.

    With no blue block I see a solid object, floor and the object which is supposed to be the reflection of the first object appears partly hidden behind the floor!!

    Below is the code. Please help me.
    .....

    glEnable(GL_STENCIL_TEST);
    glColorMask(0, 0, 0, 0);
    glDisable(GL_DEPTH_TEST);
    glStencilFunc(GL_ALWAYS, 1, 1);
    glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
    draw_floor();

    glColorMask(1, 1, 1, 1);
    glEnable(GL_DEPTH_TEST);

    glStencilFunc(GL_EQUAL, 1, 1);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);


    .....

  2. #2

    Re: Stencil buffer usage

    I could solve the problem !!

    I was viewing from a wrong angle so i could not see the reflected image.

    Thank you.

Similar Threads

  1. FBO with Stencil Buffer
    By JayFoxRox in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 0
    Last Post: 03-27-2009, 12:39 PM

Posting Permissions

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