filename | src/pvr2/glrender.c |
changeset | 1138:3bcb705a7ebc |
prev | 1137:4799d64b3478 |
next | 1139:9af81878480b |
author | nkeynes |
date | Sun Oct 24 15:15:27 2010 +1000 (12 years ago) |
permissions | -rw-r--r-- |
last change | Bind texture 0 instead of enabling/disabling texturing all the time (marginally faster, but also simpler) |
file | annotate | diff | log | raw |
1.1 --- a/src/pvr2/glrender.c Sun Oct 24 13:40:52 2010 +10001.2 +++ b/src/pvr2/glrender.c Sun Oct 24 15:15:27 2010 +10001.3 @@ -76,8 +76,8 @@1.4 }1.5 }1.6 } else {1.7 - poly->tex_id = -1;1.8 - poly->mod_tex_id = -1;1.9 + poly->tex_id = 0;1.10 + poly->mod_tex_id = 0;1.11 }1.12 }1.13 }1.14 @@ -147,10 +147,7 @@1.15 {1.16 glShadeModel( POLY1_SHADE_MODEL(poly1) );1.17 if( POLY1_TEXTURED(poly1) ) {1.18 - glEnable(GL_TEXTURE_2D);1.19 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, pvr2_poly_texblend[POLY2_TEX_BLEND(poly2)] );1.20 - } else {1.21 - glDisable( GL_TEXTURE_2D );1.22 }1.24 switch( POLY2_FOG_MODE(poly2) ) {1.25 @@ -204,9 +201,7 @@1.26 if( poly->vertex_count == 0 )1.27 return; /* Culled */1.29 - if( poly->tex_id != -1 ) {1.30 - glBindTexture(GL_TEXTURE_2D, poly->tex_id);1.31 - }1.32 + glBindTexture(GL_TEXTURE_2D, poly->tex_id);1.33 if( poly->mod_vertex_index == -1 ) {1.34 render_set_context( poly->context, set_depth );1.35 gl_draw_vertexes(poly);1.36 @@ -218,7 +213,7 @@1.37 gl_draw_vertexes(poly);1.39 if( pvr2_scene.shadow_mode == SHADOW_FULL ) {1.40 - if( poly->mod_tex_id != -1 ) {1.41 + if( poly->mod_tex_id != poly->tex_id ) {1.42 glBindTexture(GL_TEXTURE_2D, poly->mod_tex_id);1.43 }1.44 render_set_tsp_context( poly->context[0], poly->context[3] );1.45 @@ -231,9 +226,7 @@1.47 static void gl_render_bkgnd( struct polygon_struct *poly )1.48 {1.49 - if( poly->tex_id != -1 ) {1.50 - glBindTexture(GL_TEXTURE_2D, poly->tex_id);1.51 - }1.52 + glBindTexture(GL_TEXTURE_2D, poly->tex_id);1.53 render_set_tsp_context( poly->context[0], poly->context[1] );1.54 glDisable( GL_DEPTH_TEST );1.55 glBlendFunc( GL_ONE, GL_ZERO );1.56 @@ -289,8 +282,6 @@1.57 if( !IS_TILE_PTR(tile_entry) )1.58 return;1.60 - glDisable( GL_TEXTURE_2D );1.61 -1.62 while(1) {1.63 uint32_t entry = *tile_list++;1.64 switch( entry >> 28 ) {1.65 @@ -408,7 +399,6 @@1.66 if( !IS_TILE_PTR(tile_entry) )1.67 return;1.69 - glDisable( GL_TEXTURE_2D );1.70 glEnable( GL_STENCIL_TEST );1.71 glEnable( GL_DEPTH_TEST );1.72 glDepthFunc( GL_LEQUAL );1.73 @@ -501,6 +491,7 @@1.74 glEnable( GL_SCISSOR_TEST );1.75 glEnable( GL_COLOR_SUM );1.76 glEnable( GL_FOG );1.77 + glEnable( GL_TEXTURE_2D );1.79 /* Process the segment list */1.80 struct tile_segment *segment = pvr2_scene.segment_list;
.