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启动系统之后自动生成一个独立的全窗口,方便来回 ...
随机推荐
- Effective java -- 7 通用程序设计
第四十五条:将局部变量的作用域最小化 第四十六条:加强版for循环优于传统for循环 第四十七条:了解和使用类库书中提到了一个生成随机数的例子.正好需要. public static void mai ...
- Effective java -- 6 方法
第三十八条:检查参数的有效性 第三十九条:必要时进行保护性拷贝 public class Period { private final Date start; private final Date e ...
- Delphi UniDAC 通过http协议连接数据库的设置
Connection through HTTP tunnel(using http protocol) Sometimes client machines are shielded by a fire ...
- 大话设计模式--代理模式 proxy
1. 代理模式: 为其他对象提供一种代理以控制这个对象的访问. 代理模式使用场合: a. 远程代理, 为一个对象在不同的地址空间提供局部代理,隐藏一个对象存在于不同地址空间的事实.如.net中WebS ...
- Spring的使用
Spring的组成 1. Core模块 该模块是Spring的核心容器,它实现了Ioc模式和Spring框架的基础功能. 2. Context模块 该模块继承BeanFactory类,并添加了事件处理 ...
- python循环切片
x = [0,99, 'a', 1, 2, 'b',5, 3, 0,'a' ,1, 8, 5,'b',5,9,5] b=[] c=[] d=[] for i in range(len(x)): if ...
- C# 多服务器上传 示例
图片服务器 带宽越来越不够用,还有当一台服务器的机房出问题的时候,不影响 整个web,以及 考虑网通电信访问服务器的 速度,所以考虑使用多台 图片 服务器 这个时候要求 图片服务器 内容是同步 的 ...
- php发邮件:swiftmailer, php邮件库——swiftmailer
php发邮件:swiftmailer, php邮件库——swiftmailer 最近看到一个好的php邮件库,与phpmailer作用一样,但性能比phpmailer好,尤其是在处理附件的能力上,发送 ...
- spring MVC--配置注解
<context-param> 作用:该元素用来声明应用范围(整个WEB项目)内的上下文初始化参数 param-name 设定上下文的参数名称.必须是唯一名称 param-value 设定 ...
- web网页打印的方法(浏览器通用)
Web打印组件jatoolsPrinter 应用web化,不论对开发商,还是对用户来说,实在是一种很经济的选择,因为基于 web的应用,客户端的规则很简单,容易学习,容易维护,容易发布.但对程序员来说 ...