• Advertisement

Archived

This topic is now archived and is closed to further replies.

Resizable Window without Scaling?

This topic is 5561 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'm working on a windowed application which uses DirectX to display graphics. In this case, I'm working with a MDI application with each ChildView having its own Direct3D and Direct3DDevice objects but this question should relate to any windowed DirectX application, I think. When I create me Direct3DDevice, I define it to have a width and height equal to the full size of the desktop screen. However, when it is displayed in my window, the device is scaled down to fit the window. Since the window is resizable, I don't want it to scale to the fit the window. I want it to display at a constant size with areas outside the window being clipped. How do I prevent the device from being scaled to fit the window? [edited by - Dov Sherman on December 4, 2002 10:06:28 AM]

Share this post


Link to post
Share on other sites
Advertisement
You could just move the camera around to undo the scaling that DirectX does. It shouldn't be too complicated to calculate the new camera location given the window size.

Note, However, that changing the window size without scaling would cause some amount of distortion to what's drawn. Just the same, moving the camera to correct would also cause some distortion. (I both cases, this is because the camera must move).

If you don't want any distortion, you must scale it then.

If you need the math for the camera movement, In could do it for you, but I think you should be able to do it yourself.

[edited by - sirob on December 4, 2002 11:19:32 AM]

Share this post


Link to post
Share on other sites
1: use one direct3d and direct3ddevice object for the entire application.

2: use createadditionalswapchain() for mdi windows, all under the same device.

3: create devices and swap chains with default backbuffer sizes, which will default to the sizes of whatever windows you''re referencing.

4: when your window is resized, reset the device and recreate swapchains.

you''re incurring a significant overhead by using full screen devices for each mdi window.

Share this post


Link to post
Share on other sites
I''m still very new to Direct3D so this whole swapchain idea is going way over my head. Could you elaborate please?

Share this post


Link to post
Share on other sites
http://www.mvps.org/directx/articles/rendering_to_multiple_windows.htm

Thats what got me up and running with additional swap chains Basically it lets you resize your window without stretching it, it just makes the view bigger :D Good stuff.

Share this post


Link to post
Share on other sites

  • Advertisement