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启动系统之后自动生成一个独立的全窗口,方便来回 ...
随机推荐
- es6对象内函数的两种写法
es6对象内函数一般有两种写法: var person1 = { name: "p1", sayThis() { console.log(this); } }; var perso ...
- 开发rsync启动脚本2
使用函数更加规范的开发rsync启动脚本 #!/bin/bash #chkconfig: #description: create by vincen . /etc/init.d/functions ...
- spring boot项目遇到 'lower_case_table_names' 的解决办法
今天自己搭建了spring boot项目,配置的是mysql数据库,启动时报如下错误 Mon Jan 22 23:31:40 CST 2018 WARN: Establishing SSL conne ...
- HIVE- 数据倾斜
数据倾斜就是由于数据分布不均匀,数据大量集中到一点上,造成数据热点.大多数情况下,分为一下三种情况: 1.map端执行比较快,reduce执行很慢,因为partition造成的数据倾斜. 2.某些re ...
- JavaScript中call、apply个人理解
JavaScript中call.apply个人理解 一句话即通俗的说:call.apply 是为了改变this的状态而存在的 }; } function personInfo(name,age){ t ...
- PHP继承中$this的问题
在父类中的构造函数中使用$this , 这是$this指的是正在实例化的子类对象,不管是parent还是继承调用父类的构造函数. 如: class CompanyController extends ...
- SQLite connection strings
Basic Data Source=c:\mydb.db;Version=3; Version 2 is not supported by this class library. SQLite In- ...
- python-socket1
如何理解socket编程 就是两个进程,跨计算机,他俩需要通讯的话,需要通过网络对接起来.这就是 socket 的作用.打个比方吧,两个进程在两个计算机上,需要有一个进程做被动方,叫做服务器.另一个做 ...
- Oracle--存储过程和自定义函数
一.相关概念 1.存储过程和存储函数 ~指存储在数据库中供所有用户程序调用的子程序 ~存储过程和存储函数的相同点:完成特定功能的程序 ~存储过程和存储函数区别:是否用return语句返回值 2.创建和 ...
- 数学建模--matlab基础知识
虽然python也能做数据分析,不过参加数学建模,咱还是用专业的 1. Matlab-入门篇:Hello world! 程序员入门第一式: disp(‘hello world!’) 2. 基本运算 先 ...