forked from VictorGordan/opengl-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added "YoutubeOpenGL 4 - Organizing"
- Loading branch information
Victor Gordan
committed
Mar 11, 2021
1 parent
9417da5
commit 92edce1
Showing
20 changed files
with
10,639 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.