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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2015-11-28 03:09:13 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2015-11-28 17:35:34 +0300
commit8e1c63b3962e8e51fca23c19915c8dba675391e8 (patch)
tree7d6ed5690ce26e7aa5659abf372edb687df8f6c2 /source
parente1b8a5dc6fc8a3f7a5100a9c66b95d07c39b1cb3 (diff)
OpenGL: assume GL_TEXTURE_ENV_MODE GL_MODULATE is the default state.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/intern/blf.c31
-rw-r--r--source/blender/editors/screen/glutil.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c2
-rw-r--r--source/blender/editors/space_clip/clip_draw.c1
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c1
-rw-r--r--source/blender/gpu/intern/gpu_draw.c12
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c1
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
8 files changed, 17 insertions, 36 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index b7d72bb28bb..3369e1c08b6 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -486,7 +486,7 @@ void BLF_rotation_default(float angle)
}
}
-static void blf_draw_gl__start(FontBLF *font, GLint *mode, GLint *param)
+static void blf_draw_gl__start(FontBLF *font, GLint *mode)
{
/*
* The pixmap alignment hack is handle
@@ -523,19 +523,10 @@ static void blf_draw_gl__start(FontBLF *font, GLint *mode, GLint *param)
/* always bind the texture for the first glyph */
font->tex_bind_state = -1;
-
- /* Save the current parameter to restore it later. */
- glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param);
- if (*param != GL_MODULATE)
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
-static void blf_draw_gl__end(GLint mode, GLint param)
+static void blf_draw_gl__end(GLint mode)
{
- /* and restore the original value. */
- if (param != GL_MODULATE)
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param);
-
glMatrixMode(GL_TEXTURE);
glPopMatrix();
@@ -554,19 +545,19 @@ void BLF_draw_ex(
struct ResultBLF *r_info)
{
FontBLF *font = blf_get(fontid);
- GLint mode, param;
+ GLint mode;
BLF_RESULT_CHECK_INIT(r_info);
if (font && font->glyph_cache) {
- blf_draw_gl__start(font, &mode, &param);
+ blf_draw_gl__start(font, &mode);
if (font->flags & BLF_WORD_WRAP) {
blf_font_draw__wrap(font, str, len, r_info);
}
else {
blf_font_draw(font, str, len, r_info);
}
- blf_draw_gl__end(mode, param);
+ blf_draw_gl__end(mode);
}
}
void BLF_draw(int fontid, const char *str, size_t len)
@@ -579,12 +570,12 @@ void BLF_draw_ascii_ex(
struct ResultBLF *r_info)
{
FontBLF *font = blf_get(fontid);
- GLint mode, param;
+ GLint mode;
BLF_RESULT_CHECK_INIT(r_info);
if (font && font->glyph_cache) {
- blf_draw_gl__start(font, &mode, &param);
+ blf_draw_gl__start(font, &mode);
if (font->flags & BLF_WORD_WRAP) {
/* use non-ascii draw function for word-wrap */
blf_font_draw__wrap(font, str, len, r_info);
@@ -592,7 +583,7 @@ void BLF_draw_ascii_ex(
else {
blf_font_draw_ascii(font, str, len, r_info);
}
- blf_draw_gl__end(mode, param);
+ blf_draw_gl__end(mode);
}
}
void BLF_draw_ascii(int fontid, const char *str, size_t len)
@@ -603,13 +594,13 @@ void BLF_draw_ascii(int fontid, const char *str, size_t len)
int BLF_draw_mono(int fontid, const char *str, size_t len, int cwidth)
{
FontBLF *font = blf_get(fontid);
- GLint mode, param;
+ GLint mode;
int columns = 0;
if (font && font->glyph_cache) {
- blf_draw_gl__start(font, &mode, &param);
+ blf_draw_gl__start(font, &mode);
columns = blf_font_draw_mono(font, str, len, cwidth);
- blf_draw_gl__end(mode, param);
+ blf_draw_gl__end(mode);
}
return columns;
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index fd65d81baad..dd67126a5ec 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -511,7 +511,6 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format,
/* Specify the color outside this function, and tex will modulate it.
* This is useful for changing alpha without using glPixelTransferf()
*/
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glPixelStorei(GL_UNPACK_ROW_LENGTH, img_w);
glBindTexture(GL_TEXTURE_2D, texid);
@@ -620,7 +619,6 @@ 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);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
#ifdef __APPLE__
/* workaround for os x 10.5/10.6 driver bug (above) */
@@ -1096,7 +1094,6 @@ void glaDrawImBuf_glsl(ImBuf *ibuf, float x, float y, int zoomfilter,
}
if (ok) {
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(1.0, 1.0, 1.0, 1.0);
if (ibuf->rect_float) {
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 1ca0cab30ae..9f5602efad0 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -336,7 +336,6 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
glEnable(GL_TEXTURE_2D);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -460,7 +459,6 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom)
glEnable(GL_TEXTURE_2D);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index ba5bf7449d2..d3538f6557a 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1083,7 +1083,6 @@ static void draw_plane_marker_image(Scene *scene,
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(1.0, 1.0, 1.0, plane_track->image_opacity);
last_texid = glaGetOneInteger(GL_TEXTURE_2D);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index ebc41878910..889c25e0924 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1289,7 +1289,6 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
}
}
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(1.0, 1.0, 1.0, 1.0);
last_texid = glaGetOneInteger(GL_TEXTURE_2D);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 193230d15bf..31b9c07cdec 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -805,8 +805,6 @@ void GPU_create_gl_tex(unsigned int *bind, unsigned int *rect, float *frect, int
if (GLEW_EXT_texture_filter_anisotropic)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic());
- /* set to modulate with vertex color */
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (ibuf)
IMB_freeImBuf(ibuf);
@@ -848,8 +846,6 @@ bool GPU_upload_dxt_texture(ImBuf *ibuf)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
if (GLEW_EXT_texture_filter_anisotropic)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic());
@@ -2044,11 +2040,15 @@ static void gpu_multisample(bool enable)
#endif
}
-/* Default OpenGL State */
+/* Default OpenGL State
+ *
+ * This is called on startup, for opengl offscreen render and to restore state
+ * for the game engine. Generally we should always return to this state when
+ * temporarily modifying the state for drawing, though that are (undocumented)
+ * exceptions that we should try to get rid of. */
void GPU_state_init(void)
{
- /* also called when doing opengl rendering and in the game engine */
float mat_ambient[] = { 0.0, 0.0, 0.0, 0.0 };
float mat_specular[] = { 0.5, 0.5, 0.5, 1.0 };
int a, x, y;
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 18523f7c3e8..7280cc622dc 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -249,7 +249,6 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int frame, int f
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
error = glGetError();
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 6ad0405c56f..a03ddba67c3 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -486,8 +486,6 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
glTexImage2D(triple->target, 0, GL_RGB8, triple->x[x], triple->y[y], 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(triple->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(triple->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- /* The current color is ignored if the GL_REPLACE texture environment is used. */
- // glTexEnvi(triple->target, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(triple->target, 0);
/* not sure if this works everywhere .. */