diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-11-28 03:45:23 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-11-28 17:35:34 +0300 |
commit | c76fbf10e2f6dc766763a760e5bb34f64274a253 (patch) | |
tree | a0b50faa4223b428151d40a74b0a90159d9efe6b /source/blender/editors | |
parent | 8e1c63b3962e8e51fca23c19915c8dba675391e8 (diff) |
OpenGL: remove unnecessarily paranoid bound texture preservation.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/BIF_glutil.h | 6 | ||||
-rw-r--r-- | source/blender/editors/screen/glutil.c | 20 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 4 |
4 files changed, 7 insertions, 28 deletions
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index b904417cfcb..05b733d2564 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -90,12 +90,6 @@ void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments void glutil_draw_filled_arc(float start, float angle, float radius, int nsegments); /** - * Returns an integer value as obtained by glGetIntegerv. - * The param must cause only one value to be gotten from GL. - */ -int glaGetOneInteger(int param); - -/** * Returns a float value as obtained by glGetFloatv. * The param must cause only one value to be gotten from GL. */ diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index dd67126a5ec..337a959200a 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -436,13 +436,6 @@ void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments glEnd(); } -int glaGetOneInteger(int param) -{ - GLint i; - glGetIntegerv(param, &i); - return i; -} - float glaGetOneFloat(int param) { GLfloat v; @@ -474,7 +467,6 @@ static int get_cached_work_texture(int *r_w, int *r_h) static int tex_h = 256; if (texid == -1) { - GLint ltexid = glaGetOneInteger(GL_TEXTURE_2D); unsigned char *tbuf; glGenTextures(1, (GLuint *)&texid); @@ -488,7 +480,7 @@ static int get_cached_work_texture(int *r_w, int *r_h) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tex_w, tex_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tbuf); MEM_freeN(tbuf); - glBindTexture(GL_TEXTURE_2D, ltexid); + glBindTexture(GL_TEXTURE_2D, 0); } *r_w = tex_w; @@ -501,8 +493,6 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, unsigned char *uc_rect = (unsigned char *) rect; const float *f_rect = (float *)rect; float xzoom = glaGetOneFloat(GL_ZOOM_X), yzoom = glaGetOneFloat(GL_ZOOM_Y); - int ltexid = glaGetOneInteger(GL_TEXTURE_2D); - int lrowlength = glaGetOneInteger(GL_UNPACK_ROW_LENGTH); int subpart_x, subpart_y, tex_w, tex_h; int seamless, offset_x, offset_y, nsubparts_x, nsubparts_y; int texid = get_cached_work_texture(&tex_w, &tex_h); @@ -617,8 +607,8 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, } } - glBindTexture(GL_TEXTURE_2D, ltexid); - glPixelStorei(GL_UNPACK_ROW_LENGTH, lrowlength); + glBindTexture(GL_TEXTURE_2D, 0); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); #ifdef __APPLE__ /* workaround for os x 10.5/10.6 driver bug (above) */ @@ -674,8 +664,6 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo draw_h = min_ii(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom)); if (draw_w > 0 && draw_h > 0) { - int old_row_length = glaGetOneInteger(GL_UNPACK_ROW_LENGTH); - /* Don't use safe RasterPos (slower) if we can avoid it. */ if (rast_x >= 0 && rast_y >= 0) { glRasterPos2f(rast_x, rast_y); @@ -706,7 +694,7 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo } } - glPixelStorei(GL_UNPACK_ROW_LENGTH, old_row_length); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); } } diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index d3538f6557a..848883aacc1 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -1063,7 +1063,7 @@ static void draw_plane_marker_image(Scene *scene, } if (display_buffer) { - GLuint texid, last_texid; + GLuint texid; float frame_corners[4][2] = {{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, @@ -1085,7 +1085,6 @@ static void draw_plane_marker_image(Scene *scene, glColor4f(1.0, 1.0, 1.0, plane_track->image_opacity); - last_texid = glaGetOneInteger(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D); glGenTextures(1, (GLuint *)&texid); @@ -1109,7 +1108,7 @@ static void draw_plane_marker_image(Scene *scene, glPopMatrix(); - glBindTexture(GL_TEXTURE_2D, last_texid); + glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); if (transparent) { diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 889c25e0924..6c76dbd5149 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1093,7 +1093,6 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq float viewrect[2]; float col[3]; GLuint texid; - GLuint last_texid; void *display_buffer; void *cache_handle = NULL; const bool is_imbuf = ED_space_sequencer_check_show_imbuf(sseq); @@ -1291,7 +1290,6 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq glColor4f(1.0, 1.0, 1.0, 1.0); - last_texid = glaGetOneInteger(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D); glGenTextures(1, (GLuint *)&texid); @@ -1366,7 +1364,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq } glEnd(); - glBindTexture(GL_TEXTURE_2D, last_texid); + glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) glDisable(GL_BLEND); |