Click here to Skip to main content
15,884,993 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I started lerning opengl a week ago. I am not using glut. I use the "NeHe" opengl tutorials. Those were written in 2000 so they're quite old. The first chapter teaches to initialize an opengl window. I copied the entire code and proceeded to the next chapter. But the problem is that when i switch the opengl window to fulscreen then the resolution of the window is very low. So how do i change it cuz resolution of my pc is 13600x768.
i know my pc can offer more clearer display in the fullscreen mode.

What I have tried:

I tried getting help from google but found nothing.
Posted
Updated 6-Apr-16 17:14pm
v2
Comments
Sergey Alexandrovich Kryukov 6-Apr-16 12:54pm    
You don't change screen settings in applications, unless you want to screw up everything and betray you user. And this is not what should really be called "resolution", this is screen size in pixel, a different thing. Don't ever touch it.
—SA
leon de boer 6-Apr-16 22:57pm    
That is totally wrong he is using a FULL SCREEN APP he can choose any resolution he chooses that the monitor/adapter supports. I will deal with him in how to control it.
Sergey Alexandrovich Kryukov 6-Apr-16 23:31pm    
Full screen application does not mean the only application (unlike, say, kiosk), in a way, it's no different from any other. It should not screw up other applications. Anyway, the user knows better what to use. Application should adopt itself to any screen size.

And again, this is not what's called "resolution".

—SA
leon de boer 6-Apr-16 23:44pm    
You obviously have never played with OpenGL ... FULL SCREEN can change the screen resolution it is called "resolution" and why you are blatantly wrong and I am taking you to task over your answer.

The HeNe tutorials set 640 x 480 and 16 colour mode OF THE ENTIRE SCREEN by this line and the whole windows desktop goes bye bye .. no more desktop. There is no desktop and no normal windows resolution at this point.

CreateGLWindow("NeHe's Solid Object Tutorial",640,480,16,fullscreen))

Most people don't run windows in 640x480 mode but when you run the app it swings the screen to 640x480 and the resolution is 640x480 I assure you that is the resolution.

If you don't have familiarity with OpenGL in fullscreen mode before commenting probably play with the NeHe examples which do indeed set the whole screen to 640x480 resolution

I just built lesson5 from Nehe if you want to try it tell me what resolution it takes your screen to in fullscreen mode .. here is the link
http://s000.tinyupload.com/?file_id=00368581431374272263

You should see then what we are saying and why your answer is so badly wrong.

I play world of warcraft and I use this full screen mode opengl on the client always because in windowed opengl mode the performance hit is to great. It's a common interface mode for high end graphics games and graphical applications.

1 solution

In most of the NeHe examples there will be this sort of block
C#
if (!CreateGLWindow("NeHe's Solid Object Tutorial",640,480,16,fullscreen))

See the width and height values there you can directly set them to 1360 and 768 and a colour depth

There is however a more elegant way to do it which is using the Win32 API call GetSystemMetrics and the depth from the Win32 API call GetDeviceCaps which grabs the current settings from the windows system

Change the above block to
C#
if (!CreateGLWindow("NeHe's Solid Object Tutorial", GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), GetDeviceCaps(GetWindowDC(GetDesktopWindow()), BITSPIXEL), fullscreen))


GetSystemMetrics(SM_CXSCREEN) => is system screen width in pixels
GetSystemMetrics(SM_CXSCREEN) => is system screen height in pixels
GetDeviceCaps(GetWindowDC(GetDesktopWindow()), BITSPIXEL) => Current desktop colour depth

I compiled lesson5 from the NeHe site with VS2013 and VS2015 and really only had one issue which was GlAux library which is problematic these days. Fortunately it wasn't used so I commented out the include and removed the library from the linker settings.

Update: I added unicode support (it annoyed me) and made the above fixes to lesson5 on VS2013 and have put the code and project up on this link if you need.
http://s000.tinyupload.com/?file_id=24009314904103970104
 
Share this answer
 
v6
Comments
Ratul Thakur 7-Apr-16 9:27am    
Thanks a lot mate!!!!!
Now i'll be able to add a drop down menu from which the user can choose a suitaible screen resolution.
leon de boer 7-Apr-16 20:58pm    
Yes that is what most games do :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900