Update gl3d spin demo

This commit is contained in:
inmarket 2014-08-20 13:54:54 +10:00
parent e4880b7269
commit 99da5c825b
3 changed files with 7 additions and 15 deletions

View File

@ -1,3 +1,3 @@
DEMODIR = $(GFXLIB)/demos/modules/gwin/gl3d DEMODIR = $(GFXLIB)/demos/modules/gwin/gl3d-spin
GFXINC += $(DEMODIR) GFXINC += $(DEMODIR)
GFXSRC += $(DEMODIR)/main.c GFXSRC += $(DEMODIR)/main.c

View File

@ -29,7 +29,7 @@
#include "gfx.h" #include "gfx.h"
/* The handles for our two Windows */ /* The handle for our Window */
GHandle gh; GHandle gh;
static GLfloat Xrot, Xstep; static GLfloat Xrot, Xstep;
@ -107,7 +107,7 @@ static void draw( void )
} }
static void idle( void ) static void spin( void )
{ {
Xrot += Xstep; Xrot += Xstep;
Yrot += Ystep; Yrot += Ystep;
@ -138,19 +138,11 @@ int main(void) {
GWindowInit wi; GWindowInit wi;
gwinClearInit(&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); gh = gwinGL3DCreate(0, &wi);
} }
/* Set fore- and background colors */
gwinSetColor(gh, White);
gwinSetBgColor(gh, Blue);
/* Clear the window */
gwinClear(gh);
/* Init the 3D stuff */ /* Init the 3D stuff */
glViewport(0, 0, (GLint)gwinGetWidth(gh), (GLint)gwinGetHeight(gh));
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 ); glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
@ -173,7 +165,7 @@ int main(void) {
gfxSleepMilliseconds(10); gfxSleepMilliseconds(10);
// move and redraw // move and redraw
idle(); spin();
} }
} }