-
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.
- Use a vector instead of an array to remove the array size from the attributes - Use a generic constructor for the constructor
- Loading branch information
Showing
3 changed files
with
12 additions
and
25 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
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
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 |
---|---|---|
@@ -1,22 +1,26 @@ | ||
#pragma once | ||
|
||
#include <GL/glew.h> | ||
#include <vector> | ||
#include "../../api/API.h" | ||
|
||
namespace FlowEngine { namespace Graphics { | ||
|
||
class IndexBuffer | ||
{ | ||
private: | ||
GLuint mBufferID; | ||
GLuint mCount; | ||
public: | ||
IndexBuffer(GLushort* data, GLsizei count); | ||
IndexBuffer(GLuint* data, GLsizei count); | ||
template <typename T> | ||
IndexBuffer(const std::vector<T>& indices) : mBufferID(API::createBuffer()) | ||
{ | ||
bind(); | ||
API::setBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(T), indices.data(), GL_STATIC_DRAW); | ||
unbind(); | ||
} | ||
|
||
void bind() const; | ||
void unbind() const; | ||
|
||
inline GLuint getCount() const { return mCount; } | ||
}; | ||
|
||
}} |