Search
lxdream.org :: lxdream/src/pvr2/glrender.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/glrender.c
changeset 649:620c5c6496b5
prev648:ef9aa5cba86f
next651:95a9cf98785b
author nkeynes
date Tue Mar 11 08:50:16 2008 +0000 (12 years ago)
branchlxdream-render
permissions -rw-r--r--
last change Use maxz rather than minz for tri sorting (better results atm)
Change depth-test-disable to depth-mask (more correct)
Implement alpha test for punchthru polys
file annotate diff log raw
1.1 --- a/src/pvr2/glrender.c Sat Mar 08 04:21:42 2008 +0000
1.2 +++ b/src/pvr2/glrender.c Tue Mar 11 08:50:16 2008 +0000
1.3 @@ -87,6 +87,7 @@
1.4 texcache_gl_init(); // Allocate texture IDs
1.5 glCullFace( GL_BACK );
1.6 glEnable( GL_BLEND );
1.7 + glEnable( GL_DEPTH_TEST );
1.8 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
1.9 glMatrixMode(GL_MODELVIEW);
1.10 glLoadIdentity();
1.11 @@ -118,12 +119,8 @@
1.12 texture = context[2];
1.13 }
1.14
1.15 - if( POLY1_DEPTH_ENABLE(poly1) ) {
1.16 - glEnable( GL_DEPTH_TEST );
1.17 - glDepthFunc( POLY1_DEPTH_MODE(poly1) );
1.18 - } else {
1.19 - glDisable( GL_DEPTH_TEST );
1.20 - }
1.21 + glDepthFunc( POLY1_DEPTH_MODE(poly1) );
1.22 + glDepthMask( POLY1_DEPTH_WRITE(poly1) ? GL_TRUE : GL_FALSE );
1.23
1.24 switch( POLY1_CULL_MODE(poly1) ) {
1.25 case CULL_NONE:
1.26 @@ -186,7 +183,6 @@
1.27 }
1.28 render_set_context( poly->context, RENDER_NORMAL );
1.29 glDrawArrays(GL_TRIANGLE_STRIP, poly->vertex_index, poly->vertex_count );
1.30 -
1.31 }
1.32
1.33 void gl_render_tilelist( pvraddr_t tile_entry )
1.34 @@ -251,6 +247,8 @@
1.35 }
1.36 glOrtho( 0, pvr2_scene.buffer_width, pvr2_scene.buffer_height, 0,
1.37 -farz, -nearz );
1.38 + float alphaRef = ((float)(MMIO_READ(PVR2, RENDER_ALPHA_REF)&0xFF)+1)/256.0;
1.39 + glAlphaFunc( GL_GEQUAL, alphaRef );
1.40
1.41 /* Clear the buffer (FIXME: May not want always want to do this) */
1.42 glDisable( GL_SCISSOR_TEST );
1.43 @@ -292,7 +290,9 @@
1.44 }
1.45 }
1.46 if( IS_TILE_PTR(segment->punchout_ptr) ) {
1.47 - gl_render_tilelist(segment->punchout_ptr);
1.48 + glEnable(GL_ALPHA_TEST );
1.49 + render_autosort_tile(segment->punchout_ptr, RENDER_NORMAL );
1.50 + glDisable(GL_ALPHA_TEST );
1.51 }
1.52 } while( !IS_LAST_SEGMENT(segment++) );
1.53 glDisable( GL_SCISSOR_TEST );
.