source: anuga_work/development/anugavis/src/height_quantity.cc @ 5502

Last change on this file since 5502 was 5502, checked in by jack, 14 years ago

More work on height quantities.

File size: 1.4 KB
Line 
1#ifdef HAVE_CONFIG_H
2#  include "config.h"
3#endif
4
5#include <string>
6#ifdef HAVE_GL_GL_H
7#  include <GL/gl.h>
8#elif HAVE_OPENGL_GL_H
9#  include <OpenGL/gl.h>
10#endif
11#ifdef HAVE_GL_GLU_H
12#  include <GL/glu.h>
13#elif HAVE_OPENGL_GLU_H
14#  include <OpenGL/glu.h>
15#endif
16#include "height_quantity.hh"
17#include "sww_file.hh"
18
19using std::string;
20
21HeightQuantity::HeightQuantity(const SWWFile &sww, const string &name,
22                               GLdouble offset, GLdouble scale,
23                               GLfloat red, GLfloat green, GLfloat blue):
24  offset(offset), scale(scale), red(red), green(green), blue(blue), name(name),
25  frame_number(-1), sww(sww){
26  GLenum glerror;
27  this->dynamic = (sww.nc_inq_varndims_by_name(name) == 2);
28  this->display_list = glGenLists(1);
29  if((glerror = glGetError()) != GL_NO_ERROR) throw gluErrorString(glerror);
30 
31}
32
33HeightQuantity::~HeightQuantity(void){
34  if(glIsList(this->display_list) == GL_TRUE)
35    glDeleteLists(this->display_list, 1);
36}
37
38void HeightQuantity::draw(int frame){
39  if(!this->dynamic) frame = 0;
40  if(this->frame_number != frame) this->compile(frame);
41  this->frame_number = frame;
42  glPushMatrix();
43  glScalef(1, 1, this->scale);
44  glTranslatef(0, 0, this->offset);
45  glColor3f(this->red, this->green, this->blue);
46  glCallList(this->display_list);
47  glPopMatrix();
48}
49
50void HeightQuantity::compile(int frame){
51 
52}
Note: See TracBrowser for help on using the repository browser.