Creating OpenGL 4.3 window fails with GLFW3
|
I set up a minimal application to open a blank window with GLFW3: #include #include #include
void glfwErrorCallback(int error, const { std::cerr << "GLFW error " << error << ": " << description << std::endl; }
int main(int argc, char **argv) { GLFWwindow* window; glfwSetErrorCallback(glfwErrorCallback);
if(!glfwInit()) { std::cerr << "Failed to initialize GLFW...\n"; return -1; }
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
window = glfwCreateWindow(1024, 768, "GLFW window", NULL, NULL); if(!window) { std::cerr << "Failed to open GLFW window...\n"; glfwTerminate(); return -1; }
glewExperimental = GL_TRUE; if (glewInit()) { std::cerr << "Failed to initialize GLEW...\n"; glfwTerminate(); return -1; }
glfwMakeContextCurrent(window);
while (glfwGetKey(window, GLFW_KEY_ESCAPE) != GLFW_PRESS && !glfwWindowShouldClose(window)) { glfwSwapBuffers(window); glfwPollEvents(); }
glfwTerminate(); return } It results in the following error: GLFW error 65540: Context profiles only exist for OpenGL version 3.2 and above The application is run on Linux with Bumblebee's optirun. The code works when using freeglut instead of GLFW. What is wrong with the code that results in the error? |
[解决方法]
This is pretty simple:
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); // Major = 4
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // Major was 4, now it is 3.
// Minor = ??? [Something < 2]
You need to use glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 3); instead for the second hint.
答案来源于: http://stackoverflow.com/questions/21395249/creating-opengl-4-3-window-fails-with-glfw3
我的机器是OpenGL4.2, 运行sb7code, 用这个方法也解决了。

Creating OpenGL 4.3 window fails with GLFW3的更多相关文章
- CSharpGL(31)[译]OpenGL渲染管道那些事
CSharpGL(31)[译]OpenGL渲染管道那些事 +BIT祝威+悄悄在此留下版了个权的信息说: 开始 自认为对OpenGL的掌握到了一个小瓶颈,现在回头细细地捋一遍OpenGL渲染管道应当是一 ...
- OpenGL 学习笔记 01 环境配置
以下教程仅适用于Mac下的Xcode编程环境!其他的我也不会搞. 推荐教程:opengl-tutorial 本项目Github网址 OpenGL太可怕了...必需得把学的记下来,不然绝壁 ...
- openGL learning
1,basic env in linux : cmake_minimum_required(VERSION 2.8) project(CP_01) set(GLFW_HOME /home/gearsl ...
- OpenGL.Tutorial03_Matrices_测试
1. 2. // ZC: 工程-->右键-->属性--> 配置属性: // ZC: C/C++ -->常规-->附加包含目录,里面添加: // ZC: E:\OpenGL ...
- OpenGL ES之GLFW窗口搭建
概述 本章节主要总结如何使用GLFW来创建Opengl窗口.主要包括如下内容: OpenGl窗口创建介绍 GLFW Window版编译介绍 GLFW简单工程源码介绍 OpenGL窗口创建介绍 能用于O ...
- OpenGL学习--03--矩阵
Model--View--Projection 1.tutorial03.cpp // Include standard headers #include <stdio.h> #inclu ...
- some OpenGL constants
some OpenGL constants This is from (https://github.com/peterderivaz/pyopengles/blob/master/gl2.py) G ...
- 利用JNI技术在Android中调用C++形式的OpenGL ES 2.0函数
1. 打开Eclipse,File-->New-->Project…-->Android-->AndroidApplication Projec ...
- 如何在C++ Builder中使用OpenGL
作者:太乙散数 摘要:用一个简单的例子,阐述了bcb中使用opengl的简单方法,包括初始化框架.旋转和平移图形.清除图像.初始化背景色以及在刷新时保持图像. 关键词:bcb6 opengl 旋转 清 ...
随机推荐
- 通过webbrowser控件获取验证码
1.首先介绍下基本控件(拖控件大家都会,我就不一一介绍了),看下图: 2.添加MSHTML引用,步骤如下: 解决方案—右键“引用”—添加引用—在.NET下找到Microsoft.mshtml组件—点 ...
- kaleidoscope-llvm
http://kaleidoscope-llvm-tutorial-zh-cn.readthedocs.io/zh_CN/latest/chapter-1.html
- Ubuntu使用安装或者卸载软件!!!
安装软件: 1.在应用商店里面下载安装 2.在终端sudo apt-get install 软件名 3.使用ppa:加入一个ppa源:sudo add-apt-repository ppa:user/ ...
- WiX: uninstall older version of the application
I have installer generated by WiX and I want it to ask: "You have already installed this app. D ...
- ASP.NET MVC中MaxLength特性设置无效
在ASP.NET MVC项目中,给某个Model打上了MaxLength特性如下: public class SomeClass { [MaxLength(16, ErrorMessage = &qu ...
- iOS 32位、 64位系统兼容性设置-Xcode创建支持IOS4.3以上版本的应用的方法
方法一: 如果是Xcode 5的话步骤为 点击项目名称->Build Settings->搜索 Architectures 这个里面的原始的值是Standard architectures ...
- WordPress主题开发:更换后台编辑器
这里我更换为KindEditor 1.下载插件 https://wordpress.org/plugins/kindeditor-for-wordpress/ 2.解压至wordpress目录下的/w ...
- ASP.NET MVC:三个被隐藏的扩展性“钻石”(转载)
原文地址:http://haacked.com/archive/2010/05/16/three-hidden-extensibility-gems-in-asp-net-4.aspx/. ASP.N ...
- Linux网络之设备接口层:发送数据包流程dev_queue_xmit
转自:http://blog.csdn.net/wdscq1234/article/details/51926808 写在前面 本文主要是分析kernel-3.8的源代码,主要集中在Network的n ...
- mysql 查询时间戳(TIMESTAMP)转成常用可读时间格式
from_unixtime()是MySQL里的时间函数 date为需要处理的参数(该参数是Unix 时间戳),可以是字段名,也可以直接是Unix 时间戳字符串 后面的 '%Y%m%d' 主要是将返回值 ...