Jump to content
  • Advertisement


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


OpenGL resolution settings?

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

How can I make OpenGL run with certain resolution settings? If I need to get them from windows settings how can I temporarily change them to a certain setting? I think I''ve sorta made myself clear... Thanks Uni

Share this post

Link to post
Share on other sites
You''re probably looking for glViewport() if you want to get OpenGL to run with a specific resolution. You can change it if you want (for render to texture or whatever). You should probably have the window dimensions left over from when you created the window. Hope that helps.

Share this post

Link to post
Share on other sites
Actually, the solution to this suprised me, since I was initally working with Direct3D, which has separate initialisation for full-screen mode.

In OpenGL, you just make a popup-style window (i.e. with no borders) and place it in the top-left corner of the screen (0,0).

Then you have to change the windows desktop resolution to fit the window:

// Example for 640x480x32 mode

DEVMODE dmScreenSettings;

dmScreenSettings.dmPelsWidth = 640;
dmScreenSettings.dmPelsHeight = 480;
dmScreenSettings.dmBitsPerPel = 32;

ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);

CDS_FULLSCREEN is to hide the status bar at the bottom

And when you want to get out of full-screen mode, just do:

ChangeDisplaySettings(NULL, 0);

After Direct3D, this is soooooo much easier eh


Share this post

Link to post
Share on other sites
Summit is still up...when I increase the resolution i.e. make


higher values isn't the image (in this case a triangle) meant to decrease in size due to more pixels being on screen? Mine ain't it just stays the same size.

here's the code if it helps:

RECT windowRect;

int width = 800;
int height = 600;
int bits = 32;

windowRect.left=(long)0; // Set Left Value To 0
windowRect.right=(long)width; // Set Right Value To Requested Width
windowRect.top=(long)0; // Set Top Value To 0
windowRect.bottom=(long)height; // Set Bottom Value To Requested Height

if(fsval == true)
DEVMODE dmScreenSettings; // device mode
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = width; // screen width
dmScreenSettings.dmPelsHeight = height; // screen height
dmScreenSettings.dmBitsPerPel = bits; // bits per pixel

I think that is the code that is needed.


[edited by - Unimatrix_001 on June 5, 2002 6:22:34 PM]

Share this post

Link to post
Share on other sites
The triangle should appear to be the same size. Images are placed on the screen as fractions of the screen width. Higher resolution just gives more detail.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!