enable GL_TEXTURE_2D by default to reduce API calls
This commit is contained in:
parent
7314eb935e
commit
4b53d65c23
22 changed files with 23 additions and 60 deletions
|
@ -322,6 +322,7 @@ void draw_boss(Boss *boss) {
|
|||
return;
|
||||
}
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glPushMatrix();
|
||||
glTranslatef(10,2,0);
|
||||
glScalef((VIEWPORT_W-60)/(float)maxhpspan,1,1);
|
||||
|
@ -350,6 +351,7 @@ void draw_boss(Boss *boss) {
|
|||
}
|
||||
|
||||
glPopMatrix();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
// remaining spells
|
||||
glColor4f(1,1,1,0.7);
|
||||
|
|
|
@ -80,7 +80,6 @@ void credits_add(char *data, int time) {
|
|||
}
|
||||
|
||||
void credits_skysphere_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage6/sky")->gltex);
|
||||
|
||||
|
@ -92,12 +91,9 @@ void credits_skysphere_draw(Vector pos) {
|
|||
glPopMatrix();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void credits_towerwall_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage6/towerwall")->gltex);
|
||||
|
||||
Shader *s = get_shader("tower_wall");
|
||||
|
@ -112,7 +108,6 @@ void credits_towerwall_draw(Vector pos) {
|
|||
glPopMatrix();
|
||||
|
||||
glUseProgram(0);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
Vector **credits_skysphere_pos(Vector pos, float maxrange) {
|
||||
|
|
|
@ -87,8 +87,6 @@ void draw_dialog(Dialog *dialog) {
|
|||
glColor3f(1,1,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
glCullFace(GL_BACK);
|
||||
glPopMatrix();
|
||||
|
||||
|
@ -101,7 +99,10 @@ void draw_dialog(Dialog *dialog) {
|
|||
glTranslatef(VIEWPORT_W/2, VIEWPORT_H-75, 0);
|
||||
glScalef(VIEWPORT_W-40, 110, 1);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
draw_quad();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glPopMatrix();
|
||||
glColor4f(1,1,1,1);
|
||||
|
||||
|
|
|
@ -78,10 +78,8 @@ void draw_fbo(FBO *fbo) {
|
|||
glPushMatrix();
|
||||
glTranslatef(VIEWPORT_W/2., VIEWPORT_H/2., 0);
|
||||
glScalef(VIEWPORT_W, VIEWPORT_H, 1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, fbo->tex);
|
||||
glDrawArrays(GL_QUADS, 4, 4);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glPopMatrix();
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
|
|
|
@ -109,7 +109,6 @@ void draw_laser_curve_instanced(Laser *l) {
|
|||
}
|
||||
|
||||
void draw_laser_curve(Laser *laser) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
Texture *tex = get_tex("part/lasercurve");
|
||||
complex last;
|
||||
|
||||
|
@ -151,7 +150,6 @@ void draw_laser_curve(Laser *laser) {
|
|||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glColor4f(1,1,1,1);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void draw_lasers(int bgpass) {
|
||||
|
|
|
@ -65,7 +65,9 @@ void draw_char_menu(MenuData *menu) {
|
|||
glColor4f(0,0,0,0.7);
|
||||
glTranslatef(SCREEN_W/4*3, SCREEN_H/2, 0);
|
||||
glScalef(300, SCREEN_H, 1);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
draw_quad();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glPopMatrix();
|
||||
|
||||
CharacterID current_char;
|
||||
|
|
|
@ -52,7 +52,9 @@ void draw_difficulty_menu(MenuData *menu) {
|
|||
glRotatef(4*menu->drawdata[0]-4,0,0,1);
|
||||
glPushMatrix();
|
||||
glScalef(SCREEN_W*1.5,120,1);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
draw_quad();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glPopMatrix();
|
||||
glColor3f(1,1,1);
|
||||
draw_text(AL_Left, 40+35*menu->drawdata[0], -12, menu->entries[menu->cursor].name, _fonts.standard);
|
||||
|
|
|
@ -860,6 +860,7 @@ void draw_options_menu(MenuData *menu) {
|
|||
glPushMatrix();
|
||||
glTranslatef(origin - (w+cw) * 0.5, 20 * i, 0);
|
||||
draw_text(AL_Right, -((w+cw) * 0.5 + 10), 0, tmp, _fonts.standard);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glPushMatrix();
|
||||
glScalef(w+cw, h, 1);
|
||||
glColor4f(1, 1, 1, (0.1 + 0.2 * a) * alpha);
|
||||
|
@ -870,6 +871,7 @@ void draw_options_menu(MenuData *menu) {
|
|||
glColor4f(0.9, 0.6, 0.2, alpha);
|
||||
draw_quad();
|
||||
glPopMatrix();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,9 @@ static void replayview_draw_stagemenu(MenuData *m) {
|
|||
glTranslatef(SCREEN_W*0.5, SCREEN_H*0.5, 0);
|
||||
glScalef(width, height, 1);
|
||||
glColor4f(0.1, 0.1, 0.1, 0.7 * alpha);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
draw_quad();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glPopMatrix();
|
||||
|
||||
glPushMatrix();
|
||||
|
|
|
@ -97,7 +97,6 @@ void draw_animation(float x, float y, int col, int row, const char *name) {
|
|||
}
|
||||
|
||||
void draw_animation_p(float x, float y, int col, int row, Animation *ani) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, ani->tex->gltex);
|
||||
|
||||
float s = (float)ani->tex->w/ani->cols/ani->tex->truew;
|
||||
|
@ -124,5 +123,4 @@ void draw_animation_p(float x, float y, int col, int row, Animation *ani) {
|
|||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glPopMatrix();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
|
|
@ -175,8 +175,6 @@ static void draw_text_texture(Alignment align, float x, float y, Texture *tex) {
|
|||
if(tex->h&1)
|
||||
y += 0.5;
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(x, y, 0);
|
||||
glScalef(m, m, 1);
|
||||
|
|
|
@ -209,7 +209,6 @@ void draw_texture(float x, float y, const char *name) {
|
|||
}
|
||||
|
||||
void draw_texture_p(float x, float y, Texture *tex) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, tex->gltex);
|
||||
|
||||
glPushMatrix();
|
||||
|
@ -235,7 +234,6 @@ void draw_texture_p(float x, float y, Texture *tex) {
|
|||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glPopMatrix();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void fill_screen(float xoff, float yoff, float ratio, const char *name) {
|
||||
|
@ -243,8 +241,6 @@ void fill_screen(float xoff, float yoff, float ratio, const char *name) {
|
|||
}
|
||||
|
||||
void fill_screen_p(float xoff, float yoff, float ratio, float aspect, Texture *tex) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, tex->gltex);
|
||||
|
||||
float rw = ratio;
|
||||
|
@ -293,7 +289,6 @@ void loop_tex_line_p(complex a, complex b, float w, float t, Texture *texture) {
|
|||
glTranslatef(t, 0, 0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, texture->gltex);
|
||||
|
||||
draw_quad();
|
||||
|
|
|
@ -45,7 +45,6 @@ static void draw_wall_of_text(float f, const char *txt) {
|
|||
glUniform1f(uniloc(shader, "ratio"), h/w);
|
||||
glUniform2f(uniloc(shader, "origin"), creal(global.boss->pos)/h, cimag(global.boss->pos)/w);
|
||||
glUniform1f(uniloc(shader, "t"), f);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, tex->gltex);
|
||||
draw_quad();
|
||||
glUseProgram(0);
|
||||
|
|
|
@ -51,15 +51,14 @@ static void stage1_bg_draw(Vector pos) {
|
|||
glTranslatef(0,stage_3d_context.cx[1]+500,0);
|
||||
glRotatef(180,1,0,0);
|
||||
|
||||
//glEnable(GL_TEXTURE_2D);
|
||||
//glBindTexture(GL_TEXTURE_2D, get_tex("stage1/water")->gltex);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glPushMatrix();
|
||||
glScalef(1200,3000,1);
|
||||
glColor4f(0,0.1,.1,1);
|
||||
draw_quad();
|
||||
glColor4f(1,1,1,1);
|
||||
glPopMatrix();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(30,1,0,0);
|
||||
|
@ -74,6 +73,7 @@ static void stage1_bg_draw(Vector pos) {
|
|||
glPopMatrix();
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glPushMatrix();
|
||||
glScalef(1200,3000,1);
|
||||
glColor4f(0,0.1,.1,0.8);
|
||||
|
@ -82,6 +82,7 @@ static void stage1_bg_draw(Vector pos) {
|
|||
glPopMatrix();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glPopMatrix();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static Vector **stage1_bg_pos(Vector p, float maxrange) {
|
||||
|
|
|
@ -35,7 +35,6 @@ struct stage2_spells_s stage2_spells = {
|
|||
};
|
||||
|
||||
static void stage2_bg_leaves_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glUseProgram(get_shader("alpha_depth")->prog);
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
|
@ -58,15 +57,12 @@ static void stage2_bg_leaves_draw(Vector pos) {
|
|||
|
||||
glUseProgram(0);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void stage2_bg_grass_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage2/roadgrass")->gltex);
|
||||
|
||||
|
@ -79,11 +75,9 @@ static void stage2_bg_grass_draw(Vector pos) {
|
|||
glPopMatrix();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static void stage2_bg_ground_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glPushMatrix();
|
||||
glTranslatef(pos[0]-50,pos[1],pos[2]);
|
||||
glScalef(-1000,1000,1);
|
||||
|
@ -102,7 +96,6 @@ static void stage2_bg_ground_draw(Vector pos) {
|
|||
glTranslatef(0,0,+10);
|
||||
draw_quad();
|
||||
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
|
@ -123,8 +116,6 @@ static void stage2_bg_ground_draw(Vector pos) {
|
|||
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
|
|
@ -69,8 +69,6 @@ static void stage3_bg_tunnel_draw(Vector pos) {
|
|||
float r = 300;
|
||||
int i;
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
@ -85,7 +83,6 @@ static void stage3_bg_tunnel_draw(Vector pos) {
|
|||
}
|
||||
|
||||
glPopMatrix();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static void stage3_tunnel(FBO *fbo) {
|
||||
|
|
|
@ -86,7 +86,6 @@ static Vector **stage4_fountain_pos(Vector pos, float maxrange) {
|
|||
}
|
||||
|
||||
static void stage4_fountain_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage2/border")->gltex);
|
||||
|
||||
glPushMatrix();
|
||||
|
@ -97,8 +96,6 @@ static void stage4_fountain_draw(Vector pos) {
|
|||
draw_quad();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static Vector **stage4_lake_pos(Vector pos, float maxrange) {
|
||||
|
@ -125,7 +122,6 @@ static Vector **stage4_lake_pos(Vector pos, float maxrange) {
|
|||
}
|
||||
|
||||
static void stage4_lake_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage4/lake")->gltex);
|
||||
|
||||
glPushMatrix();
|
||||
|
@ -143,9 +139,6 @@ static void stage4_lake_draw(Vector pos) {
|
|||
|
||||
draw_model("mansion");
|
||||
glPopMatrix();
|
||||
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static Vector **stage4_corridor_pos(Vector pos, float maxrange) {
|
||||
|
@ -165,7 +158,6 @@ static Vector **stage4_corridor_pos(Vector pos, float maxrange) {
|
|||
}
|
||||
|
||||
static void stage4_corridor_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage4/planks")->gltex);
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
|
@ -220,6 +212,8 @@ static void stage4_corridor_draw(Vector pos) {
|
|||
|
||||
glPopMatrix();
|
||||
glColor3f(1,1,1);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static void stage4_start(void) {
|
||||
|
|
|
@ -52,7 +52,6 @@ static Vector **stage5_stairs_pos(Vector pos, float maxrange) {
|
|||
}
|
||||
|
||||
static void stage5_stairs_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage5/tower")->gltex);
|
||||
|
||||
glPushMatrix();
|
||||
|
@ -69,8 +68,6 @@ static void stage5_stairs_draw(Vector pos) {
|
|||
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,8 +75,6 @@ Vector **stage6_towerwall_pos(Vector pos, float maxrange) {
|
|||
}
|
||||
|
||||
void stage6_towerwall_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage6/towerwall")->gltex);
|
||||
|
||||
Shader *s = get_shader("tower_wall");
|
||||
|
@ -90,7 +88,6 @@ void stage6_towerwall_draw(Vector pos) {
|
|||
glPopMatrix();
|
||||
|
||||
glUseProgram(0);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static Vector **stage6_towertop_pos(Vector pos, float maxrange) {
|
||||
|
@ -100,8 +97,6 @@ static Vector **stage6_towertop_pos(Vector pos, float maxrange) {
|
|||
}
|
||||
|
||||
static void stage6_towertop_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage6/towertop")->gltex);
|
||||
|
||||
glPushMatrix();
|
||||
|
@ -109,8 +104,6 @@ static void stage6_towertop_draw(Vector pos) {
|
|||
glScalef(28,28,28);
|
||||
draw_model("towertop");
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static Vector **stage6_skysphere_pos(Vector pos, float maxrange) {
|
||||
|
@ -118,7 +111,6 @@ static Vector **stage6_skysphere_pos(Vector pos, float maxrange) {
|
|||
}
|
||||
|
||||
static void stage6_skysphere_draw(Vector pos) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
Shader *s = get_shader("stage6_sky");
|
||||
glUseProgram(s->prog);
|
||||
|
@ -131,7 +123,6 @@ static void stage6_skysphere_draw(Vector pos) {
|
|||
draw_model("skysphere");
|
||||
|
||||
glUseProgram(0);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
for(int i = 0; i < NUM_STARS; i++) {
|
||||
glPushMatrix();
|
||||
|
@ -143,6 +134,7 @@ static void stage6_skysphere_draw(Vector pos) {
|
|||
draw_texture(0,0,"part/lasercurve");
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glColor4f(1,1,1,1);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
|
|
@ -613,7 +613,6 @@ void Baryon(Enemy *e, int t, bool render) {
|
|||
if(!n)
|
||||
return;
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage6/baryon_connector")->gltex);
|
||||
glPushMatrix();
|
||||
glTranslatef(creal(e->pos+n->pos)/2.0, cimag(e->pos+n->pos)/2.0, 0);
|
||||
|
@ -622,7 +621,6 @@ void Baryon(Enemy *e, int t, bool render) {
|
|||
|
||||
draw_quad();
|
||||
glPopMatrix();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void BaryonCenter(Enemy *e, int t, bool render) {
|
||||
|
@ -666,7 +664,6 @@ void BaryonCenter(Enemy *e, int t, bool render) {
|
|||
if(!l[0] || !l[1])
|
||||
return;
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage6/baryon_connector")->gltex);
|
||||
for(i = 0; i < 2; i++) {
|
||||
glPushMatrix();
|
||||
|
@ -677,7 +674,6 @@ void BaryonCenter(Enemy *e, int t, bool render) {
|
|||
glPopMatrix();
|
||||
|
||||
}
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
int baryon_unfold(Enemy *e, int t) {
|
||||
|
|
|
@ -416,6 +416,7 @@ void set_ortho(void) {
|
|||
void colorfill(float r, float g, float b, float a) {
|
||||
if(a <= 0) return;
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glColor4f(r,g,b,a);
|
||||
|
||||
glPushMatrix();
|
||||
|
@ -426,6 +427,7 @@ void colorfill(float r, float g, float b, float a) {
|
|||
glPopMatrix();
|
||||
|
||||
glColor4f(1,1,1,1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void fade_out(float f) {
|
||||
|
|
|
@ -157,6 +157,7 @@ static void video_init_gl(void) {
|
|||
glDepthFunc(GL_LEQUAL);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
init_quadvbo();
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
|
Loading…
Reference in a new issue