Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_framebuffer.c
| Show First 20 Lines • Show All 608 Lines • ▼ Show 20 Lines | if (buffers & GPU_STENCIL_BIT) { | ||||
| glStencilMask(0xFF); | glStencilMask(0xFF); | ||||
| glClearStencil(clear_stencil); | glClearStencil(clear_stencil); | ||||
| } | } | ||||
| GLbitfield mask = convert_buffer_bits_to_gl(buffers); | GLbitfield mask = convert_buffer_bits_to_gl(buffers); | ||||
| glClear(mask); | glClear(mask); | ||||
| } | } | ||||
| /* Clear all textures bound to this framebuffer with a different color. */ | |||||
| void GPU_framebuffer_multi_clear(GPUFrameBuffer *fb, const float (*clear_cols)[4]) | |||||
| { | |||||
| CHECK_FRAMEBUFFER_IS_BOUND(fb); | |||||
| glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | |||||
| GPUAttachmentType type = GPU_FB_COLOR_ATTACHMENT0; | |||||
| for (int i = 0; type < GPU_FB_MAX_ATTACHEMENT; i++, type++) { | |||||
| if (fb->attachments[type].tex != NULL) { | |||||
| glClearBufferfv(GL_COLOR, i, clear_cols[i]); | |||||
| } | |||||
| } | |||||
| } | |||||
| void GPU_framebuffer_read_depth(GPUFrameBuffer *fb, int x, int y, int w, int h, float *data) | void GPU_framebuffer_read_depth(GPUFrameBuffer *fb, int x, int y, int w, int h, float *data) | ||||
| { | { | ||||
| CHECK_FRAMEBUFFER_IS_BOUND(fb); | CHECK_FRAMEBUFFER_IS_BOUND(fb); | ||||
| GLenum type = GL_DEPTH_COMPONENT; | GLenum type = GL_DEPTH_COMPONENT; | ||||
| glReadBuffer(GL_COLOR_ATTACHMENT0); /* This is OK! */ | glReadBuffer(GL_COLOR_ATTACHMENT0); /* This is OK! */ | ||||
| glReadPixels(x, y, w, h, type, GL_FLOAT, data); | glReadPixels(x, y, w, h, type, GL_FLOAT, data); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 436 Lines • Show Last 20 Lines | |||||