diff options
Diffstat (limited to 'Smoke')
-rw-r--r-- | Smoke/Week 2.suo | bin | 78848 -> 87552 bytes | |||
-rw-r--r-- | Smoke/renderer_gl.c | 48 |
2 files changed, 24 insertions, 24 deletions
diff --git a/Smoke/Week 2.suo b/Smoke/Week 2.suo Binary files differindex f751865..2d2341b 100644 --- a/Smoke/Week 2.suo +++ b/Smoke/Week 2.suo diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c index e0df386..67ebc55 100644 --- a/Smoke/renderer_gl.c +++ b/Smoke/renderer_gl.c @@ -765,28 +765,13 @@ static void render_streamlines(void) struct fftw_real_xy *frame_history; fftw_real cell_x, cell_y; float scale = 10.0f;
- GLuint lid = glGenLists(1);
GLUquadricObj *qobj = gluNewQuadric();
+ struct color4f color;
gluQuadricDrawStyle(qobj, GLU_FILL);
gluQuadricNormals(qobj, GLU_FLAT);
gluQuadricOrientation(qobj, GLU_OUTSIDE);
- glDisable(GL_BLEND);
-
- if (streamlines_get_sort() == STREAMLINES_SORT_TUBES)
- {
- glNewList(lid, GL_COMPILE);
- gluCylinder(qobj, 6.0, 6.0, 16.0, 8, 8);
- glEndList(); - } - else if (streamlines_get_sort() == STREAMLINES_SORT_SPHERES)
- {
- glNewList(lid, GL_COMPILE);
- gluSphere(qobj, 10.0f, 8, 8);
- glEndList(); - } - glLineWidth(2.5f); i = j = k = l = 0; @@ -818,14 +803,29 @@ static void render_streamlines(void) p.x += vx * cell_x * scale; p.y += vy * cell_y * scale; - if (streamlines_get_sort() == STREAMLINES_SORT_LINES) { - glVertex3f(p.x, p.y, j * cell_x); - } - else { - glPushMatrix();
- glTranslatef(p.x, p.y, j * cell_x);
- glCallList(lid);
- glPopMatrix(); + color = streamlines_get_color(vec_len2f(vx, vy) * 25); + glColor4f(color.r, color.g, color.b, color.a); + + switch (streamlines_get_sort()) + { + default: + case STREAMLINES_SORT_LINES: + glVertex3f(p.x, p.y, j * cell_x); + break; + + case STREAMLINES_SORT_TUBES: + glPushMatrix();
+ glTranslatef(p.x, p.y, j * cell_x);
+ gluCylinder(qobj, 8.0, 8.0, 16.0, 8, 8);
+ glPopMatrix(); + break; + + case STREAMLINES_SORT_SPHERES: + glPushMatrix();
+ glTranslatef(p.x, p.y, j * cell_x);
+ gluSphere(qobj, 10.0f, 8, 8);
+ glPopMatrix(); + break; } } |