diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-17 22:22:39 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-18 04:43:52 +0300 |
commit | 59975b0adf42cfbc51a90c02caaed49085abafa2 (patch) | |
tree | 590f19ab1f58a235340f760e5a04c1f328c6704a /source/blender/gpu | |
parent | 8dfc31f61fac5a6301d6bfb17eda74ea4fffe384 (diff) |
Cleanup: WM: Encapsulate stereo draw buffers binding
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_framebuffer.h | 8 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.c | 14 |
2 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h index 6925839256b..1a9fb1bad7a 100644 --- a/source/blender/gpu/GPU_framebuffer.h +++ b/source/blender/gpu/GPU_framebuffer.h @@ -41,6 +41,12 @@ typedef enum eGPUFrameBufferBits { GPU_STENCIL_BIT = (1 << 2), } eGPUFrameBufferBits; +typedef enum eGPUBackBuffer { + GPU_BACKBUFFER = 0, + GPU_BACKBUFFER_RIGHT, + GPU_BACKBUFFER_LEFT, +} eGPUBackBuffer; + typedef struct GPUFrameBuffer GPUFrameBuffer; typedef struct GPUOffScreen GPUOffScreen; @@ -224,6 +230,8 @@ void GPU_clear(eGPUFrameBufferBits flags); void GPU_frontbuffer_read_pixels( int x, int y, int w, int h, int channels, eGPUDataFormat format, void *data); +void GPU_backbuffer_bind(eGPUBackBuffer buffer); + #ifdef __cplusplus } #endif diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index c079864126e..77abb786117 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -1080,3 +1080,17 @@ void GPU_frontbuffer_read_pixels( glReadBuffer(GL_FRONT); gpu_framebuffer_read_color_ex(x, y, w, h, channels, GL_FRONT, format, data); } + +/* For stereo rendering. */ +void GPU_backbuffer_bind(eGPUBackBuffer buffer) +{ + if (buffer == GPU_BACKBUFFER) { + glDrawBuffer(GL_BACK); + } + else if (buffer == GPU_BACKBUFFER_LEFT) { + glDrawBuffer(GL_BACK_LEFT); + } + else if (buffer == GPU_BACKBUFFER_RIGHT) { + glDrawBuffer(GL_BACK_RIGHT); + } +} |