Jump to content
  • Advertisement
Sign in to follow this  
oliver_mpt

text clipping in DX9

This topic is 3066 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, I'm printing text using ID3DXFont interface in DirectX 9, the text is moved around in the window, but must be clipped within a given window. I successfully use SetScissorRect(&rc) with the clipping boundaries in the rc rectangle for the geometry (triangles, quads, ...) but it does not work with the ID3DXFont objects. Any idea ?

Share this post


Link to post
Share on other sites
Advertisement
You can check the limits of the rectangle used to draw the text against the window rectangle.

RECT rect;
// set up and check rect here
font->DrawText(..., &rect, ...); // don't use DT_NOCLIP in the flags

Share this post


Link to post
Share on other sites
Hi,

Thanks for the answer, however it works partly : it works perfectly well for ordinary text. Now I also use rotated text, and in that case I can only clip the text along its own axis (length and height).
For example, if I rotate a text by 45° and move it to a place where it has to be clipped along a horizontal line, that won't do it.

Anyone has an idea of why the scissor are desactivated with sprites or ID3DXFont objects ?

Share this post


Link to post
Share on other sites
Quote:
Original post by oliver_mpt
Anyone has an idea of why the scissor are desactivated with sprites or ID3DXFont objects ?
Because you don't usually want the scissor enabled when rendering sprites. If you do, just turn it on after calling ID3DXSprite::Begin().

Share this post


Link to post
Share on other sites
Wonderful !

Thanks Steve. I just tried to move the scissor command after the sprite Begin, and it works perfectly !

regards

Oliver

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!