Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

GlDrawWandFunctors.h

Go to the documentation of this file.
00001 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00002  *
00003  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum, Christopher Just,
00007  *   Patrick Hartling, Kevin Meinert,
00008  *   Carolina Cruz-Neira, Albert Baker
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public
00021  * License along with this library; if not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  *
00025  * -----------------------------------------------------------------
00026  * File:          $RCSfile: GlDrawWandFunctors.h,v $
00027  * Date modified: $Date: 2004/03/19 04:00:55 $
00028  * Version:       $Revision: 1.6 $
00029  * -----------------------------------------------------------------
00030  *
00031  *************** <auto-copyright.pl END do not edit this line> ***************/
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 } // End of vrj namespace
00157 
00158 #endif

Generated on Sun May 2 15:10:17 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002