Sign in to follow this  
Lithic

[.net] Changing Resolution in .NET

Recommended Posts

You'll need to use the API and some DllImport work. You can read more about that here.

Frankly, though, you're better off using DirectX or OpenGL rather than doing it directly. In general, you shouldn't change the user's screen resolution without letting them know first. It's up to you to adapt to the user's environment, not force it to be the other way around.

Share this post


Link to post
Share on other sites
I'm using Tao OpenGL. Correct me if I'm wrong, but I am under the impression that glViewport sets the control's resolution rather than the screen resolution.

AKA with 1024x1280 screen resolution a call such as glViewport(0, 0, 1200, 1600) will still display at 1024x1280.

And therefore the only way to change the screen resolution would be through API stuff, right?

Share this post


Link to post
Share on other sites
Quote:
Original post by Lithic
I'm using Tao OpenGL. Correct me if I'm wrong, but I am under the impression that glViewport sets the control's resolution rather than the screen resolution.

AKA with 1024x1280 screen resolution a call such as glViewport(0, 0, 1200, 1600) will still display at 1024x1280.


glViewport() changes the resolution *inside* the control of the screen that is being rendered. For an easy way to change the fullscreen resolution, I suggest using glutFullscreen() function, which is included with Tao as well (under Tao.Glut, I believe).

Share this post


Link to post
Share on other sites
Quote:
Original post by kSquared
Frankly, though, you're better off using DirectX or OpenGL rather than doing it directly.

OpenGL can't change your video mode, you still use the Win32 API's ChangeDisplaySettings() to set the resolution when you use OpenGL.

Quote:
Original post by Lithic
I'm using Tao OpenGL. Correct me if I'm wrong, but I am under the impression that glViewport sets the control's resolution rather than the screen resolution.

AKA with 1024x1280 screen resolution a call such as glViewport(0, 0, 1200, 1600) will still display at 1024x1280.

And therefore the only way to change the screen resolution would be through API stuff, right?

No and yes :)

glViewport sets the area into which projections are performed by the GL (but it doesn't clip to that area, for details on the difference check out the specs at www.opengl.org). This doesn't adjust the control or window in any way (in fact, OpenGL can't modify anything Windows-specific), it just affects where on the control you do your rendering.

But like I said, you're right in that OpenGL can't change the display resolution. Since you're already using Tao.OpenGL then take a look at Tao.SDL. It handles changing resolution and creating a window, amongst a lot of other stuff.

Share this post


Link to post
Share on other sites

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