X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Ftube.c;h=b0e29e687d600dd16eab1b6a5b5da699715ccbf0;hb=f8cf5ac7b2f53510f80a0eaf286a25298be17bfe;hp=a21682501fb63f0a86fcda4c14c6e826a122f421;hpb=50be9bb40dc60130c99ffa568e6677779904ff70;p=xscreensaver diff --git a/hacks/glx/tube.c b/hacks/glx/tube.c index a2168250..b0e29e68 100644 --- a/hacks/glx/tube.c +++ b/hacks/glx/tube.c @@ -1,4 +1,4 @@ -/* tube, Copyright (c) 2001-2010 Jamie Zawinski +/* tube, Copyright (c) 2001-2012 Jamie Zawinski * Utility functions to create tubes and cones in GL. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -18,16 +18,19 @@ #include -#ifdef HAVE_COCOA -# include -#else +#ifndef HAVE_COCOA # include #endif +#ifdef HAVE_JWZGLES +# include "jwzgles.h" +#endif /* HAVE_JWZGLES */ + #include "tube.h" typedef struct { GLfloat x, y, z; } XYZ; + static int unit_tube (int faces, int smooth, int caps_p, int wire_p) { @@ -132,6 +135,7 @@ unit_tube (int faces, int smooth, int caps_p, int wire_p) glNormalPointer ( GL_FLOAT, sizeof(*array), &array[0].n); glTexCoordPointer (2, GL_FLOAT, sizeof(*array), &array[0].s); + glFrontFace(GL_CCW); glDrawArrays ((wire_p ? GL_LINES : (smooth ? GL_TRIANGLE_STRIP : GL_TRIANGLES)), 0, out); @@ -178,9 +182,12 @@ unit_tube (int faces, int smooth, int caps_p, int wire_p) glNormalPointer ( GL_FLOAT, sizeof(*array), &array[0].n); glTexCoordPointer (2, GL_FLOAT, sizeof(*array), &array[0].s); + glFrontFace(GL_CCW); glDrawArrays ((wire_p ? GL_LINE_LOOP : GL_TRIANGLE_FAN), 0, out); } + free(array); + return polys; } @@ -272,6 +279,7 @@ unit_cone (int faces, int smooth, int cap_p, int wire_p) glNormalPointer ( GL_FLOAT, sizeof(*array), &array[0].n); glTexCoordPointer (2, GL_FLOAT, sizeof(*array), &array[0].s); + glFrontFace(GL_CCW); glDrawArrays ((wire_p ? GL_LINES : GL_TRIANGLES), 0, out); @@ -312,6 +320,7 @@ unit_cone (int faces, int smooth, int cap_p, int wire_p) glNormalPointer ( GL_FLOAT, sizeof(*array), &array[0].n); glTexCoordPointer (2, GL_FLOAT, sizeof(*array), &array[0].s); + glFrontFace(GL_CCW); glDrawArrays ((wire_p ? GL_LINE_LOOP : GL_TRIANGLE_FAN), 0, out); }