From: slack Date: Thu, 16 Oct 2008 01:17:25 +0000 (+0200) Subject: Moved some sceGu* calls from game.cc to GFX X-Git-Url: http://slack.codemaniacs.com/git/?a=commitdiff_plain;h=0dd59866fa6c2a111494330ea2f49dc13ad56569;p=laz0r.git Moved some sceGu* calls from game.cc to GFX --- diff --git a/game.cc b/game.cc index 07365fa..2ee5c43 100644 --- a/game.cc +++ b/game.cc @@ -32,10 +32,8 @@ int game_main(int argc, char **argv) int i=0; while(1) { + GFX.begin_frame(); i++; - sceGuStart(GU_DIRECT, GFX.display_list); - sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT); - sceGumLoadIdentity(); sceGumRotateX(0.001f*i); sceGumRotateY(0.001f*i); @@ -46,12 +44,7 @@ int game_main(int argc, char **argv) cube.num_faces*3, cube.indices, cube.vertices); - - sceGuFinish(); - sceGuSync(0,0); - - GFX.update_fps(); - GFX.swap_buffers(); + GFX.end_frame(); } GFX.cleanup(); diff --git a/gfx.cc b/gfx.cc index b562585..5bcf1bd 100644 --- a/gfx.cc +++ b/gfx.cc @@ -94,6 +94,21 @@ void Gfx::swap_buffers() fbp0=sceGuSwapBuffers(); } +void Gfx::begin_frame() +{ + sceGuStart(GU_DIRECT, GFX.display_list); + sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT); +} + +void Gfx::end_frame() +{ + sceGuFinish(); + sceGuSync(0,0); + + update_fps(); + swap_buffers(); +} + void Gfx::perspective(float fov, float aspect, float znear, float zfar) { // setup projection matrix diff --git a/gfx.h b/gfx.h index 00d5848..e13ace8 100644 --- a/gfx.h +++ b/gfx.h @@ -25,6 +25,9 @@ class Gfx: public Singleton void update_fps(); void swap_buffers(); + + void begin_frame(); + void end_frame(); // Camera controls; void perspective(float fov, float aspect, float znear, float zfar);