mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
split render pipelines
This commit is contained in:
parent
fc46b7c434
commit
c1608fe8e2
13 changed files with 176 additions and 191 deletions
|
|
@ -117,7 +117,7 @@ void GBuffer::unbind() {
|
|||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
void GBuffer::bindBuffers() {
|
||||
void GBuffer::bindBuffers() const {
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_2D, normalsBuffer);
|
||||
|
||||
|
|
@ -177,6 +177,16 @@ void GBuffer::resize(uint width, uint height) {
|
|||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
std::unique_ptr<ImageData> GBuffer::toImage() const {
|
||||
auto data = std::make_unique<ubyte[]>(width * height * 3);
|
||||
glBindTexture(GL_TEXTURE_2D, colorBuffer);
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, data.get());
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
return std::make_unique<ImageData>(
|
||||
ImageFormat::rgb888, width, height, std::move(data)
|
||||
);
|
||||
}
|
||||
|
||||
uint GBuffer::getWidth() const {
|
||||
return width;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue