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)
21 glInterleavedArrays (list->format, 0, list->data);
22 glDrawArrays (list->primitive, 0, list->points);
26 /* For wireframe, do it the hard way: treat every tuple of
27 points as its own line loop.
29 const GLfloat *p = (GLfloat *) list->data;
30 int i, j, tick, skip, stride;
32 switch (list->primitive) {
33 case GL_QUADS: tick = 4; break;
34 case GL_TRIANGLES: tick = 3; break;
35 default: abort(); break; /* write me */
38 switch (list->format) {
39 case GL_C3F_V3F: case GL_N3F_V3F: skip = 3; stride = 6; break;
40 default: abort(); break; /* write me */
43 glBegin (GL_LINE_LOOP);
51 glBegin (GL_LINE_LOOP);
53 glVertex3f (p[j], p[j+1], p[j+2]);
63 renderListNormals (const struct gllist *list, GLfloat length, int faces_p)
67 const GLfloat *p = (GLfloat *) list->data;
68 int i, j, tick, skip, stride;
71 if (list->primitive == GL_LINES) continue;
76 switch (list->primitive) {
77 case GL_QUADS: tick = 4; break;
78 case GL_TRIANGLES: tick = 3; break;
79 default: abort(); break; /* write me */
82 switch (list->format) {
83 case GL_N3F_V3F: skip = 0; stride = 6; break;
84 case GL_C3F_V3F: continue; break;
85 default: abort(); break; /* write me */
88 v[0] = v[1] = v[2] = 0;
89 n[0] = n[1] = n[2] = 0;
104 glTranslatef (v[0], v[1], v[2]);
105 glScalef (length, length, length);
107 glVertex3f (0, 0, 0);
108 glVertex3f (n[0], n[1], n[2]);
111 v[0] = v[1] = v[2] = 0;
112 n[0] = n[1] = n[2] = 0;
115 if (i == list->points) break;