I am currently attempting to create a window-style system in OpenGL and am having trouble masking the portions of the windows I am creating.
Basically, I don't want a window to be able to draw anything outside of its rectangle (specified by an x, y, width and height). I figured the best way to accomplish this would be to mask the section that I am drawing so only things within the masked region are visible.
I found this tutorial online:
http://nehe.gamedev..../masking/15006/
It goes over the basics of masking (blending) and how it works, but appears to be used more as a blending method than a masking ont. I have (at this point) been unable to get it working with simply removing anything outside of a box.
The code I am using is, at this point, fairly similar to that provided by the tutorial (I can post it later, it is on a different machine), but it appears to do an additive blending between the colors which isn't what I am going for.
I figure that this is probably an easy problem to get around if you know what you are doing, but I haven't figured it out as of yet. So any thoughts would be appreciated.
OpenGL masking
Page 1 of 14 Replies - 544 Views - Last Post: 13 August 2012 - 01:08 AM
Replies To: OpenGL masking
#2
Re: OpenGL masking
Posted 09 August 2012 - 01:15 AM
Have you thought about using the stencil buffer? It will probably work for what you want to do.
#3
Re: OpenGL masking
Posted 10 August 2012 - 06:21 AM
Okay, thanks. It figures that there would be a different name for it in OpenGL than what the rest of the graphics world uses. I'll look into that.
#4
Re: OpenGL masking
Posted 12 August 2012 - 04:47 PM
Update: It took quite a while to find an example that actually appeared to work, but I finally found one with a nice explanation:
http://en.wikibooks..../Stencil_buffer
It went through and cut my framerate in half for only stenciling three "windows" per frame, but it works nicely and has the desired effect.
http://en.wikibooks..../Stencil_buffer
It went through and cut my framerate in half for only stenciling three "windows" per frame, but it works nicely and has the desired effect.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|