Jump to content
  • Advertisement
Sign in to follow this  
simotix

Rendering a certain section

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

I am making a window system (basically just creating different windows in direct x). I am at the part when I making a creating scroll bar for the data. Basically I have an area of say 800x800. If I only wanted to display the area of 200x200 to 600x600 (so basically an upper portion and a lower portion would not be displayed) how would I do this? I tried changing some of the view matrix variables for this but I have not found anything. Does anyone have a good idea?

Share this post


Link to post
Share on other sites
Advertisement
You may want to check the DirectX Docs for "scissor test", specifically the SetScissorRect function that allows you to "cut away" a region of the viewing area.

Share this post


Link to post
Share on other sites
Scissor test or SetViewport, depending on what you want

oooooo ???????? ????????
ooooool ???????? ????????
XXXXXXll ???XXX?? ??? oo??
XXXXXXll ???XXX?? ???xxl??
XXXXXXl ???XXX?? ???xx ??
XXXXXX ???????? ????????

Above is my crude ascii versions of regular, scissortest, or SetViewport.

Regular is a fullscreen 3D cube.

Scissor test limits drawing to a smaller rectangle.

SetViewport draws the full scene to a smaller rectangle, so the output is scaled.

Which method you use depends on how you want the windows to behave. Perhaps you want to support both. Also be aware the things drawn with RHW coordinates won't scale with a viewport.

Share this post


Link to post
Share on other sites
I have tried doing that but I think I may have implemented it wrong. I tried doing

RECT temp;
SetRect(&temp, m_nX, m_nY, 300, 300); // m_nX = 200, m_nY = 200
pD3D->GetDirect3DDevice()->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
pD3D->GetDirect3DDevice()->SetScissorRect(&temp);

// Render content

pD3D->GetDirect3DDevice()->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);

Below is a small image that shows what I am trying to do.

http://i266.photobucket.com/albums/ii256/simotix/RenderContent.jpg

I want to draw the entire screen but out of the red rectangle I only want to draw the green rectangle (as shown in image).

[Edited by - simotix on January 2, 2008 12:32:39 PM]

Share this post


Link to post
Share on other sites
Bit of a long-shot, but have you interrogated the device caps' RasterCaps for D3DPRASTERCAPS_SCISSORTEST? My information suggests it's supported by all Nvidia/ATI hardware but I have no details for Intel IGP's.

hth
Jack

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!