Sign in to follow this  

Rendering a certain section

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
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);

// Render content

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

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

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.


Share this post

Link to post
Share on other sites

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