X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fstonerview-view.c;h=baf40e4179364497e1ba8260d0c15ec650e685aa;hb=d5186197bc394e10a4402f7f6d23fbb14103bc50;hp=08fc525e9a7e4a007f53dca57b4598307aa480c2;hpb=c1b9b55ad8d59dc05ef55e316aebf5863e7dfa56;p=xscreensaver diff --git a/hacks/glx/stonerview-view.c b/hacks/glx/stonerview-view.c index 08fc525e..baf40e41 100644 --- a/hacks/glx/stonerview-view.c +++ b/hacks/glx/stonerview-view.c @@ -19,6 +19,19 @@ # include "config.h" #endif +#ifdef HAVE_COCOA +# include "jwxyz.h" +#elif defined(HAVE_ANDROID) +# include +#else /* real Xlib */ +# include +# include +#endif /* !HAVE_COCOA */ + +#ifdef HAVE_JWZGLES +# include "jwzgles.h" +#endif /* HAVE_JWZGLES */ + #include #include "stonerview.h" @@ -27,14 +40,14 @@ static GLfloat view_scale = 4.0; stonerview_state * -init_view(int wireframe_p, int transparent_p) +stonerview_init_view(int wireframe_p, int transparent_p) { stonerview_state *st = (stonerview_state *) calloc (1, sizeof(*st)); st->wireframe = wireframe_p; st->transparent = transparent_p; st->num_els = NUM_ELS; - st->elist = (elem_t *) calloc (st->num_els, sizeof(*st->elist)); + st->elist = (stonerview_elem_t *) calloc (st->num_els, sizeof(*st->elist)); st->osctail = &st->oscroot; @@ -59,7 +72,8 @@ init_view(int wireframe_p, int transparent_p) } /* callback: draw everything */ -void win_draw(stonerview_state *st) +void +stonerview_win_draw(stonerview_state *st) { int ix; static const GLfloat white[] = { 1.0, 1.0, 1.0, 1.0 }; @@ -78,7 +92,7 @@ void win_draw(stonerview_state *st) glShadeModel(GL_FLAT); for (ix=0; ix < st->num_els; ix++) { - elem_t *el = &st->elist[ix]; + stonerview_elem_t *el = &st->elist[ix]; glNormal3f(0.0, 0.0, 1.0); @@ -94,7 +108,12 @@ void win_draw(stonerview_state *st) if (st->wireframe) continue; /* fill the square */ - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, el->col); + { + GLfloat col[4]; + col[0] = el->col[0]; col[1] = el->col[1]; + col[2] = el->col[2]; col[3] = el->col[3]; + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, col); + } glBegin(GL_QUADS); glVertex3f(el->pos[0]-el->vervec[0], el->pos[1]-el->vervec[1], el->pos[2]); glVertex3f(el->pos[0]+el->vervec[1], el->pos[1]-el->vervec[0], el->pos[2]); @@ -106,7 +125,8 @@ void win_draw(stonerview_state *st) glPopMatrix(); } -void win_release(stonerview_state *st) +void +stonerview_win_release(stonerview_state *st) { free (st->elist); /*free (st->oscroot); -- #### how do we free this? */