Created
March 18, 2010 01:20
-
-
Save ryanwilliams/335941 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
glEnable(GL_SCISSOR_TEST); | |
// Some region to clip to | |
CGRect rect = CGRect(100, 100, 200, 200); | |
CGRect frame = [[[CCDirector sharedDirector] openGLView] frame]; | |
// Adjust for position | |
CGPoint worldPos = [self convertToWorldSpaceAR:position_]; | |
rect.origin.x = frame.size.height - worldPos.x - rect.origin.x - rect.size.width; | |
rect.origin.y += worldPos.y; | |
CGPoint origin = [[CCDirector sharedDirector] convertToGL:rect.origin]; | |
glScissor(origin.x, origin.y, rect.size.height, rect.size.width); | |
glDisable(GL_SCISSOR_TEST); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment