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创建全屏窗口的更多相关文章

  1. 《fullPage.js》创建全屏滚动的网站

    插件介绍 fullPage.js是一个简单易用的插件,创建全屏滚动的网站(也被称为单页网站).它允许全屏滚动创建网站,以及添加内部滑块. 浏览器兼容性 主要功能 支持鼠标滚动 支持前进后退和键盘控制 ...

  2. win32之全屏窗口

    游戏开发中经常使用会让游戏以全屏窗口的状态运行,下面一个例子就是来实现这个效果的. #include <windows.h> void RegisterMyClass(); LRESULT ...

  3. Directx11教程(12) 禁止alt+enter全屏窗口

    原文:Directx11教程(12) 禁止alt+enter全屏窗口        在D3D11应用程序中,我们按下alt+enter键,会切换到全屏模式.有时候,我们在WM_SIZE中有一些代码,全 ...

  4. UI: 窗口全屏, 窗口尺寸

    窗口全屏 窗口尺寸 示例1.窗口全屏UI/FullScreen.xaml <Page x:Class="Windows10.UI.FullScreen" xmlns=&quo ...

  5. 背水一战 Windows 10 (3) - UI: 窗口全屏, 窗口尺寸

    [源码下载] 背水一战 Windows 10 (3) - UI: 窗口全屏, 窗口尺寸 作者:webabcd 介绍背水一战 Windows 10 之 UI 窗口全屏 窗口尺寸 示例1.窗口全屏UI/F ...

  6. OSG addEventHandler W键显示网格 L键控制光照 F键切换全屏窗口 S键显示统计数据 事件处理器

    #include <osgGA/StateSetManipulator> #include <osgViewer/ViewerEventHandlers> // add the ...

  7. OSG 初始化为非全屏窗口

    OSG默认的窗口时全屏的,调试的时候不方便. 在网上看到一段代码,可以非全屏显示 int _tmain(int argc, _TCHAR* argv[]){ osgViewer::Viewer vie ...

  8. window.open 打开全屏窗口

    window.open新打开页面为全屏状态,各个浏览器情况不一致. window.open   弹出新窗口的命令:     'page.html'   弹出窗口的文件名:     'newwindow ...

  9. Mac的Parallels在启动Win的时候让它独立全屏窗口

    这里备忘一下,由于经常需要***,Win方法比较多少,所以使用Parallels在Win下***还是很有必要的,为了使用使用方便,一般让Parallels启动系统之后自动生成一个独立的全窗口,方便来回 ...

随机推荐

  1. 【LeetCode】【动态规划】Generate Parentheses(括号匹配问题)

    描述 Given n pairs of parentheses, write a function to generate all combinations of well-formed parent ...

  2. Oracle数据库体系结构(2)数据库实例

    Oracle实例的概念: 实例(Instance):就是数据库管理系统,处于用户与物理数据库之间的一个中间层软件,由一系列内存结构和后台进程组成. 用户操作数据库的过程实质上与数据库实例建立连接,然后 ...

  3. c的详细学习(11)文件

    为了提高数据输入/输出的处理效率,可以将程序运行时所需要的原始数据从文件中读取,并将程序运行的结果写入到文件中.     (1)文件概述     1)基本概念 文件是指存储在外部介质上数据的集合,可以 ...

  4. hiho一下 第二十九周 最小生成树三·堆优化的Prim算法【14年寒假弄了好长时间没搞懂的prim优化:prim算法+堆优化 】

    题目1 : 最小生成树三·堆优化的Prim算法 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 回到两个星期之前,在成功的使用Kruscal算法解决了问题之后,小Ho产生 ...

  5. Linux课程---2、Linux下最常用命令(查看帮助命令)

    Linux课程---2.Linux下最常用命令(查看帮助命令) 一.总结 一句话总结: man 1.显示文件? ls:ls带其它参数详情可以man ls man ls:比如 ls -a显示隐藏文件,l ...

  6. php发邮件:swiftmailer, php邮件库——swiftmailer

    php发邮件:swiftmailer, php邮件库——swiftmailer 最近看到一个好的php邮件库,与phpmailer作用一样,但性能比phpmailer好,尤其是在处理附件的能力上,发送 ...

  7. 十八 Django框架,生成二维码

    用Python来生成二维码,需要qrcode模块,qrcode模块依赖Image 模块,所以首先安装这两个模块 生成二维码保存图片在本地 import qrcode img = qrcode.make ...

  8. 文本去重之MinHash算法——就是多个hash函数对items计算特征值,然后取最小的计算相似度

    来源:http://my.oschina.net/pathenon/blog/65210 1.概述     跟SimHash一样,MinHash也是LSH的一种,可以用来快速估算两个集合的相似度.Mi ...

  9. 【leetcode刷题笔记】Gas Station

    There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You ...

  10. uva1160 易爆物

    #include<iostream>#include<cstdio>#include<algorithm>#include<cstdlib>using ...