RenderTarget GetData
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 2m11s

Async GetData is todo
This commit is contained in:
2024-09-19 19:15:04 -04:00
parent b86377a092
commit e712a5aaa3
3 changed files with 14 additions and 2 deletions

View File

@@ -27,6 +27,8 @@ public:
[[nodiscard]] GLuint GetGLFramebufferObjectHandle() const;
[[nodiscard]] GLuint GetGLDepthBufferHandle() const;
[[nodiscard]] Color4 GetClearColor() const;
/// Get the data back from the FBO. This is *not* async friendly.
[[nodiscard]] std::vector<GLfloat> GetData() const;
public:
/// Create a render target for a texture that already exists. For decals.
explicit RenderTarget(const Texture& texture, const Color4& clear_color = Colors::Black, bool use_depth = false);

View File

@@ -42,10 +42,9 @@ public:
/// Get list data back from the GPU. This is *very* slow.
/// It's not recommended you use this in your normal rendering routines.
template <typename T>
[[nodiscard]] std::vector<T> GetListData() const {
[[nodiscard]] std::vector<T> GetData() const {
GLenum buffer_type;
GLint current_buffer = 0;
if constexpr (std::is_same<T, GLfloat>::value)
buffer_type = GL_ARRAY_BUFFER,
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &current_buffer);