From eb520bbea7ec25409aaf9b2590019c6d0ec5b4a4 Mon Sep 17 00:00:00 2001 From: Wilrik de Loose Date: Fri, 11 Jan 2008 01:46:45 +0000 Subject: streamtubes met colormap --- Smoke/Week 2.suo | Bin 78848 -> 87552 bytes Smoke/renderer_gl.c | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Smoke/Week 2.suo b/Smoke/Week 2.suo index f751865..2d2341b 100644 Binary files a/Smoke/Week 2.suo and b/Smoke/Week 2.suo differ 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; } } -- cgit v0.12