Sign in to follow this  

[MDX] Resize window to correct.

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

My code doesn't capture the resize, or lost device, or anything of that sort just yet. Yet still, it has this behaviour. When it first loads up, it draws this (blurred, incorrect). When I resize the window even the slightest bit, it suddenly corrects it. Any ideas? Cause I'm lost. =/

Share this post


Link to post
Share on other sites
Wow, what luck.

I poked around some, and found out where the mistake was. In my constructor I said...

MyPresentation.BackBufferWidth = this.Width;
MyPresentation.BackBufferHeight = this.Height;


However, the width and height returned by the WindowsForms is the size of the window+frame, not just the drawable component. And the reason why resizing the window worked was because DirectX hooked onto the form anyways, and would have captured the correct size the first time, had I have not specified it.

In short.. I removed those two lines above and it drew correct. [smile]

Edit: The code below would also have worked.
MyPresentation.BackBufferWidth = this.ClientSize.Width;
MyPresentation.BackBufferHeight = this.ClientSize.Height;

Share this post


Link to post
Share on other sites
It might be due to the fact that when you are creating your device that you are setting a backbuffer width and height as 800x600. Now when you are shrinking/resizing your window you are compressing the window thus resulting in a higher resolution. This might also be coupled to the projection transformation matrix which takes your aspect ratio and width and height of your window.

I am not 100% sure what might be causing this, but the previous mentioned items might cause that.

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites

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