[5502] | 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 | |
---|
| 18 | using std::string; |
---|
| 19 | |
---|
[5598] | 20 | HeightQuantity::HeightQuantity(const string &name, |
---|
[5502] | 21 | GLdouble offset, GLdouble scale, |
---|
| 22 | GLfloat red, GLfloat green, GLfloat blue): |
---|
| 23 | offset(offset), scale(scale), red(red), green(green), blue(blue), name(name), |
---|
[5598] | 24 | frame_number(-1){ |
---|
[5502] | 25 | GLenum glerror; |
---|
| 26 | this->display_list = glGenLists(1); |
---|
| 27 | if((glerror = glGetError()) != GL_NO_ERROR) throw gluErrorString(glerror); |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | HeightQuantity::~HeightQuantity(void){ |
---|
| 31 | if(glIsList(this->display_list) == GL_TRUE) |
---|
| 32 | glDeleteLists(this->display_list, 1); |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | void HeightQuantity::draw(int frame){ |
---|
| 36 | if(!this->dynamic) frame = 0; |
---|
| 37 | if(this->frame_number != frame) this->compile(frame); |
---|
| 38 | this->frame_number = frame; |
---|
| 39 | glPushMatrix(); |
---|
| 40 | glScalef(1, 1, this->scale); |
---|
| 41 | glTranslatef(0, 0, this->offset); |
---|
| 42 | glColor3f(this->red, this->green, this->blue); |
---|
| 43 | glCallList(this->display_list); |
---|
| 44 | glPopMatrix(); |
---|
| 45 | } |
---|
| 46 | |
---|
[5598] | 47 | const string &HeightQuantity::get_name(void){ |
---|
| 48 | return this->name; |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | void HeightQuantity::set_dynamic(bool dynamic){ |
---|
| 52 | this->dynamic = dynamic; |
---|
| 53 | } |
---|
| 54 | |
---|
[5502] | 55 | void HeightQuantity::compile(int frame){ |
---|
| 56 | |
---|
| 57 | } |
---|