如何在全屏模式下更改opengl中的屏幕分辨率(无过剩) [英] How to change the screen resolution in opengl in fullscreen mode( without glut)

查看:304
本文介绍了如何在全屏模式下更改opengl中的屏幕分辨率(无过剩)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一周前开始学习opengl。我没有使用过剩。我使用NeHeopengl教程。那些写于2000年,所以他们已经很老了。第一章教导初始化opengl窗口。我复制了整个代码并继续下一章。但问题是,当我将opengl窗口切换到fulscreen时,窗口的分辨率非常低。所以我怎么改变它我的电脑的分辨率是13600x768。

i知道我的电脑可以在全屏模式下提供更清晰的显示。



我尝试了什么:



我尝试从谷歌获得帮助但却一无所获。

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.

推荐答案

在大多数NeHe示例中都会有这种块

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



查看宽度和高度值,你可以直接将它们设置为1360和768以及颜色深度



但是有更优雅的方法可以做它使用Win32 API调用GetSystemMetrics和Win32 API的深度调用GetDeviceCaps来获取当前设置windows系统



将上面的块更改为


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

if (!CreateGLWindow("NeHe's Solid Object Tutorial", GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), GetDeviceCaps(GetWindowDC(GetDesktopWindow()), BITSPIXEL), fullscreen))





GetSystemMetrics(SM_CXSCREEN)=>系统屏幕宽度(以像素为单位)

GetSystemMetrics(SM_CXSCREEN)=>系统屏幕高度(以像素为单位)

GetDeviceCaps(GetWindowDC(GetDesktopWindow()),BITSPIXEL)=>当前的桌面颜色深度



我使用VS2013和VS2015从NeHe站点编译了第5课,实际上只有一个问题是GlAux库,这些问题最近都存在问题。幸运的是它没有被使用所以我注释了包含并从链接器设置中删除了库。



更新:我添加了unicode支持(它让我生气)并制作以上修复了VS2013上的第5课,如果需要,已将代码和项目放在此链接上。

http://s000.tinyupload.com/?file_id=24009314904103970104



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


这篇关于如何在全屏模式下更改opengl中的屏幕分辨率(无过剩)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆