View Full Version : Scissor query
09-12-2009, 09:35 PM
Stupid noob question time..
How do I rotate a set up a scissor (or the equivalent thereof) that is rotated by a certain number of degrees, i.e. I can have a diamond shaped window with whatever gets written inside it cut off by the boundary of the diamond.
I've hunted everywhere, through the Red book & online and seem to find an answer - the problem is, I'm not sure if scissor is what I'm really after.
09-13-2009, 07:23 AM
Take a look at clipping planes. Those may be what you're looking for.
Here's the man page (http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clipplane.html).
09-13-2009, 02:03 PM
Scissor test rectangle can't be rotated, instead you can use the stencil test to mask drawing to any shape.
There should be plenty of example code around, but basic code for using the stencil buffer for masking is:
// Enable stencil test
// Clear stencil buffer
// Disable drawing to color buffer + depth buffer
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
// Draw masking object, setting stencil = 1 wherever it draws
glStencilFunc(GL_ALWAYS, 0x1, 0x1);
glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
***draw masking object***
// Re-enable drawing to color buffer + depth buffer
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
// Draw rest of objects, only where stencil = 1
glStencilFunc(GL_EQUAL, 0x1, 0x1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
***draw rest of objects***
// Disable stencil test
09-14-2009, 05:47 AM
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.