Archived

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

OpenGL resolution settings?

This topic is 5672 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;

memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = 640;
dmScreenSettings.dmPelsHeight = 480;
dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;

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

------------------------
CRAZY_DUSIK* pCrazyDuSiK = new CRAZY_DUSIK;
pCrazyDuSiK->EatMicroshaft(MS_MUNCH_BILL_GATES | MS_CHEW_BILL_GATES);

Share this post


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

dmScreenSettings.dmPelsWidth
dmScreenSettings.dmPelsHeight

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
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = width; // screen width
dmScreenSettings.dmPelsHeight = height; // screen height
dmScreenSettings.dmBitsPerPel = bits; // bits per pixel
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;


I think that is the code that is needed.

Uni

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

Share this post


Link to post
Share on other sites