首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >osx上的glfwOpenWindow失败

osx上的glfwOpenWindow失败
EN

Stack Overflow用户
提问于 2015-05-22 22:37:32
回答 1查看 152关注 0票数 0

我正试图在上构建和运行以下项目来玩射线行进和着色:

https://github.com/lightbits/ray-march/blob/master/raymarch-dev.md

我不太熟悉OS或openGL上的编译。

错误:

我要编译这个项目,但是glfwOpenWindow失败了,

代码语言:javascript
复制
glfwOpenWindow(
width, height,
8, 8, 8, 0,
24, 8,
false ) 

我没有收到任何错误信息,也不知道为什么失败。我认为问题来自于我为构建代码库所做的工作。

我所做的:

外部包括:

代码语言:javascript
复制
#include <glload/gl_3_1_comp.h> // OpenGL version 3.1, compatability profile
#include <glload/gll.hpp>   // The C-style loading interface
#include <GL/glfw.h>    // Context
#include <glm/glm.hpp>  // OpenGL mathematics
#include <glm/gtc/type_ptr.hpp> // for value_ptr(matrix)
#include <string>
  • 我安装了自制的
  • 我安装了cmake
  • 我建立了GLFW-遗产
  • 我安装了glm。
  • 我在"opengl.h“中替换了 #include <glload/gl_3_1_comp.h> // OpenGL version 3.1, compatability profile #include <glload/gll.hpp> // The C-style loading interface

带着,

代码语言:javascript
复制
`#include <OpenGL/gl3.h>`
  • 我删除了,在"opengl.cpp“中。 if(glload::LoadFunctions() == glload::LS_LOAD_FAILED) return false;
  • 我当前的编译命令是: g++ main.cpp fileio.cpp opengl.cpp -I /usr/local/include/GL/ -L /usr/local/lib/ -framework OpenGL -lGLFW
EN

回答 1

Stack Overflow用户

发布于 2015-05-22 23:26:17

从链接的代码中,我们有opengl.cpp

代码语言:javascript
复制
glfwOpenWindowHint(GLFW_OPENGL_PROFILE,         0); // 0 lets the system choose the profile
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR,   OPENGL_VERSION_MAJOR);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR,   OPENGL_VERSION_MINOR);
glfwOpenWindowHint(GLFW_FSAA_SAMPLES,           fsaa);
glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE,       GL_TRUE);

头文件一起

代码语言:javascript
复制
const int OPENGL_VERSION_MAJOR = 3;
const int OPENGL_VERSION_MINOR = 1; 

因此,这是请求OSX上不支持的OpenGL 3.1上下文_which?onlz支持GL2.1以下的legacz上下文,或从GL3.2开始的GL核心配置文件上下文。当然,GLFW将无法创建GL上下文。

我还没有检查剩下的代码,但是您可能需要一个GL3.2核心配置文件。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30406849

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档