Files
XCEngine/tests/OpenGL/OpenGLVertexArray.h

45 lines
941 B
C
Raw Normal View History

#pragma once
#include <string>
#include <GLFW/glfw3.h>
#include <vector>
namespace XCEngine {
namespace RHI {
struct VertexAttribute {
unsigned int index;
int count;
unsigned int type;
bool normalized;
size_t stride;
size_t offset;
};
class OpenGLVertexArray {
public:
OpenGLVertexArray();
~OpenGLVertexArray();
bool Initialize();
void AddVertexBuffer(unsigned int buffer, const VertexAttribute& attribute);
void SetIndexBuffer(unsigned int buffer, unsigned int type);
void Shutdown();
void Bind() const;
void Unbind() const;
unsigned int GetID() const { return m_vao; }
unsigned int GetIndexBuffer() const { return m_indexBuffer; }
unsigned int GetIndexCount() const { return m_indexCount; }
private:
unsigned int m_vao;
unsigned int m_indexBuffer;
unsigned int m_indexCount;
int m_vertexBufferCount;
};
} // namespace RHI
} // namespace XCEngine