Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct vertex_t
- {
- float x;
- float y;
- float z;
- };
- GLuint VBO = 0;
- void initVBO()
- {
- vertex_t vertices[] =
- {
- { -0.5f, 0.5f, 0.0f },
- { 0.5f, 0.5f, 0.0f },
- { 0.5f, -0.5f, 0.0f },
- { -0.5f, -0.5f, 0.0f }
- };
- glGenBuffers(1, &VBO);
- glBindBuffer(GL_ARRAY_BUFFER, VBO);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
- }
- void draw()
- {
- glEnableClientState(GL_VERTEX_ARRAY);
- glBindBuffer(GL_ARRAY_BUFFER, VBO);
- glVertexPointer(3, GL_FLOAT, sizeof(vertex_t), NULL);
- glDrawArrays(GL_QUADS, 0, 4);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement