opengl win32程序建立
最近开始学习opengl。opengl win32下有很多框架可以用,它们的基本原理大至是对win32窗口程序的封装,和opengl初始化的一些封装。看了下,最终选定glfw。
第一个程序如下:
#include <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(480, 320, "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(w

本文介绍了如何使用glfw库在Win32环境下建立一个简单的OpenGL程序,展示了初始化glfw、创建窗口、设置OpenGL上下文、绘制三角形及处理窗口事件的基本步骤。
最低0.47元/天 解锁文章
3598

被折叠的 条评论
为什么被折叠?



