Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2017-02-23 16:31:40 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-02-24 03:26:44 +0300
commite4378412394caaf84215ae52af0a916b71804cd0 (patch)
treeedacda64f226bfc601fdc28b04f7b03a3d7c79ec /source/blender/editors
parent3d8f4fedd045baa38f44dea70e508f6395958d99 (diff)
OpenGL immediate mode: modifying immDrawPixelsTex
This way OCIO can be used with it.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_draw.c1
-rw-r--r--source/blender/editors/screen/glutil.c15
2 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index c96e5c73166..afb6422ec4b 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1735,6 +1735,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
UI_draw_roundbox_gl_mode(GL_TRIANGLE_FAN, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
}
+ GPU_shader_unbind(); /* make sure there is no program bound */
immDrawPixelsTex(rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, drawibuf->rect, 1.0f, 1.0f, img_col);
/* draw cross for pixel position */
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++) {