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.

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 on other sites
I've never used the D3DXFont interface, but if the text gets displayed using pretransformed vertices you can use SetViewport to do 2d clipping easily.

Share on other sites
Thanks Endurion... it worked great. I was not aware ViewPorts concept...

Share on other sites
You can also use scissor tests :
RECT rect = { left, top, right, bottom };     // replace left, top, etc. by intspd3dDevice->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 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...

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 9
• 23
• 20
• 14
• 14
• Forum Statistics

• Total Topics
633383
• Total Posts
3011587
• Who's Online (See full list)

There are no registered users currently online

×