Clipping

Started by
1 comment, last by AnthonyB 13 years, 9 months ago
Is it possible to do clipping on polygons within your viewport, rather than manually changing the vertex positions yourself to accomplish the same appearance? I'm not entirely sure if I'm using the right terms to make this clear, but I can clarify if needed.

For example, if you're doing something like an editbox and you don't want the text (drawn with multiple rectangles, of course) to be drawn outside of the editbox rectangle's boundaries.
Advertisement
There are multiple ways to get what you want
- You can set a new Viewport (SetViewport) to limit the render area to your box
- You can use a scissor rectangle (SetScissorRect)
- You can use clip planes to cut anything outside your box (SetClipPlane).

If you are unsig DX10 or newer the functions are RSSetViewports and RSSetScissorRects. Clip planes work somewhat different as you need to include them in the vertex shader code.

As it sounds like you want to use it for the UI I recommend using of Scissor Rects. Keep in mind that you need to enable the rects. Calling the set function would not be enough.
Apparently I didn't look as thoroughly for a solution as I thought. I'll check into those options and see if they're suitable. Thanks.

Edit: Wow, I feel retarded. I have no idea how I missed any of these. I guess I just assumed past researching was complete when it obviously wasn't.

This topic is closed to new replies.

Advertisement