diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-11-28 03:20:28 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-12-06 21:35:15 +0300 |
commit | cf921934b1a6a30461779e26d67d02d0b66bdafc (patch) | |
tree | ea6e1a6618628f11a4114ecb47cfd94acc005939 /source/blender/editors | |
parent | 147f7a1e860587a928f465b0b4d0ecf816c997be (diff) |
OpenGL: use simple shader for texture drawing in a few places.
Differential Revision: https://developer.blender.org/D1645
Diffstat (limited to 'source/blender/editors')
5 files changed, 20 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 843b0d5f2dc..e0128660e77 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -34,6 +34,7 @@ #include "MEM_guardedalloc.h" #include "GPU_extensions.h" +#include "GPU_simple_shader.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -1122,7 +1123,7 @@ static void icon_draw_texture( y1 = iy * icongltex.invh; y2 = (iy + ih) * icongltex.invh; - glEnable(GL_TEXTURE_2D); + GPU_simple_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR); glBindTexture(GL_TEXTURE_2D, icongltex.id); /* sharper downscaling, has no effect when scale matches with a mip level */ @@ -1145,7 +1146,7 @@ static void icon_draw_texture( glTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, 0.0f); glBindTexture(GL_TEXTURE_2D, 0); - glDisable(GL_TEXTURE_2D); + GPU_simple_shader_bind(GPU_SHADER_USE_COLOR); } /* Drawing size for preview images */ diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 337a959200a..a7f239ed04c 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -45,10 +45,11 @@ #include "BIF_gl.h" #include "BIF_glutil.h" - #include "IMB_colormanagement.h" #include "IMB_imbuf_types.h" +#include "GPU_simple_shader.h" + #include "UI_interface.h" #ifndef GL_CLAMP_TO_EDGE @@ -589,7 +590,7 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, format, GL_UNSIGNED_BYTE, &uc_rect[(((size_t)subpart_y) * offset_y + subpart_h - 1) * img_w * components + (subpart_x * offset_x + subpart_w - 1) * components]); } - glEnable(GL_TEXTURE_2D); + GPU_simple_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR); glBegin(GL_QUADS); glTexCoord2f((float)(0 + offset_left) / tex_w, (float)(0 + offset_bot) / tex_h); glVertex2f(rast_x + (float)offset_left * xzoom, rast_y + (float)offset_bot * yzoom); @@ -603,7 +604,7 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, glTexCoord2f((float)(0 + offset_left) / tex_w, (float)(subpart_h - offset_top) / tex_h); glVertex2f(rast_x + (float)offset_left * xzoom, rast_y + (float)(subpart_h - offset_top) * yzoom * scaleY); glEnd(); - glDisable(GL_TEXTURE_2D); + GPU_simple_shader_bind(GPU_SHADER_USE_COLOR); } } diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 9f5602efad0..079d0888207 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -59,6 +59,8 @@ #include "ED_view3d.h" +#include "GPU_simple_shader.h" + #include "UI_resources.h" #include "paint_intern.h" @@ -334,7 +336,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima target->old_col = col; } - glEnable(GL_TEXTURE_2D); + GPU_simple_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -457,7 +459,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom) MEM_freeN(buffer); } - glEnable(GL_TEXTURE_2D); + GPU_simple_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -793,6 +795,7 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush, } glPopAttrib(); + GPU_simple_shader_bind(GPU_SHADER_USE_COLOR); } diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 848883aacc1..2d7367885ca 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -58,6 +58,8 @@ #include "BIF_gl.h" #include "BIF_glutil.h" +#include "GPU_simple_shader.h" + #include "WM_types.h" #include "UI_interface.h" @@ -1085,7 +1087,7 @@ static void draw_plane_marker_image(Scene *scene, glColor4f(1.0, 1.0, 1.0, plane_track->image_opacity); - glEnable(GL_TEXTURE_2D); + GPU_simple_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR); glGenTextures(1, (GLuint *)&texid); glBindTexture(GL_TEXTURE_2D, texid); @@ -1109,7 +1111,7 @@ static void draw_plane_marker_image(Scene *scene, glPopMatrix(); glBindTexture(GL_TEXTURE_2D, 0); - glDisable(GL_TEXTURE_2D); + GPU_simple_shader_bind(GPU_SHADER_USE_COLOR); if (transparent) { glDisable(GL_BLEND); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index e9539bcc4c9..925804b8bb4 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -58,6 +58,8 @@ #include "BIF_gl.h" #include "BIF_glutil.h" +#include "GPU_simple_shader.h" + #include "ED_anim_api.h" #include "ED_gpencil.h" #include "ED_markers.h" @@ -1294,7 +1296,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq glColor4f(1.0, 1.0, 1.0, 1.0); - glEnable(GL_TEXTURE_2D); + GPU_simple_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR); glGenTextures(1, (GLuint *)&texid); glBindTexture(GL_TEXTURE_2D, texid); @@ -1369,7 +1371,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq glEnd(); glBindTexture(GL_TEXTURE_2D, 0); - glDisable(GL_TEXTURE_2D); + GPU_simple_shader_bind(GPU_SHADER_USE_COLOR); if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) glDisable(GL_BLEND); glDeleteTextures(1, &texid); |