Sign in to follow this  

[solved] Clipping

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

Hi, I've been playing with the CDXUTDialogs given in the DirectX SDK. I've added the possibility to resize a dialog, for example. And now, I would like to clip all the control of a dialog so that when I size down a dialog, its control get cropped to the dialogs' borders. At first, I tried using a viewport set to the position / size of the dialog. It worked pretty well, but at times, some sprites get completely strechted / distorted :/ I don't really understand what's going on. It mainly cause problems with the ID3DXFont::DrawText method. So, using a viewport might not be a good thing to achieve my goal. I tried to use a custom clip plane, but I don't get any result. Maybe it doesn't works with ID3DXSprite's :/ Do you know of a method to clip sprites and font correctly ? Thx in advance ^^ [Edited by - paic on March 1, 2006 10:04:02 AM]

Share this post


Link to post
Share on other sites
Have you considered using a stencil buffer?

Wipe the buffer to 0, then render an (invisible) quad the size of your container/dialog and set it to increment the stencil value. Then render your real display with an appropriate stencil reference/function - you should be able to get per-pixel clipping [smile]

hth
Jack

Share this post


Link to post
Share on other sites
Yep, thx for the answer. But I'll use that only as a last resort, it's a bit too complex for my purpose ^^

Anyway, I did partially solved my problem : my planes were not set correctly. So now, the ID3DXSprite / ID3DXFont are clipped correctly.

But I also added another control which doesn't use the sprite interface. And it uses transformed vertices (D3DFVF_XYZRHW) and it seems that clipping doesn't affect those (at least those controls aren't clipped)

Am i right in thinking that transformed vertices are not clipped by custom clipping plane ? (I still didn't find anything about it in my docs ... must be too tired -_-)

Thx again.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Check out the d3d Scissor rectangle. That feature costs nothing in speed and will do exactly what you want.

Share this post


Link to post
Share on other sites

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