Jump to content
  • Advertisement
Sign in to follow this  


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

When looking at 3D projections and transformations I was thinking on 3Dsmax, which has multiple viewports. So I've tried to get my own viewport with logical units -1 to 1.

Now I wonder if I'm using a modern way of setting up a viewport. I have found these functions on msdn but I have no idea if these are still used nowadays.

hDC = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &client);

SetViewportOrgEx(hDC, client.right/2, client.bottom/2, 0);
SetViewportExtEx(hDC, client.right, client.bottom, 0);
SetWindowOrgEx(hDC, 0, 0 ,0);
SetWindowExtEx(hDC, 2, 2, 0);

Rectangle(hDC, 0, 0, 1, 1);
EndPaint(hWnd, &ps);

This code sets up my window to 2 logical units, from -1 to 1. So like DirectX uses his viewport.
And I've changed the viewport extends so when I scale the window, the objects in the window are scaled also.

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!