Jump to content
  • Advertisement
Sign in to follow this  
AnthonyB

Clipping

This topic is 2997 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!