Add OpenGLRenderTargetView and OpenGLDepthStencilView

This commit is contained in:
2026-03-16 19:06:21 +08:00
parent 3cd47ea4c8
commit bf98fa0b89
5 changed files with 161 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
#pragma once
#include <GLFW/glfw3.h>
namespace XCEngine {
namespace RHI {
enum class DepthStencilFormat {
D16_UNORM,
D24_UNORM_S8_UINT,
D32_FLOAT,
D32_FLOAT_S8X24_UINT
};
class OpenGLDepthStencilView {
public:
OpenGLDepthStencilView();
~OpenGLDepthStencilView();
bool Initialize(unsigned int texture, int mipLevel = 0);
void Shutdown();
void Bind();
void Unbind();
unsigned int GetID() const { return m_texture; }
private:
unsigned int m_texture;
unsigned int m_framebuffer;
int m_mipLevel;
};
} // namespace RHI
} // namespace XCEngine

View File

@@ -0,0 +1,28 @@
#pragma once
#include <GLFW/glfw3.h>
namespace XCEngine {
namespace RHI {
class OpenGLRenderTargetView {
public:
OpenGLRenderTargetView();
~OpenGLRenderTargetView();
bool Initialize(unsigned int texture, int mipLevel = 0);
void Shutdown();
void Bind(unsigned int slot);
void Unbind();
unsigned int GetID() const { return m_texture; }
private:
unsigned int m_texture;
unsigned int m_framebuffer;
int m_mipLevel;
};
} // namespace RHI
} // namespace XCEngine