Skip to content

Commit

Permalink
Added "YoutubeOpenGL 4 - Organizing"
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Gordan committed Mar 11, 2021
1 parent 9417da5 commit 92edce1
Show file tree
Hide file tree
Showing 20 changed files with 10,639 additions and 0 deletions.
27 changes: 27 additions & 0 deletions YoutubeOpenGL 4 - Organizing/EBO.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include"EBO.h"

// Constructor that generates a Elements Buffer Object and links it to indices
EBO::EBO(GLuint* indices, GLsizeiptr size)
{
glGenBuffers(1, &ID);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ID);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, indices, GL_STATIC_DRAW);
}

// Binds the EBO
void EBO::Bind()
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ID);
}

// Unbinds the EBO
void EBO::Unbind()
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}

// Deletes the EBO
void EBO::Delete()
{
glDeleteBuffers(1, &ID);
}
22 changes: 22 additions & 0 deletions YoutubeOpenGL 4 - Organizing/EBO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef EBO_CLASS_H
#define EBO_CLASS_H

#include<glad/glad.h>

class EBO
{
public:
// ID reference of Elements Buffer Object
GLuint ID;
// Constructor that generates a Elements Buffer Object and links it to indices
EBO(GLuint* indices, GLsizeiptr size);

// Binds the EBO
void Bind();
// Unbinds the EBO
void Unbind();
// Deletes the EBO
void Delete();
};

#endif
Loading

0 comments on commit 92edce1

Please sign in to comment.