00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef GL_DRAW_WAND_FUNCTORS_H
00034 #define GL_DRAW_WAND_FUNCTORS_H
00035
00036 #ifdef VPR_OS_Darwin
00037 # include <OpenGL/gl.h>
00038 # include <OpenGL/glu.h>
00039 #else
00040 # include <GL/gl.h>
00041 # include <GL/glu.h>
00042 #endif
00043
00044
00045 namespace vrj
00046 {
00047
00049 class GlDrawConeWandFunctor : public GlDrawObjectFunctor
00050 {
00051 public:
00053 virtual void contextInit()
00054 {;}
00055
00060 virtual void draw()
00061 {
00062 const float base = 0.2f;
00063 const float height = 0.6f;
00064 const int slices = 6;
00065 const int stacks = 1;
00066
00067 if (mQuadObj == NULL)
00068 {
00069 mQuadObj = gluNewQuadric();
00070 }
00071
00072 glColor3f(0.0f, 1.0f, 0.0f);
00073 gluQuadricDrawStyle(mQuadObj, (GLenum) GLU_FILL);
00074 gluQuadricNormals(mQuadObj, (GLenum) GLU_SMOOTH);
00075 gluCylinder(mQuadObj, base, 0.0, height, slices, stacks);
00076 }
00077
00078 protected:
00079 GLUquadricObj* mQuadObj;
00080 };
00081
00082
00084 class GlDrawRightAngleWandFunctor : public GlDrawObjectFunctor
00085 {
00086 public:
00088 virtual void contextInit()
00089 {;}
00090
00095 virtual void draw()
00096 {
00097 static GLfloat VertexData[] = {
00098 0.0140000f, -0.140000f, 0.0140000f, 0.0140000f, 0.028000f, 0.0140000f, -0.0140000f, 0.028000f, 0.0140000f,
00099 -0.0140000f, -0.140000f, 0.0140000f, 0.0140000f, -0.140000f, -0.0140000f,
00100 0.0140000f, 0.00000f, -0.0140000f, 0.0140000f, 0.028000f, 0.0140000f,
00101 0.0140000f, -0.140000f, 0.0140000f, -0.0140000f, -0.140000f, -0.0140000f,
00102 -0.0140000f, 0.00000f, -0.0140000f, 0.0140000f, 0.00000f, -0.0140000f,
00103 0.0140000f, -0.140000f, -0.0140000f, -0.0140000f, -0.140000f, 0.0140000f,
00104 -0.0140000f, 0.028000f, 0.0140000f, -0.0140000f, 0.00000f, -0.0140000f,
00105 -0.0140000f, -0.140000f, -0.0140000f, -0.0140000f, -0.140000f, -0.0140000f,
00106 0.0140000f, -0.140000f, -0.0140000f, 0.0140000f, -0.140000f, 0.0140000f,
00107 -0.0140000f, -0.140000f, 0.0140000f, -0.0140000f, 0.028000f, 0.0140000f,
00108 0.0140000f, 0.028000f, 0.0140000f, 0.028000f, 0.056000f, -0.042000f,
00109 -0.028000f, 0.056000f, -0.042000f, 0.028000f, 0.042000f, -0.042000f,
00110 -0.028000f, 0.042000f, -0.042000f, -0.028000f, 0.056000f, -0.042000f,
00111 0.028000f, 0.056000f, -0.042000f, 0.0140000f, 0.028000f, 0.0140000f,
00112 0.0140000f, 0.00000f, -0.0140000f, 0.028000f, 0.042000f, -0.042000f,
00113 0.0140000f, 0.028000f, 0.0140000f, 0.028000f, 0.042000f, -0.042000f,
00114 0.028000f, 0.056000f, -0.042000f, -0.0140000f, 0.028000f, 0.0140000f,
00115 -0.028000f, 0.056000f, -0.042000f, -0.028000f, 0.042000f, -0.042000f,
00116 -0.028000f, 0.042000f, -0.042000f, -0.0140000f, 0.00000f, -0.0140000f,
00117 -0.0140000f, 0.028000f, 0.0140000f, 0.028000f, 0.042000f, -0.042000f,
00118 0.0140000f, 0.00000f, -0.0140000f, -0.0140000f, 0.00000f, -0.0140000f,
00119 -0.028000f, 0.042000f, -0.042000f
00120 };
00121 static GLint Indices[] = {
00122 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8,
00123 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21,
00124 22, 20, 22, 23, 24, 25, 26, 24, 26, 27, 28, 29, 30, 31, 32, 33,
00125 34, 35, 36, 37, 38, 39, 40, 41, 42, 40, 42, 43
00126 };
00127
00128 glEnableClientState(GL_VERTEX_ARRAY);
00129 glVertexPointer(3, GL_FLOAT, 0, VertexData);
00130
00131 glColor3f(0.00000f, 1.00000f, 0.00000f);
00132 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[0]);
00133 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[3]);
00134 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[6]);
00135 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[9]);
00136 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[12]);
00137 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[15]);
00138 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[18]);
00139 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[21]);
00140 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[24]);
00141 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[27]);
00142 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[30]);
00143 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[33]);
00144 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[36]);
00145 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[39]);
00146 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[42]);
00147 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[45]);
00148 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[48]);
00149 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[51]);
00150 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[54]);
00151 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &Indices[57]);
00152 }
00153
00154 };
00155
00156 }
00157
00158 #endif