X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Ftangram_shapes.c;h=267b1873b3e154103790cb31ee4488a793ddbbf4;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=25dec5b21f5f3defd8b3ff8c09485988f0185adb;hpb=3f438031d610c7e15fd33876a879b97e290e05fb;p=xscreensaver diff --git a/hacks/glx/tangram_shapes.c b/hacks/glx/tangram_shapes.c index 25dec5b2..267b1873 100644 --- a/hacks/glx/tangram_shapes.c +++ b/hacks/glx/tangram_shapes.c @@ -9,7 +9,23 @@ * implied warranty. */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif /* HAVE_CONFIG_H */ + +#ifndef HAVE_JWXYZ +# include +#endif + +#ifdef HAVE_ANDROID +#include +#endif + +#ifdef HAVE_JWZGLES +# include "jwzgles.h" +#endif /* HAVE_JWZGLES */ + +#include "tangram_shapes.h" #define small_scale ( 1 ) #define large_scale ( 2 ) @@ -17,7 +33,8 @@ #define alpha (0.05) -static void tri_45_90(int wire) +static void +tri_45_90(int wire) { GLfloat vertices[][3] = { {0, alpha, 0}, @@ -32,45 +49,60 @@ static void tri_45_90(int wire) glNormal3f(0, 1, 0); glVertex3fv(vertices[0]); + glNormal3f(0, 1, 0); glVertex3fv(vertices[2]); + glNormal3f(0, 1, 0); glVertex3fv(vertices[1]); glNormal3f(0, -1, 0); glVertex3fv(vertices[3]); + glNormal3f(0, -1, 0); glVertex3fv(vertices[4]); + glNormal3f(0, -1, 0); glVertex3fv(vertices[5]); glEnd(); glBegin((wire) ? GL_LINE_LOOP : GL_QUADS); glNormal3f(1, 0, 1); glVertex3fv(vertices[2]); + glNormal3f(1, 0, 1); glVertex3fv(vertices[5]); + glNormal3f(1, 0, 1); glVertex3fv(vertices[4]); + glNormal3f(1, 0, 1); glVertex3fv(vertices[1]); glNormal3f(-1, 0, 0); glVertex3fv(vertices[0]); + glNormal3f(-1, 0, 0); glVertex3fv(vertices[1]); + glNormal3f(-1, 0, 0); glVertex3fv(vertices[4]); + glNormal3f(-1, 0, 0); glVertex3fv(vertices[3]); glNormal3f(0, 0, -1); - glVertex3fv(vertices[2]); - glVertex3fv(vertices[5]); - glVertex3fv(vertices[3]); glVertex3fv(vertices[0]); + glNormal3f(0, 0, -1); + glVertex3fv(vertices[3]); + glNormal3f(0, 0, -1); + glVertex3fv(vertices[5]); + glNormal3f(0, 0, -1); + glVertex3fv(vertices[2]); glEnd(); } -void unit_cube(int wire) +static void +unit_cube(int wire) { glBegin((wire) ? GL_LINE_LOOP : GL_QUADS); - glNormal3f(0.0f, -1.0f, 0.0f); - glVertex3f(0.0f, -alpha, 0.0f); - glVertex3f(1.0f, -alpha, 0.0f); - glVertex3f(1.0f, -alpha, 1.0f); - glVertex3f(0.0f, -alpha, 1.0f); + + glNormal3f(0.0f, 1.0f, 0.0f); + glVertex3f(0.0f, alpha, 0.0f); + glVertex3f(0.0f, alpha, 1.0f); + glVertex3f(1.0f, alpha, 1.0f); + glVertex3f(1.0f, alpha, 0.0f); glNormal3f(0.0f, 0.0f, 1.0f); glVertex3f(0.0f, -alpha, 1.0f); @@ -96,15 +128,17 @@ void unit_cube(int wire) glVertex3f(0.0f, alpha, 1.0f); glVertex3f(0.0f, alpha, 0.0f); - glNormal3f(0.0f, 1.0f, 0.0f); - glVertex3f(0.0f, alpha, 0.0f); - glVertex3f(0.0f, alpha, 1.0f); - glVertex3f(1.0f, alpha, 1.0f); - glVertex3f(1.0f, alpha, 0.0f); + glNormal3f(0.0f, -1.0f, 0.0f); + glVertex3f(0.0f, -alpha, 0.0f); + glVertex3f(1.0f, -alpha, 0.0f); + glVertex3f(1.0f, -alpha, 1.0f); + glVertex3f(0.0f, -alpha, 1.0f); + glEnd(); } -void unit_rhomboid(int wire) +static void +unit_rhomboid(int wire) { glBegin((wire) ? GL_LINE_LOOP : GL_QUADS); @@ -150,7 +184,8 @@ void unit_rhomboid(int wire) /* All of the pieces have the same thickness so all of the Y values are the same */ -GLuint get_sm_tri_dl(int wire) +GLuint +tangram_get_sm_tri_dl(int wire) { GLuint triangle = glGenLists(1); glNewList(triangle, GL_COMPILE); @@ -160,7 +195,8 @@ GLuint get_sm_tri_dl(int wire) return triangle; } -GLuint get_lg_tri_dl(int wire) +GLuint +tangram_get_lg_tri_dl(int wire) { GLuint triangle = glGenLists(1); glNewList(triangle, GL_COMPILE); @@ -170,7 +206,8 @@ GLuint get_lg_tri_dl(int wire) return triangle; } -GLuint get_md_tri_dl(int wire) +GLuint +tangram_get_md_tri_dl(int wire) { GLuint triangle = glGenLists(1); glNewList(triangle, GL_COMPILE); @@ -180,7 +217,8 @@ GLuint get_md_tri_dl(int wire) return triangle; } -GLuint get_square_dl(int wire) +GLuint +tangram_get_square_dl(int wire) { GLuint square = glGenLists(1); glNewList(square, GL_COMPILE); @@ -190,7 +228,8 @@ GLuint get_square_dl(int wire) return square; } -GLuint get_rhomboid_dl(int wire) +GLuint +tangram_get_rhomboid_dl(int wire) { GLuint rhomboid = glGenLists(1); glNewList(rhomboid, GL_COMPILE);