From 99da5c825b217e1341fb3b3440ad7d4b76a06bfe Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 20 Aug 2014 13:54:54 +1000 Subject: [PATCH] Update gl3d spin demo --- .../modules/gwin/{gl3d => gl3d-spin}/demo.mk | 2 +- .../gwin/{gl3d => gl3d-spin}/gfxconf.h | 0 demos/modules/gwin/{gl3d => gl3d-spin}/main.c | 20 ++++++------------- 3 files changed, 7 insertions(+), 15 deletions(-) rename demos/modules/gwin/{gl3d => gl3d-spin}/demo.mk (51%) rename demos/modules/gwin/{gl3d => gl3d-spin}/gfxconf.h (100%) rename demos/modules/gwin/{gl3d => gl3d-spin}/main.c (90%) diff --git a/demos/modules/gwin/gl3d/demo.mk b/demos/modules/gwin/gl3d-spin/demo.mk similarity index 51% rename from demos/modules/gwin/gl3d/demo.mk rename to demos/modules/gwin/gl3d-spin/demo.mk index 2f20deb6..bed1ab31 100644 --- a/demos/modules/gwin/gl3d/demo.mk +++ b/demos/modules/gwin/gl3d-spin/demo.mk @@ -1,3 +1,3 @@ -DEMODIR = $(GFXLIB)/demos/modules/gwin/gl3d +DEMODIR = $(GFXLIB)/demos/modules/gwin/gl3d-spin GFXINC += $(DEMODIR) GFXSRC += $(DEMODIR)/main.c diff --git a/demos/modules/gwin/gl3d/gfxconf.h b/demos/modules/gwin/gl3d-spin/gfxconf.h similarity index 100% rename from demos/modules/gwin/gl3d/gfxconf.h rename to demos/modules/gwin/gl3d-spin/gfxconf.h diff --git a/demos/modules/gwin/gl3d/main.c b/demos/modules/gwin/gl3d-spin/main.c similarity index 90% rename from demos/modules/gwin/gl3d/main.c rename to demos/modules/gwin/gl3d-spin/main.c index f93f37ec..4a8b25e6 100644 --- a/demos/modules/gwin/gl3d/main.c +++ b/demos/modules/gwin/gl3d-spin/main.c @@ -29,7 +29,7 @@ #include "gfx.h" -/* The handles for our two Windows */ +/* The handle for our Window */ GHandle gh; static GLfloat Xrot, Xstep; @@ -107,7 +107,7 @@ static void draw( void ) } -static void idle( void ) +static void spin( void ) { Xrot += Xstep; Yrot += Ystep; @@ -138,19 +138,11 @@ int main(void) { GWindowInit wi; gwinClearInit(&wi); - wi.show = TRUE; wi.x = 20; wi.y = 10; wi.width = 200; wi.height = 150; + wi.show = TRUE; wi.x = 8; wi.y = 8; wi.width = gdispGetWidth()-16; wi.height = gdispGetHeight()-16; gh = gwinGL3DCreate(0, &wi); } - /* Set fore- and background colors */ - gwinSetColor(gh, White); - gwinSetBgColor(gh, Blue); - - /* Clear the window */ - gwinClear(gh); - /* Init the 3D stuff */ - glViewport(0, 0, (GLint)gwinGetWidth(gh), (GLint)gwinGetHeight(gh)); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 ); @@ -158,10 +150,10 @@ int main(void) { Object = make_object(); glCullFace( GL_BACK ); - // glEnable( GL_CULL_FACE ); + //glEnable( GL_CULL_FACE ); glDisable( GL_DITHER ); glShadeModel( GL_FLAT ); - // glEnable( GL_DEPTH_TEST ); + //glEnable( GL_DEPTH_TEST ); Xrot = Yrot = Zrot = 0.0; Xstep = Step; Ystep = Zstep = 0.0; @@ -173,7 +165,7 @@ int main(void) { gfxSleepMilliseconds(10); // move and redraw - idle(); + spin(); } }