Files
palladium/backends/include/pd_system/gfx_opengl2.hpp
T

42 lines
1.0 KiB
C++
Raw Normal View History

2026-03-16 15:19:12 +01:00
#pragma once
#include <pd/drivers/gfx.hpp>
namespace PD {
2026-03-17 16:47:19 +01:00
struct GfxOpenGL2Config {
2026-03-16 15:19:12 +01:00
// Vertex Allocator
template <typename T>
using VertexAlloc = std::allocator<T>;
// Index Allocator
template <typename T>
using IndexAlloc = std::allocator<T>;
};
2026-03-17 16:47:19 +01:00
class GfxOpenGL2 : public GfxDriverBase<GfxOpenGL2Config> {
2026-03-16 15:19:12 +01:00
public:
2026-03-17 16:47:19 +01:00
GfxOpenGL2() : GfxDriverBase("OpenGL2") {}
~GfxOpenGL2() {}
2026-03-16 15:19:12 +01:00
void SysInit() override;
void SysDeinit() override;
void Submit(size_t count, size_t start) override;
void BindTexture(TextureID id) override;
void SysReset() override;
2026-03-18 09:31:47 +01:00
Li::Texture LoadTexture(
const std::vector<PD::u8>& pixels, int w, int h,
TextureFormat type = TextureFormat::RGBA32,
TextureFilter filter = TextureFilter::Linear) override;
void DeleteTexture(const Li::Texture& tex) override;
2026-03-16 15:19:12 +01:00
private:
void pSetupShaderAttribs(u32 shader);
u32 pShader = 0;
u32 VBO = 0;
u32 IBO = 0;
int pLocTex = 0;
int pLocAlfa = 0;
int pLocProjection = 0;
2026-03-18 21:21:00 +01:00
static const char* pVertCode;
static const char* pFragCode;
2026-03-16 15:19:12 +01:00
};
} // namespace PD