OpenGL 使用GLFW创建全屏窗口
2016-07-10 06:31
369 查看
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
相关文章推荐
- 应用程序无法正常启动提示错误0xc000007b 问题的原因和解决方法
- INSTALL NGINX, PHP AND MYSQL ON OS X
- [OpenGL]基于AABB包围盒的漫游时视点与场景的碰撞检测
- 从0到千万级访问量网站架构演变史
- Linux shell 中的数组和关联数组
- 虚拟机下CentOS 6.5配置IP地址的三种方法
- Linux mint 下安装配置 LNMP
- Linux下MakeFile文件
- centOs安装jdk1.7
- 如何编写自己的Linux安全检查脚本?
- 进程间通信(IPC)之信号量
- 卸载Centos自带open-jdk
- linux批量去bom命令
- linux performance observability tools, 好形象啊
- CentOS 6.4 离线安装 Cloudera 5.7.1 CDH 5.7.1
- 用OpenCV实现Photoshop算法(一): 图像旋转
- linux chcon命令详解
- php使用escapeshellarg时中文被过滤的解决方法
- NginxWithPHP7
- OpenGLES入门笔记 :OpenGLES光照基础总结1