--- a/src/pvr2/render.c Tue Jan 01 05:08:38 2008 +0000 +++ b/src/pvr2/render.c Thu Feb 14 14:06:41 2008 +0000 @@ -18,6 +18,7 @@ #include #include +#include #include "pvr2/pvr2.h" #include "asic.h" @@ -79,7 +80,7 @@ * Prepare the OpenGL context to receive instructions for a new frame. */ static void pvr2_render_prepare_context( render_buffer_t buffer, - float bgplanez, float nearz ) + float nearz, float farz ) { /* Select and initialize the render context */ display_driver->set_render_target(buffer); @@ -95,7 +96,7 @@ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho( 0, buffer->width, buffer->height, 0, -bgplanez, -nearz ); + glOrtho( 0, buffer->width, buffer->height, 0, -nearz, -farz ); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glCullFace( GL_BACK ); @@ -121,8 +122,10 @@ gettimeofday(&tva, NULL); - float bgplanez = 1/MMIO_READF( PVR2, RENDER_FARCLIP ); - pvr2_render_prepare_context( buffer, bgplanez, 0 ); + float farz, nearz; + pvr2_render_find_z_range( &nearz, &farz ); + float bgplanez = MMIO_READF( PVR2, RENDER_FARCLIP ); + pvr2_render_prepare_context( buffer, nearz, farz ); int clip_x = MMIO_READ( PVR2, RENDER_HCLIP ) & 0x03FF; int clip_y = MMIO_READ( PVR2, RENDER_VCLIP ) & 0x03FF;