[MDX] Resize window to correct.
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. =/
Wow, what luck.
I poked around some, and found out where the mistake was. In my constructor I said...
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.
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;
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.
I am not 100% sure what might be causing this, but the previous mentioned items might cause that.
I hope this helps.
Take care.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement