summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2007-12-19 22:04:46 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2007-12-19 22:04:46 (GMT)
commit439ce6999dde25e7b1bd4655c9e2ccff4954f887 (patch)
tree04fe652185ba98ce050bfb4d3bf8cd6d8b405f3f
parent5f1fc7b0711f51dd05077303f854c658ccd9dcba (diff)
download2iv35-439ce6999dde25e7b1bd4655c9e2ccff4954f887.zip
2iv35-439ce6999dde25e7b1bd4655c9e2ccff4954f887.tar.gz
2iv35-439ce6999dde25e7b1bd4655c9e2ccff4954f887.tar.bz2
moved opengl init to renderer
-rw-r--r--Smoke/fluids.c18
-rw-r--r--Smoke/gtk.c8
-rw-r--r--Smoke/renderer_gl.c22
-rw-r--r--Smoke/renderer_gl.h2
-rwxr-xr-xSmoke/smoke.binbin615438 -> 615462 bytes
5 files changed, 30 insertions, 20 deletions
diff --git a/Smoke/fluids.c b/Smoke/fluids.c
index 3b3f8fe..fb7d65d 100644
--- a/Smoke/fluids.c
+++ b/Smoke/fluids.c
@@ -60,8 +60,6 @@ float z_rot = 0.0f;
// for compatibility with the FFTW numerical library.
void init_simulation(int n)
{
- float LightAmbient[] = { 0.25f, 0.25f, 0.25f, 1.0f }; // Ambient light values
- float LightPosition[] = { 0.0f, 0.0f, -700.0f, 1.0f }; // Position of the light source
int i; size_t dim;
dim = n * 2*(n/2+1)*sizeof(fftw_real); //Allocate data structures
@@ -87,22 +85,6 @@ void init_simulation(int n)
for (i = 0; i < n * n; i++) //Initialize data structures to 0
{ vx[i] = vy[i] = vx0[i] = vy0[i] = fx[i] = fy[i] = rho[i] = rho0[i] = height_array[i] = 0.0f; }
-
- glShadeModel(GL_SMOOTH); // Enable smooth shading
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black background
- glClearDepth(1.0f); // Depth buffer setup
- glDepthFunc(GL_LESS); // The type of depth testing to do
- glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really nice perspective calculations
- glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); // Really nice point smoothing
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- glEnable(GL_DEPTH_TEST);
- //glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_COLOR_MATERIAL);
-
- glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
- glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);
}
int rescale_to_winwidth(float value)
diff --git a/Smoke/gtk.c b/Smoke/gtk.c
index 51016dd..df9a6ee 100644
--- a/Smoke/gtk.c
+++ b/Smoke/gtk.c
@@ -51,14 +51,15 @@
#include "palette.h"
#include "renderer_gl.h"
+#include "gtk_main.h"
#include "gtk_colormap.h"
#include "gtk_glyphs.h"
#include "gtk_divergence.h"
#include "gtk_isolines.h"
#include "gtk_heightplots.h"
#include "gtk_streamlines.h"
+#include "gtk_flowvis.h"
-#include "gtk_main.h"
/**************************************************************************
* The following section contains all the macro definitions.
@@ -841,6 +842,9 @@ main (int argc,
struct color4f colormap;
float value;
+ /* Initialize the simulation */
+ init_simulation(DIM);
+
/* Initialize GTK. */
gtk_init (&argc, &argv);
@@ -854,7 +858,7 @@ main (int argc,
window = create_window (glconfig);
gtk_widget_show (window);
- init_simulation(DIM);
+ init_gl();
gtk_main();
diff --git a/Smoke/renderer_gl.c b/Smoke/renderer_gl.c
index 2e56b04..a0c1ef5 100644
--- a/Smoke/renderer_gl.c
+++ b/Smoke/renderer_gl.c
@@ -471,6 +471,28 @@ static void render_streamlines(void)
}
}
+void init_gl(void)
+{
+ float LightAmbient[] = { 0.25f, 0.25f, 0.25f, 1.0f }; // Ambient light values
+ float LightPosition[] = { 0.0f, 0.0f, -700.0f, 1.0f }; // Position of the light source
+
+ glShadeModel(GL_SMOOTH); // Enable smooth shading
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black background
+ glClearDepth(1.0f); // Depth buffer setup
+ glDepthFunc(GL_LESS); // The type of depth testing to do
+ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really nice perspective calculations
+ glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); // Really nice point smoothing
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glEnable(GL_DEPTH_TEST);
+ //glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+ glEnable(GL_COLOR_MATERIAL);
+
+ glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
+ glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);
+}
+
void zoom_in(int zoom)
{
diff --git a/Smoke/renderer_gl.h b/Smoke/renderer_gl.h
index f082170..000ecb1 100644
--- a/Smoke/renderer_gl.h
+++ b/Smoke/renderer_gl.h
@@ -1,6 +1,8 @@
#ifndef _RENDERER_GL_H
#define _RENDERER_GL_H
+void init_gl(void);
+
void visualize(void);
void zoom_in(int zoom);
diff --git a/Smoke/smoke.bin b/Smoke/smoke.bin
index 02062ff..5cbb38f 100755
--- a/Smoke/smoke.bin
+++ b/Smoke/smoke.bin
Binary files differ