OpenGL: use old API for texture matrix

New matrix API does not support texture matrices. Not sure what the final code will look like, but this at least avoids interference with new ModelView matrix.

Marked each line with TEXTURE so they can be disregarded during searches.

Related to T49450
This commit is contained in:
2017-03-26 21:05:02 -04:00
parent 67ffad8cd2
commit a68cc0dc26
3 changed files with 17 additions and 17 deletions

View File

@@ -606,20 +606,20 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
glDepthFunc(GL_ALWAYS);
glMatrixMode(GL_TEXTURE);
gpuPushMatrix();
gpuLoadIdentity();
glPushMatrix(); /* TEXTURE */
glLoadIdentity(); /* TEXTURE */
if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) {
/* brush rotation */
gpuTranslate2f(0.5, 0.5);
gpuRotate2D(RAD2DEGF(primary ? ups->brush_rotation : ups->brush_rotation_sec));
gpuTranslate2f(-0.5f, -0.5f);
glTranslatef(0.5, 0.5, 0); /* TEXTURE */
glRotatef(RAD2DEGF(primary ? ups->brush_rotation : ups->brush_rotation_sec), 0, 0, 1); /* TEXTURE */
glTranslatef(-0.5f, -0.5f, 0); /* TEXTURE */
/* scale based on tablet pressure */
if (primary && ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) {
gpuTranslate2f(0.5f, 0.5f);
gpuScaleUniform(1.0f / ups->size_pressure_value);
gpuTranslate2f(-0.5f, -0.5f);
glTranslatef(0.5f, 0.5f, 0); /* TEXTURE */
glScalef(1.0f / ups->size_pressure_value, 1.0f / ups->size_pressure_value, 1.0f / ups->size_pressure_value); /* TEXTURE */
glTranslatef(-0.5f, -0.5f, 0); /* TEXTURE */
}
if (ups->draw_anchored) {
@@ -697,7 +697,7 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
immUnbindProgram();
gpuPopMatrix();
glPopMatrix(); /* TEXTURE */
if (mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) {
glMatrixMode(GL_MODELVIEW);

View File

@@ -1104,7 +1104,7 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
glBindTexture(GL_TEXTURE_2D, ima->bindcode[TEXTARGET_TEXTURE_2D]);
glMatrixMode(GL_TEXTURE);
gpuLoadMatrix3D(texbase->tex_mapping.mat);
glLoadMatrixf((float*) texbase->tex_mapping.mat); /* TEXTURE */
glMatrixMode(GL_MODELVIEW);
/* use active UV texture layer */
@@ -1140,7 +1140,7 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
}
else {
glMatrixMode(GL_TEXTURE);
gpuLoadIdentity();
glLoadIdentity(); /* TEXTURE */
glMatrixMode(GL_MODELVIEW);
/* enable solid material */
@@ -1243,7 +1243,7 @@ void draw_mesh_textured(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D
glFrontFace(GL_CCW);
glMatrixMode(GL_TEXTURE);
gpuLoadIdentity();
glLoadIdentity(); /* TEXTURE */
glMatrixMode(GL_MODELVIEW);
/* faceselect mode drawing over textured mesh */

View File

@@ -420,7 +420,7 @@ void GPU_clear_tpage(bool force)
GTS.curima = NULL;
if (GTS.curtilemode != 0) {
glMatrixMode(GL_TEXTURE);
gpuLoadIdentity();
glLoadIdentity(); /* TEXTURE */
glMatrixMode(GL_MODELVIEW);
}
GTS.curtilemode = 0;
@@ -604,10 +604,10 @@ int GPU_verify_image(
GTS.curtileYRep != GTS.tileYRep)
{
glMatrixMode(GL_TEXTURE);
gpuLoadIdentity();
glLoadIdentity(); /* TEXTURE */
if (ima && (ima->tpageflag & IMA_TILES))
gpuScale2f(ima->xrep, ima->yrep);
glScalef(ima->xrep, ima->yrep, 0); /* TEXTURE */
glMatrixMode(GL_MODELVIEW);
}
@@ -2096,7 +2096,7 @@ void GPU_end_object_materials(void)
/* resetting the texture matrix after the scaling needed for tiled textures */
if (GTS.tilemode) {
glMatrixMode(GL_TEXTURE);
gpuLoadIdentity();
glLoadIdentity(); /* TEXTURE */
glMatrixMode(GL_MODELVIEW);
}
}
@@ -2286,7 +2286,7 @@ void GPU_state_init(void)
glDepthRange(0.0, 1.0);
glMatrixMode(GL_TEXTURE);
gpuLoadIdentity();
glLoadIdentity(); /* TEXTURE */
glMatrixMode(GL_MODELVIEW);
glFrontFace(GL_CCW);