-1

I've been trying to generate reflection with a stencil buffer for a school project. I was following this tutorial: http://www.opengl.org/archives/resources/code/samples/mjktips/Reflect.html It describes how to create a reflection by reflecting the scene over a plane and draw it again to create the reflection, then clipping the reflection to get rid of the parts sticking out.
I followed the tutorial but nothing is clipping, the reflection is shown in full. I tried the following:

int i;
glGetIntegerv(GL_STENCIL_BITS,&i);
std::cout << "Stencil bits is " << i << std::endl;

And the output is "Stencil bits is 0". So I do not have a stencil buffer at all. How do you create a stencil buffer in Gtkmm ( I read that creating a stencil buffer is library specific )?

  • can you post your code plz – j-p Mar 23 '14 at 03:16
  • 1
    when you initalize your opengl context, you set bitplanes count. so if you could post your opengl context creation code, i could help... – j-p Mar 23 '14 at 03:28

1 Answers1

0

After reading j-p's response, I realized I had been looking in the wrong place. I was given some starter code in the project, so I overlooked the setting up of glContext. What I needed to do was:

glconfig = Gdk::GL::Config::create(Gdk::GL::MODE_RGB |
                                 Gdk::GL::MODE_DEPTH |
                                 Gdk::GL::MODE_DOUBLE |
                                 Gdk::GL::MODE_STENCIL );

Added the Gdk::GL::MODE_STENCIL flag to enable stencil mode in Gtk. Notice this is very library specific.