我已完成以下视频 https://www.youtube.com/watch?v=shpdt6hCsT4 但是,我的hello world窗口如下所示:http: //s1303.photobucket.com/user/eskimo___/media/screenshot_124_zps890ae561.jpg .html 我出错的任何想法?我使用osx yosemite和最新的GLFW欢呼声
按照要求:
我的项目文件夹由3个文件组成,这些文件是使用终端进程的一部分:
我使用自制软件在我的mac上设置了glfw3库.
Main.cpp是在图片窗口中产生不良效果的,它由网站GLFW文档部分的示例代码组成:
include <GLFW/glfw3.h>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
插入glClear(GL_COLOR_BUFFER_BIT)之前glfwSwapBuffers- 它基本上是从未初始化的'framebuffer'内存更新的,GL实现可能已经将其用于其他目的,例如在Quartz合成器中支持存储,纹理等.
把它想象成一个电话malloc; 内存不需要初始化或归零.
| 归档时间: |
|
| 查看次数: |
2051 次 |
| 最近记录: |