OpenGL 使用GLFW创建全屏窗口
OpenGL 使用GLFW创建全屏窗口
GLFW库里面的glfwCreateWindow()函数是用来创建窗口的函数。
这样函数的原型是:
GLFWwindow* glfwCreateWindow(int width, int height, const char * title, GLFWmonitor * monitor, GLFWwindow * share);
介绍glfwCreateWindow()函数的使用方法
程序
bool isFullScreen = true;
GLFWmonitor* pMonitor = isFullScreen ? glfwGetPrimaryMonitor() : NULL;
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "Holographic projection", pMonitor, NULL);
//GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "Holographic projection", nullptr, nullptr);
// Define the viewport dimensions
//glViewport(0, 0, WIDTH, HEIGHT);
glViewport(0, 0, Screen_Width, Screen_Height);
OpenGL GLFW 指定屏幕 全屏显示
程序
bool isFullScreen = true;
int monitorCount;
//GLFWmonitor* pMonitor = isFullScreen ? glfwGetPrimaryMonitor() : NULL;
GLFWmonitor** pMonitor = isFullScreen ? glfwGetMonitors(&monitorCount) : NULL;
std::cout << "Screen number is " << monitorCount << std::endl;
//GLFWmonitor** pM = pMonitor;
int holographic_screen = -1;
for(int i=0; i<monitorCount; i++){
int screen_x, screen_y;
const GLFWvidmode * mode = glfwGetVideoMode(pMonitor[i]);
screen_x = mode->width;
screen_y = mode->height;
std::cout << "Screen size is X = " << screen_x << ", Y = " << screen_y << std::endl;
if(screen_x==1920 && screen_y==1080){
holographic_screen = i;
}
}
std::cout << holographic_screen << std::endl;
GLFWwindow* window = glfwCreateWindow(screenWidth, screenWidth, "Holographic projection", pMonitor[holographic_screen], NULL);
// Define the viewport dimensions
//glViewport(0, 0, WIDTH, HEIGHT);
glViewport(0, 0, Screen_Width, Screen_Height);
参考网站:
http://wiki.jikexueyuan.com/project/modern-opengl-tutorial/tutorial44.html
http://www.glfw.org/docs/latest/group__monitor.html
http://gamedev.stackexchange.com/questions/60244/how-to-find-monitor-resolution-with-glfw3
http://geistyp.weebly.com/tech-life/080-glfw
OpenGL 使用GLFW创建全屏窗口的更多相关文章
- 《fullPage.js》创建全屏滚动的网站
插件介绍 fullPage.js是一个简单易用的插件,创建全屏滚动的网站(也被称为单页网站).它允许全屏滚动创建网站,以及添加内部滑块. 浏览器兼容性 主要功能 支持鼠标滚动 支持前进后退和键盘控制 ...
- win32之全屏窗口
游戏开发中经常使用会让游戏以全屏窗口的状态运行,下面一个例子就是来实现这个效果的. #include <windows.h> void RegisterMyClass(); LRESULT ...
- Directx11教程(12) 禁止alt+enter全屏窗口
原文:Directx11教程(12) 禁止alt+enter全屏窗口 在D3D11应用程序中,我们按下alt+enter键,会切换到全屏模式.有时候,我们在WM_SIZE中有一些代码,全 ...
- UI: 窗口全屏, 窗口尺寸
窗口全屏 窗口尺寸 示例1.窗口全屏UI/FullScreen.xaml <Page x:Class="Windows10.UI.FullScreen" xmlns=&quo ...
- 背水一战 Windows 10 (3) - UI: 窗口全屏, 窗口尺寸
[源码下载] 背水一战 Windows 10 (3) - UI: 窗口全屏, 窗口尺寸 作者:webabcd 介绍背水一战 Windows 10 之 UI 窗口全屏 窗口尺寸 示例1.窗口全屏UI/F ...
- OSG addEventHandler W键显示网格 L键控制光照 F键切换全屏窗口 S键显示统计数据 事件处理器
#include <osgGA/StateSetManipulator> #include <osgViewer/ViewerEventHandlers> // add the ...
- OSG 初始化为非全屏窗口
OSG默认的窗口时全屏的,调试的时候不方便. 在网上看到一段代码,可以非全屏显示 int _tmain(int argc, _TCHAR* argv[]){ osgViewer::Viewer vie ...
- window.open 打开全屏窗口
window.open新打开页面为全屏状态,各个浏览器情况不一致. window.open 弹出新窗口的命令: 'page.html' 弹出窗口的文件名: 'newwindow ...
- Mac的Parallels在启动Win的时候让它独立全屏窗口
这里备忘一下,由于经常需要***,Win方法比较多少,所以使用Parallels在Win下***还是很有必要的,为了使用使用方便,一般让Parallels启动系统之后自动生成一个独立的全窗口,方便来回 ...
随机推荐
- python字符串格式和编码与解码问题
%c 转换成字符(ASCII码值,长度为一的字符串) %r 有线使用repr()函数进行字符串转换 %s 有线使用str()函数进行字符串转换 %d or %i 转换成有符号十进制数 %u 转换成无符 ...
- 323 id与小数据池
a = 1000b = 1000print(a == b)== 比较的是数值is 比较的是内存地址.print(a is b)查看内存地址id()print(id(a))print(id(b)) 小数 ...
- python3 函数 二
1.函数嵌套 1.1函数嵌套定义 :在一个函数的内部,又定义另外一个函数. def f1(): x=1 def f2(): print('from f2') f ...
- [转]Tomcat启动分析
[转]Tomcat启动分析 原帖 http://docs.huihoo.com/apache/tomcat/heavyz/01-startup.html 以下摘录了部分 --------------- ...
- jQuery绿色下拉网站导航
jQuery,下拉菜单,网站导航,绿色导航,菜单导航,jQuery绿色下拉网站导航是一款基于jquery实现的鼠标滑过下拉显示二级菜单. jquery特效代码:http://www.huiyi8.co ...
- Codeforces 455B A Lot of Games:博弈dp【多局游戏】
题目链接:http://codeforces.com/problemset/problem/455/B 题意: 给你n个字符串,然后进行k局游戏. 每局游戏开始有一个空串,然后双方轮流给这个串的末尾添 ...
- httpRequest.CookieContainer= cookie 与 httpRequest.Headers.Add("Cookie", cookie)
这两天做了一个获取cookie并且携带此cookie去请求另外一个url地址,中间携带cookie用了两种方式:1. httpRequest.CookieContainer= cookie (此coo ...
- 文件复制的另一种选择,使用FileChannel复制文件
通常来说,FileChannel比普通的缓冲输入输出流有更高的效率 import java.io.File; import java.io.FileInputStream; import ja ...
- 代码题(14)— 合并有序链表、数组、合并K个排序链表
1.21. 合并两个有序链表 将两个有序链表合并为一个新的有序链表并返回.新链表是通过拼接给定的两个链表的所有节点组成的. 示例: 输入:1->2->4, 1->3->4 输出 ...
- 继续学习C:运算符
" / " 两整数相除,结果为整数,有一方是实数形式,结果保留小数 " % " 求余运算符要求两侧均为整型数据, 数值取余,符号与被除数一 ...