2022-05-27 20:47:36 +00:00
|
|
|
#include "include/MyGraphicsEngine/VertexArray.h"
|
2022-05-04 21:25:18 +00:00
|
|
|
#include <glad/glad.h>
|
|
|
|
|
|
|
|
void VertexArray::Create(){
|
|
|
|
glGenVertexArrays(1, &id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VertexArray::Bind(){
|
|
|
|
glBindVertexArray(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VertexArray::Unbind(){
|
|
|
|
glBindVertexArray(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VertexArray::Delete() {
|
|
|
|
glDeleteVertexArrays(1, &id);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void VertexArray::AttachAttribute(unsigned int index , int size, int stride ){
|
|
|
|
glVertexAttribPointer(index, size, GL_FLOAT, GL_FALSE, stride, 0);
|
|
|
|
glEnableVertexAttribArray(0);
|
|
|
|
}
|
|
|
|
|