Sign in to follow this  

Size Window Application

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

Hi. I use DirectX 9. The window is create with the function "CreateWindowEx" with width equal to height (equal to 900). The monitor has resolution 1280x1024. The question is: the virtual sphere is not a sphere because is a bit flattened. The 3D object has to be the original object and deformate (in this case flattened in height). How can I do ? I've to increase the height of the window or set the resolution as square in pixel. Or it dependes by the height of the pixel of the screen. Or is another the problem ? Thanks for all.

Share this post


Link to post
Share on other sites
It seems that you might have an incorrect projection matrix setup. You might have a problem where you are taking the screen width / screen height, but your window is a perfect square.

Make sure that you are using your window width and height to calculate your aspect ratio

I hope this helps.

Share this post


Link to post
Share on other sites
Though unrelated, remember, if you want a window to be 900x900, you need to call AdjustWindowRectEx() to get the actual size passed in to CreateWindowEx.


Problem is probably in your projection matrix.

Share this post


Link to post
Share on other sites
Quote:
Original post by marius1930
Though unrelated, remember, if you want a window to be 900x900, you need to call AdjustWindowRectEx() to get the actual size passed in to CreateWindowEx.


So, I've to use the function CreateWindowEx before and, only after, call AdjustWindowRectEx. Is right now ?

For the projection matrix, the aspect ratio of the the projection matrix has to be the same ratio between height and width used in CreateWindowEx. Is correct ?

Share this post


Link to post
Share on other sites
Quote:
Original post by Claudio
For the projection matrix, the aspect ratio of the the projection matrix has to be the same ratio between height and width used in CreateWindowEx. Is correct ?

No, the aspect ratio must match the size of the viewport, which is not necessarily the same as the size of the window. As marius1930 said, you need to adjust the parameters to CreateWindow such that the client area is the desired size.

The size you pass to CreateWindow is the size of the window. Making room for border and title bar, the client are you use for your viewport will be smaller and will not have the same aspect ratio as the window. If you want a client area of 900x900, you need to use AdjustWindowRect to adjust the window size so the client are have the desired size, and then create the window using the adjusted size.

Share this post


Link to post
Share on other sites
Quote:
Original post by Brother Bob

If you want a client area of 900x900, you need to use AdjustWindowRect to adjust the window size so the client are have the desired size, and then create the window using the adjusted size.


The code is:


RECT lprSizeClientWindow;
lprSizeClientWindow.left = 110;
lprSizeClientWindow.top = 50;
lprSizeClientWindow.right = lprSizeClientWindow.left + 900;
lprSizeClientWindow.bottom = lprSizeClientWindow.top + 900;
bool res = AdjustWindowRectEx(&lprSizeClientWindow, WS_OVERLAPPEDWINDOW, FALSE, WS_EX_OVERLAPPEDWINDOW);
HWND hWindow = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
__TEXT("FX App Window Class"),
__TEXT("Title"),
WS_OVERLAPPEDWINDOW,
lprSizeClientWindow.left, lprSizeClientWindow.top, // Position of the window: horizzontal and vertical position
lprSizeClientWindow.right-lprSizeClientWindow.left, lprSizeClientWindow.bottom-lprSizeClientWindow.top, // width and height of the window
NULL,
NULL,
NULL,
NULL);




While the viewport aspect ratio is: 900/900.

Is correct so ?

The windows has also the menu but the desired size (without menu) is 900x900.

But there is the problem also now.

[Edited by - Claudio on June 15, 2009 5:58:59 AM]

Share this post


Link to post
Share on other sites

This topic is 3108 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.

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