fix texture rendering

This commit is contained in:
2022-02-06 18:28:12 +01:00
parent 29fc4f67d4
commit 9df12e0fe1
9 changed files with 108 additions and 36 deletions

View File

@ -9,7 +9,7 @@
#include <GL/gl.h>
Texture::Texture() {
mTexturehandle = bmploader().loadBMP("../block.bmp");
mTexturehandle = bmploader().loadBMP("../assets/blocks/block.bmp");
}
void Texture::Bind() {

View File

@ -13,13 +13,15 @@ VertexArray::VertexArray(const VertexBuffer& buff) {
buff.Bind();
// generate new vertex array object
glGenVertexArrays(2, &handle);
glGenVertexArrays(1, &handle);
Bind();
// specify syntax of my data
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void *) nullptr);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void *) nullptr);
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void *) 12);
glEnableVertexAttribArray(1);
}