Jump to content
  • Advertisement
Sign in to follow this  
farooqazam

Crop the text within a region

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

Problem i have is that i want to "cut" or "crop" the text within a region. Font.DrawText(...) method seems to ask for the rectangle region. But if text falls off the region, it still shows it. The requirement is that the portion of text that goes in -ve x or y coordinates of the rectangluar region should not be displayed. I have used a method, in which i sort of pre-write the text in a RenderToSurface object, picks the texture from that surface, and then draw that texture using conventional vertexbuffer. It works perfectly well, except it gives some horizontal flashes (distortion) in ONLY my client's machine (having Radeon X600) with Intel HT processor. Basically this is a ticker text that scrolls from one region of screen to the other. A directShow movie is running at the background, so having different thread.

Share this post


Link to post
Share on other sites
Advertisement
You can also use scissor tests :

RECT rect = { left, top, right, bottom }; // replace left, top, etc. by ints
pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, true);
pd3dDevice->SetScissorRect(&rect);


Their might be some cases where you don't want to modify your viewport to crop something (This happened to me, I asked the question here, and someone suggested scissors ... I only use that now ^^)

Share this post


Link to post
Share on other sites
Yes i tried this one too.. and seems to have further improved it. Not sure why it should make such difference, but viewport use to give some occasional flickering at the edges of the clip plane. Later method resolved it...

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!