diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-02-23 16:31:40 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-02-24 03:26:44 +0300 |
commit | e4378412394caaf84215ae52af0a916b71804cd0 (patch) | |
tree | edacda64f226bfc601fdc28b04f7b03a3d7c79ec /source/blender/editors/screen/glutil.c | |
parent | 3d8f4fedd045baa38f44dea70e508f6395958d99 (diff) |
OpenGL immediate mode: modifying immDrawPixelsTex
This way OCIO can be used with it.
Diffstat (limited to 'source/blender/editors/screen/glutil.c')
-rw-r--r-- | source/blender/editors/screen/glutil.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index de24b8ec507..898fdb3bf9c 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -618,8 +618,7 @@ void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, int t 0.0f, 0.0f, 0.0f, 0.0f); } -/* TODO this is utterly slow and need some love - * but in the meantime it's not using deprecated api */ +/* Use the currently bound shader if there is one */ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, @@ -687,9 +686,15 @@ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, unsigned int pos = add_attrib(vert_format, "pos", GL_FLOAT, 2, KEEP_FLOAT); unsigned int texco = add_attrib(vert_format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); - immUniform4fv("color", color); - immUniform1i("image", 0); + unsigned int program = glaGetOneInt(GL_CURRENT_PROGRAM); + + if (program) + immBindProgram(program); + else { + immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); + immUniform1i("image", 0); + immUniform4fv("color", color); + } for (subpart_y = 0; subpart_y < nsubparts_y; subpart_y++) { for (subpart_x = 0; subpart_x < nsubparts_x; subpart_x++) { |