mac 下 用 glfw3 搭建opengl开发环境

mac 下 用 glfw3 搭建opengl开发环境

  1. 下载编译 glfw3
  2. Build Setting 里面,
    1. Library Search Paths -> 设置好编译 glfw 库的路径
    2. Header Search Paths -> 添加 glfw 头文件路径
    3. other link flag 添加 -> -lglfw3
    4. glfw 需要依赖 Cocoa CoreVideo IOKit OpenGL 这4个framework.
  3. 测试
    直接参考 glfw doc
  4. 打印硬件信息:
    cout << "硬件信息为:" << endl;
    cout << "OpenGL Vendor:" << glGetString(GL_VENDOR) << endl;
    cout << "OpenGL Renderer: " << glGetString(GL_RENDERER) << endl;
    cout << "OpenGL Version: " << glGetString(GL_VERSION) << endl;
    cout << "GLSL Version:" << glGetString(GL_SHADING_LANGUAGE_VERSION) << endl;
    cout << "------------------------------------------------------" << endl;
  1. 解决retinal屏显示:
    GLint viewPort[4];
    glGetIntegerv(GL_VIEWPORT, viewPort);
    glViewport(viewPort[0], viewPort[1], viewPort[2], viewPort[3]);

转载于:https://www.cnblogs.com/daihanlong/p/5651076.html

你可能感兴趣的:(mac 下 用 glfw3 搭建opengl开发环境)