【发布时间】:2016-07-29 02:31:05
【问题描述】:
我试图通过OpenGL API 为这个application 类编译这个程序:
#include "sb7.h"
using namespace sb7;
class my_application : public application
{
public:
void startup()
{
render_program = compile_shaders();
glCreateVertexArrays(1, &vertex_array_object); // <--
glBindVertexArray(vertex_array_object);
}
void shutdown()
{
glDeleteProgram(render_program);
glDeleteVertexArrays(1, &vertex_array_object);
glDeleteProgram(render_program);
}
void render(double currentTime)
{
const GLfloat color[] = { 0.0f, 2.0f, 0.0f, 1.0f };
glClearBufferfv(GL_COLOR, 0, color);
glUseProgram(render_program);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
private:
GLuint render_program;
GLuint vertex_array_object;
};
DECLARE_MAIN(my_application);
说startup()函数中这行代码有问题:
void startup()
{
render_program = compile_shaders();
glCreateVertexArrays(1, &vertex_array_object); // <--
glBindVertexArray(vertex_array_object);
}
我尝试过使用glGenVertexArrays,但还是没有编译成功。
【问题讨论】: