BlockGame/gl/VertexArray.cpp
2022-02-05 21:44:31 +01:00

27 lines
561 B
C++

//
// Created by lukas on 04.02.22.
//
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include "VertexArray.h"
void VertexArray::Bind() const {
glBindVertexArray(handle);
}
VertexArray::VertexArray(const VertexBuffer& buff) {
buff.Bind();
// generate new vertex array object
glGenVertexArrays(1, &handle);
Bind();
// specify syntax of my data
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void *) nullptr);
glEnableVertexAttribArray(0);
}
unsigned VertexArray::getHandle() const {
return handle;
}