c_cpp play_open_gl.c
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp play_open_gl.c相关的知识,希望对你有一定的参考价值。
#define GLEW_STATIC
#define GLEW_NO_GLU
#include "GL/glew.h"
#include "GLFW/glfw3.h"
int main()
{
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL", NULL, NULL);
glfwMakeContextCurrent(window);
// Initialize GLEW
glewExperimental = GL_TRUE;
glewInit();
// create buffers here
while(!glfwWindowShouldClose(window))
{
// draw here
glfwSwapBuffers(window);
glfwPollEvents();
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
// remove buffers here
glfwTerminate();
return 0;
}
以上是关于c_cpp play_open_gl.c的主要内容,如果未能解决你的问题,请参考以下文章
c_cpp 200.岛屿数量
c_cpp 127.单词阶梯
c_cpp MOFSET
c_cpp MOFSET
c_cpp 31.下一个排列
c_cpp string→char *