Jump to content

  • Log In with Google      Sign In   
  • Create Account

Viewports


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 EngineProgrammer   Members   -  Reputation: 295

Like
0Likes
Like

Posted 07 December 2012 - 04:26 AM

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

  SetMapMode(hDC, MM_ANISOTROPIC);
  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.

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS