Sign in to follow this  

clipping rectangle

This topic is 2855 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

Hello ! During the drawing of a frame, I want to restrict (clip) the drawing within a rectangle, and then later resume drawing in the whole viewport. What is the most efficient way of doing that ? regards Oliver

Share this post


Link to post
Share on other sites
It would be simpler, if you can swap the order of the renders, to draw the whole viewport. Then set projection/view/viewport for the rectangle, dev->Clear(...) to overwrite the rectangle, and render what you want in the rectangle. Might be a little inefficient for large rectangles, of course, as you're overwriting a portion.

That's assuming your rectangle doesn't stretch from top to bottom, or side to side. If it does, then setup for left-side, draw, setup for right-side, draw.

Share this post


Link to post
Share on other sites
Thanks for the hint, buckeye, but I'm not sure I get the point.
In my case it's just like I have some moving objects outside a window in a house, I draw them at their updated positions, then I draw the window and the house inside, and I don't want the objects outside which are not in front of the window to be visible.
Is there a way that I can draw the external objects, but clipping at the window size, then drawing the inside of the house around the window after.

Can I change the projection matrix during rendering ? (beetwen the BeginScene()/EndScene() calls ?)

Share this post


Link to post
Share on other sites
Quote:
Can I change the projection matrix during rendering ? (beetwen the BeginScene()/EndScene() calls ?)

You can. I do that to render a rearview mirror in a car.

I may be misunderstanding, but you want to render the scene from inside the house, with a window somewhere?

If so, can't you just make the window panes "empty" (i.e., not draw anything solid)? Any objects outside will be rendered appropriately. Draw the inside view first, so the outside objects will be culled more quickly.

You're using a depth-buffer, correct?

Share this post


Link to post
Share on other sites

This topic is 2855 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this