- Simplify OpenGL integration test structure - Enable CTest registration for OpenGL tests - Refactor test fixtures and device enumeration - Minor code cleanup and improvements
44 lines
917 B
C++
44 lines
917 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#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
|