Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_framebuffer.c
| Show First 20 Lines • Show All 713 Lines • ▼ Show 20 Lines | |||||
| void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore) | void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore) | ||||
| { | { | ||||
| GPU_framebuffer_restore(); | GPU_framebuffer_restore(); | ||||
| if (restore) { | if (restore) { | ||||
| gpuPopAttrib(); | gpuPopAttrib(); | ||||
| } | } | ||||
| } | } | ||||
| void GPU_offscreen_draw_to_screen(GPUOffScreen *ofs, int x, int y) | |||||
| { | |||||
| const int w = GPU_texture_width(ofs->color); | |||||
| const int h = GPU_texture_height(ofs->color); | |||||
| glBindFramebuffer(GL_READ_FRAMEBUFFER, ofs->fb->object); | |||||
| GLenum status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); | |||||
| if (status == GL_FRAMEBUFFER_COMPLETE) { | |||||
| glBlitFramebuffer(0, 0, w, h, x, y, x + w, y + h, GL_COLOR_BUFFER_BIT, GL_NEAREST); | |||||
| } | |||||
| else { | |||||
| gpu_print_framebuffer_error(status, NULL); | |||||
| } | |||||
| glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); | |||||
| } | |||||
| void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels) | void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels) | ||||
| { | { | ||||
| const int w = GPU_texture_width(ofs->color); | const int w = GPU_texture_width(ofs->color); | ||||
| const int h = GPU_texture_height(ofs->color); | const int h = GPU_texture_height(ofs->color); | ||||
| BLI_assert(type == GL_UNSIGNED_BYTE || type == GL_FLOAT); | BLI_assert(type == GL_UNSIGNED_BYTE || type == GL_FLOAT); | ||||
| if (GPU_texture_target(ofs->color) == GL_TEXTURE_2D_MULTISAMPLE) { | if (GPU_texture_target(ofs->color) == GL_TEXTURE_2D_MULTISAMPLE) { | ||||
| ▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines | |||||