我试图在XCode 5中创建一个openGL项目,以便我可以在我的Mac上学习NeHe tutes。
我一直在关注www.open.gl的步骤 以下是我试过的步骤......
-framework openGL
编译器标志添加到主文件中。我在这里缺少什么?
#include "main.h"
#include <glfw3.h>
#include <thread>
int main()
{
glfwInit();
// std::this_thread::sleep_for(std::chrono::seconds(3));
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL", nullptr, nullptr); // Windowed
// GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL", glfwGetPrimaryMonitor(), nullptr); // Fullscreen
glfwMakeContextCurrent(window);
while(!glfwWindowShouldClose(window))
{
glfwSwapBuffers(window);
glfwPollEvents();
}
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
glfwTerminate();
}
答案 0 :(得分:0)
我不确定问题是什么,但本教程简单(使用cmake)并且现在正在使用:
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/
本教程说&#34; Mac OS不支持OpenGL 3.3。最近使用MacOS 10.7 Lion和兼容GPU的Mac可以运行OpenGL 3.2,但不能运行3.3&#34;所以这可能是我的问题。