OpenGL 2D clip
Hey guys, long time no post.
I've been doing a game in 2D using ogl for some time. I am kinda new to opengl but i manage. I am kinda stuck though when trying to make some kind of clipping to the thngs i am drawing.
I have an image of a television. When i turn it on on my game, i want it to render the game inside the television (so basically, i want a the scene to be rendered only on this rectangular region, and any part of the scene outside this television will not be drawn). I could fake this by separating the tv into layers, one at the front (frame) then back, and then draw the scene in between. Thing is, i dont want to do this. Is it possible to set like a clip or something similar in open gl?
Thanks in advance!
why yes, in fact. It's built in:
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html
That basically restricts drawing to a certain area of the screen. What you should probably do is draw the outside of the TV, but not the interior portion (like, draw 4 quads that surround the middle). Then draw the inside with the scissor box active.
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html
That basically restricts drawing to a certain area of the screen. What you should probably do is draw the outside of the TV, but not the interior portion (like, draw 4 quads that surround the middle). Then draw the inside with the scissor box active.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement