Files
XCEngine/tests/OpenGL/OpenGLVertexArray.h
ssdfasd 434ba0f336 Add OpenGL backend core classes: Buffer, VertexArray
- Added OpenGLBuffer class for VBO/IBO management
- Added OpenGLVertexArray class for VAO management
- Updated CMakeLists.txt to include new source files
2026-03-16 16:11:24 +08:00

45 lines
941 B
C++

#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