Search
lxdream.org :: lxdream/src/pvr2/render.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/render.c
changeset 635:76c63aac3590
prev561:533f6b478071
next639:162ee7614b60
author nkeynes
date Thu Feb 14 14:06:41 2008 +0000 (16 years ago)
branchlxdream-render
permissions -rw-r--r--
last change Update svn:keywords
file annotate diff log raw
1.1 --- a/src/pvr2/render.c Tue Jan 01 05:08:38 2008 +0000
1.2 +++ b/src/pvr2/render.c Thu Feb 14 14:06:41 2008 +0000
1.3 @@ -18,6 +18,7 @@
1.4
1.5 #include <sys/time.h>
1.6 #include <time.h>
1.7 +#include <math.h>
1.8 #include "pvr2/pvr2.h"
1.9 #include "asic.h"
1.10
1.11 @@ -79,7 +80,7 @@
1.12 * Prepare the OpenGL context to receive instructions for a new frame.
1.13 */
1.14 static void pvr2_render_prepare_context( render_buffer_t buffer,
1.15 - float bgplanez, float nearz )
1.16 + float nearz, float farz )
1.17 {
1.18 /* Select and initialize the render context */
1.19 display_driver->set_render_target(buffer);
1.20 @@ -95,7 +96,7 @@
1.21 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
1.22 glMatrixMode(GL_PROJECTION);
1.23 glLoadIdentity();
1.24 - glOrtho( 0, buffer->width, buffer->height, 0, -bgplanez, -nearz );
1.25 + glOrtho( 0, buffer->width, buffer->height, 0, -nearz, -farz );
1.26 glMatrixMode(GL_MODELVIEW);
1.27 glLoadIdentity();
1.28 glCullFace( GL_BACK );
1.29 @@ -121,8 +122,10 @@
1.30
1.31 gettimeofday(&tva, NULL);
1.32
1.33 - float bgplanez = 1/MMIO_READF( PVR2, RENDER_FARCLIP );
1.34 - pvr2_render_prepare_context( buffer, bgplanez, 0 );
1.35 + float farz, nearz;
1.36 + pvr2_render_find_z_range( &nearz, &farz );
1.37 + float bgplanez = MMIO_READF( PVR2, RENDER_FARCLIP );
1.38 + pvr2_render_prepare_context( buffer, nearz, farz );
1.39
1.40 int clip_x = MMIO_READ( PVR2, RENDER_HCLIP ) & 0x03FF;
1.41 int clip_y = MMIO_READ( PVR2, RENDER_VCLIP ) & 0x03FF;
.