osx - how to build c++ openGL project in xcode? -
im trying create opengl project in xcode 5 can learn nehe tutes on mac.
ive been following steps @ www.open.gl
here steps tried sofar..
- i homebrewed glfw3, glew , glm
- i made new static c/c++ project.
- i made main file.
- i added opengl framework.
- added
-framework opengl
compiler flag main file. - i added paths brews user searchpaths , made search these.
- i included glfw in main file , tried run code open window.
- only glew files come in lib, project builds&runs nothing happens.
- no errors either.
what missing here?
#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(); }
im not sure problem tutorial made simple (using cmake) , working now: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/
tutorial says "mac os doesn’t support opengl 3.3. recent macs macos 10.7 lion , compatible gpus can run opengl 3.2, not 3.3" may have been problem.
Comments
Post a Comment