1 /* xscreensaver, Copyright (c) 1998-2014 Jamie Zawinski <jwz@jwz.org>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
15 renderList (const struct gllist *list, int wire_p)
19 if (!wire_p || list->primitive == GL_LINES ||
20 list->primitive == GL_POINTS)
22 glInterleavedArrays (list->format, 0, list->data);
23 glDrawArrays (list->primitive, 0, list->points);
27 /* For wireframe, do it the hard way: treat every tuple of
28 points as its own line loop.
30 const GLfloat *p = (GLfloat *) list->data;
31 int i, j, tick, skip, stride;
33 switch (list->primitive) {
34 case GL_QUADS: tick = 4; break;
35 case GL_TRIANGLES: tick = 3; break;
36 default: abort(); break; /* write me */
39 switch (list->format) {
40 case GL_C3F_V3F: case GL_N3F_V3F: skip = 3; stride = 6; break;
41 default: abort(); break; /* write me */
44 glBegin (GL_LINE_LOOP);
52 glBegin (GL_LINE_LOOP);
54 glVertex3f (p[j], p[j+1], p[j+2]);
64 renderListNormals (const struct gllist *list, GLfloat length, int faces_p)
68 const GLfloat *p = (GLfloat *) list->data;
69 int i, j, tick, skip, stride;
72 if (list->primitive == GL_LINES) continue;
77 switch (list->primitive) {
78 case GL_QUADS: tick = 4; break;
79 case GL_TRIANGLES: tick = 3; break;
80 default: abort(); break; /* write me */
83 switch (list->format) {
84 case GL_N3F_V3F: skip = 0; stride = 6; break;
85 case GL_C3F_V3F: continue; break;
86 default: abort(); break; /* write me */
89 v[0] = v[1] = v[2] = 0;
90 n[0] = n[1] = n[2] = 0;
105 glTranslatef (v[0], v[1], v[2]);
106 glScalef (length, length, length);
108 glVertex3f (0, 0, 0);
109 glVertex3f (n[0], n[1], n[2]);
112 v[0] = v[1] = v[2] = 0;
113 n[0] = n[1] = n[2] = 0;
116 if (i == list->points) break;