mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Added ReadPixel method to framebuffers
This commit is contained in:
@@ -126,6 +126,14 @@ namespace Nuake
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
int FrameBuffer::ReadPixel(uint32_t attachment, const Vector2 coords)
|
||||
{
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0 + attachment);
|
||||
int pixelData;
|
||||
glReadPixels((int)coords.x, (int)coords.y, 1, 1, GL_RED_INTEGER, GL_INT, &pixelData);
|
||||
return pixelData;
|
||||
}
|
||||
|
||||
void FrameBuffer::SetDrawBuffer(GLenum draw)
|
||||
{
|
||||
Bind();
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace Nuake
|
||||
void SetSize(const Vector2& size) { m_Size = size; }
|
||||
void UpdateSize(Vector2 size);
|
||||
|
||||
|
||||
int ReadPixel(uint32_t attachment, const Vector2 coords);
|
||||
void SetDrawBuffer(GLenum draw);
|
||||
void SetReadBuffer(GLenum read);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user