[Solved] Using glScissor

I was reading about [icode]glScissor[/icode], but I couldn’t figure out how to use it. This is what I have but it doesn’t trim anything.


glPushMatrix();
renderable.render();
glEnable(GL_SCISSOR_TEST);
glScissor(Math.round(panel.x + sx), Math.round(panel.y + sy), Math.round(panel.width), Math.round(panel.height));
glDisable(GL_SCISSOR_TEST);
glPopMatrix();

Hope someone can help me :slight_smile:

CopyableCougar4

You didn’t draw anything…

The scissor test clips drawing while it’s enabled.

Cas :slight_smile:

I shifted the rendering to after glScissor and it doesn’t show anything? Do I have to flip the Y value for glScissor?

CopyableCougar4

So I adjusted for OpenGL’s y values and I think I got it working :slight_smile:

Code:


glPushMatrix();
glEnable(GL_SCISSOR_TEST);
glScissor(Math.round(panel.x + sx), (Launcher.getHeight() - Math.round(panel.y + sy)) - Math.round(panel.height), Math.round(panel.width), Math.round(panel.height));
renderable.render();
glDisable(GL_SCISSOR_TEST);
glPopMatrix();