How do I run an OpenGL shader on just a portion of an off screen texture and leave the rest of the texture unmodified? Are there any calls that restrict the sampled pixels to just a rectangle or do I have to filter out the rectangle in the shader code?
Take the 2-minute tour
×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.
|
Yes, you can restrict rendering to just a rectangle by using either the viewport rect or the scissor rect. These can be set by the The distinction is that setting the viewport will pretend that the viewport is the entire render target. Any geometry you render will be scaled down to the viewport; the viewport will always extend from -1 to 1 in NDC (post-projective) coordinates. The scissor rect, on the other hand, doesn't rescale any geometry or alter any coordinates - it simply suppresses rendering to any pixels outside the rect. |
|||
|