diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-04 16:20:13 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-04 16:20:13 +0400 |
commit | c1b704a11aac13190054f42f2cd21a51c9132758 (patch) | |
tree | e306190d5ee56a621a2f20606b1b864000ad57b6 /source/blender/editors/screen/glutil.c | |
parent | f6add59e912f0496d9cf7a41af8ce6917e7b62d8 (diff) |
Use GLSL display for compositor backdrop and sequencer preview
Now only background images remained to be ported. Plus implement
GLSL for dithering and RGB curves.
Diffstat (limited to 'source/blender/editors/screen/glutil.c')
-rw-r--r-- | source/blender/editors/screen/glutil.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 3469604b3dd..ac8f44a3ab1 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -1028,7 +1028,9 @@ void bglFlush(void) /* **** Color management helper functions for GLSL display/transform ***** */ /* Draw given image buffer on a screen using GLSL for display transform */ -void glaDrawImBuf_glsl_ctx(const bContext *C, ImBuf *ibuf, float x, float y, int zoomfilter) +void glaDrawImBuf_glsl(ImBuf *ibuf, float x, float y, int zoomfilter, + ColorManagedViewSettings *view_settings, + ColorManagedDisplaySettings *display_settings) { bool force_fallback = false; bool need_fallback = true; @@ -1080,10 +1082,19 @@ void glaDrawImBuf_glsl_ctx(const bContext *C, ImBuf *ibuf, float x, float y, int if (force_fallback == false) { int ok; - if (ibuf->rect_float) - ok = IMB_colormanagement_setup_glsl_draw_ctx(C, TRUE); - else - ok = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->rect_colorspace, FALSE); + if (ibuf->rect_float) { + if (ibuf->float_colorspace) { + ok = IMB_colormanagement_setup_glsl_draw_from_space(view_settings, display_settings, + ibuf->float_colorspace, TRUE); + } + else { + ok = IMB_colormanagement_setup_glsl_draw(view_settings, display_settings, TRUE); + } + } + else { + ok = IMB_colormanagement_setup_glsl_draw_from_space(view_settings, display_settings, + ibuf->rect_colorspace, FALSE); + } if (ok) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -1121,7 +1132,7 @@ void glaDrawImBuf_glsl_ctx(const bContext *C, ImBuf *ibuf, float x, float y, int unsigned char *display_buffer; void *cache_handle; - display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle); + display_buffer = IMB_display_buffer_acquire(ibuf, view_settings, display_settings, &cache_handle); if (display_buffer) glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, @@ -1131,6 +1142,16 @@ void glaDrawImBuf_glsl_ctx(const bContext *C, ImBuf *ibuf, float x, float y, int } } +void glaDrawImBuf_glsl_ctx(const bContext *C, ImBuf *ibuf, float x, float y, int zoomfilter) +{ + ColorManagedViewSettings *view_settings; + ColorManagedDisplaySettings *display_settings; + + IMB_colormanagement_display_settings_from_ctx(C, &view_settings, &display_settings); + + glaDrawImBuf_glsl(ibuf, x, y, zoomfilter, view_settings, display_settings); +} + /* Transform buffer from role to scene linear space using GLSL OCIO conversion * * See IMB_colormanagement_setup_transform_from_role_glsl description for |