mirror of
https://github.com/guezoloic/LearnOpenGL.git
synced 2026-03-28 18:03:44 +00:00
27 lines
731 B
C++
Executable File
27 lines
731 B
C++
Executable File
#include "vao.hpp"
|
|
|
|
VAO::VAO() { glGenVertexArrays(1, &id); }
|
|
|
|
VAO::~VAO() { glDeleteVertexArrays(1, &id); }
|
|
|
|
void VAO::bind() { glBindVertexArray(id); }
|
|
|
|
void VAO::unbind() { glBindVertexArray(0); }
|
|
|
|
void VAO::setAttributePointer(GLuint index, GLuint size, GLenum type,
|
|
GLsizei stride, const void* offset)
|
|
{
|
|
glEnableVertexAttribArray(index);
|
|
glVertexAttribPointer(index, size, type, GL_FALSE, stride, offset);
|
|
}
|
|
|
|
void VAO::drawElement(GLenum mode, GLsizei count, GLenum type,
|
|
const void* indices)
|
|
{
|
|
glDrawElements(mode, count, type, indices);
|
|
}
|
|
|
|
void VAO::drawArray(GLenum mode, GLint first, GLsizei count)
|
|
{
|
|
glDrawArrays(mode, first, count);
|
|
} |