fshake3d
0.0.1
FreeformDensity3DSurfaceEditor
|
00001 #ifndef PLX_OPENGL_HPP 00002 #define PLX_OPENGL_HPP 00003 00004 /* 00005 TODO: remove glut from opengl.hpp 00006 DEPENDS: ui glut-coded event code to abstract ui code 00007 00008 #ifdef WIN32 00009 #include <windows.h> 00010 #include <GL/gl.h> 00011 #include <GL/glu.h> 00012 #endif 00013 */ 00014 00015 #ifdef WIN32 00016 #include <windows.h> 00017 #include <GL/gl.h> 00018 #include <GL/glu.h> 00019 #include <GL/glut.h> 00020 #include <stdlib.h> 00021 #elif defined(__APPLE__) 00022 #include <OpenGL/gl.h> 00023 #include <GLUT/glut.h> 00024 #endif 00025 00026 #include "math.hpp" 00027 00028 00029 inline void drawSolid(const AABoxd& aabox) 00030 { 00031 // TODO: remove with OpenGL code to release glut dependency 00032 glMatrixMode(GL_MODELVIEW); 00033 glPushMatrix(); 00034 Point3d cp = center(aabox); 00035 glTranslated(cp[0],cp[1],cp[2]); 00036 Vec3d s = size(aabox); 00037 glScaled( s[0], s[1], s[2] ); 00038 glutSolidCube(1.0); 00039 glPopMatrix(); 00040 } 00041 00042 inline void drawWire(const AABoxd& aabox) 00043 { 00044 // TODO: remove with OpenGL code to release glut dependency 00045 glMatrixMode(GL_MODELVIEW); 00046 glPushMatrix(); 00047 Point3d cp = center(aabox); 00048 glTranslated(cp[0],cp[1],cp[2]); 00049 Vec3d s = size(aabox); 00050 glScaled( s[0], s[1], s[2] ); 00051 glutWireCube(1.0); 00052 glPopMatrix(); 00053 } 00054 00055 inline void gl_set_color(const Vec3d& c) { glColor3d(c[0],c[1],c[2]); } 00056 inline void gl_set_color(const Vec4d& c) { glColor4d(c[0],c[1],c[2],c[3]); } 00057 00058 00059 #endif // PLX_OPENGL_HPP