diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-05-08 17:38:49 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-05-08 17:38:49 +0300 |
commit | 6aa7843de7d579724cb0cea0c66a5ddc4c03c959 (patch) | |
tree | b5217be9e36b4283a33adacb941e0785a7d74608 /source/blender/editors/space_sequencer | |
parent | 907135011a03620a25043deaf0fdd1742320ee0e (diff) |
Fix wrong attributes and shader binding in sequencer when using OCIO
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index e7c7b3d67b9..4d1e878868a 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1221,6 +1221,13 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } + /* Format needs to be created prior to any immBindProgram call. + * Do it here because OCIO binds it's own shader. + */ + VertexFormat *imm_format = immVertexFormat(); + unsigned int pos = VertexFormat_add_attrib(imm_format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + if (scope) { IMB_freeImBuf(ibuf); ibuf = scope; @@ -1311,13 +1318,11 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq else glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, format, type, display_buffer); - VertexFormat *imm_format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(imm_format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT); - - immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); - immUniformColor3f(1.0f, 1.0f, 1.0f); - immUniform1i("image", GL_TEXTURE0); + if (!glsl_used) { + immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); + immUniformColor3f(1.0f, 1.0f, 1.0f); + immUniform1i("image", GL_TEXTURE0); + } immBegin(PRIM_TRIANGLE_FAN, 4); @@ -1403,7 +1408,9 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq glBindTexture(GL_TEXTURE_2D, 0); - immUnbindProgram(); + if (!glsl_used) { + immUnbindProgram(); + } if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) { glDisable(GL_BLEND); |