summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilrik de Loose <wilrik@wilrik.nl>2008-01-11 01:46:45 (GMT)
committerWilrik de Loose <wilrik@wilrik.nl>2008-01-11 01:46:45 (GMT)
commiteb520bbea7ec25409aaf9b2590019c6d0ec5b4a4 (patch)
treeeff39b0177f917d874650ba7e7f6efa17f182606
parent9345d3090eea8d48bdedd60e382d66f7ce398b89 (diff)
download2iv35-eb520bbea7ec25409aaf9b2590019c6d0ec5b4a4.zip
2iv35-eb520bbea7ec25409aaf9b2590019c6d0ec5b4a4.tar.gz
2iv35-eb520bbea7ec25409aaf9b2590019c6d0ec5b4a4.tar.bz2
streamtubes met colormap
-rw-r--r--Smoke/Week 2.suobin78848 -> 87552 bytes
-rw-r--r--Smoke/renderer_gl.c48
2 files changed, 24 insertions, 24 deletions
diff --git a/Smoke/Week 2.suo b/Smoke/Week 2.suo
index f751865..2d2341b 100644
--- a/Smoke/Week 2.suo
+++ b/Smoke/Week 2.suo
Binary files 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;
}
}