basic/opengl/GL_Frame.cpp

Go to the documentation of this file.
00001 //## begin module%3731DD4E010E.cm preserve=no
00002 //        %X% %Q% %Z% %W%
00003 //## end module%3731DD4E010E.cm
00004 
00005 //## begin module%3731DD4E010E.cp preserve=no
00006 //## end module%3731DD4E010E.cp
00007 
00008 //## Module: GL_Frame%3731DD4E010E; Pseudo Package body
00009 //## Source file: E:\mpk\code\OpenGL\GL_Frame.cpp
00010 
00011 //## begin module%3731DD4E010E.additionalIncludes preserve=no
00012 //## end module%3731DD4E010E.additionalIncludes
00013 
00014 //## begin module%3731DD4E010E.includes preserve=yes
00015 #include "glos.h"
00016 #include <gl\gl.h>
00017 #include <assert.h>
00018 //## end module%3731DD4E010E.includes
00019 
00020 // GL_Frame
00021 #include "OpenGL\GL_Frame.h"
00022 //## begin module%3731DD4E010E.additionalDeclarations preserve=yes
00023 //## end module%3731DD4E010E.additionalDeclarations
00024 
00025 
00026 // Class GL_Frame 
00027 
00028 
00029 GL_Frame::GL_Frame (Matrix4x4 right, bool bShow)
00030   //## begin GL_Frame::GL_Frame%926014531.hasinit preserve=no
00031       : axisLength(3.0)
00032   //## end GL_Frame::GL_Frame%926014531.hasinit
00033   //## begin GL_Frame::GL_Frame%926014531.initialization preserve=yes
00034   ,Matrix4x4( right )
00035   ,showFrame(bShow)
00036   //## end GL_Frame::GL_Frame%926014531.initialization
00037 {
00038   //## begin GL_Frame::GL_Frame%926014531.body preserve=yes
00039   //## end GL_Frame::GL_Frame%926014531.body
00040 }
00041 
00042 
00043 GL_Frame::~GL_Frame()
00044 {
00045   //## begin GL_Frame::~GL_Frame%.body preserve=yes
00046   //## end GL_Frame::~GL_Frame%.body
00047 }
00048 
00049 
00050 
00051 //## Other Operations (implementation)
00052 void GL_Frame::GLDraw () const
00053 {
00054         //## begin GL_Frame::GLDraw%926014530.body preserve=yes
00055 
00056         ::glLineWidth( 3.0 );
00057 
00058         double numbers[ 16 ] ;
00059         for( int i = 0; i < 16; i++ ) 
00060         {
00061                 numbers[ i ] = values[ i % 4 ][ i / 4 ] ;               //IMPROVE: all this assigning could be slow
00062         }
00063         glMultMatrixd( numbers ) ;
00064 
00065         unsigned char lighting ;
00066         unsigned char blend ;
00067         
00068         glGetBooleanv( GL_LIGHTING, &lighting ) ;
00069         glGetBooleanv( GL_BLEND, &blend ) ;
00070 
00071         glDisable( GL_LIGHTING ) ;
00072         //glDisable( GL_BLEND ) ;
00073 
00074         if (showFrame)
00075         {
00076                 const float alpha = float( 0.3 ) ;
00077                 glBegin( GL_LINES ) ;
00078                         glColor4d( 1.0, 0.0, 0.0, alpha ) ;
00079                         glVertex3d( 0.0, 0.0, 0.0) ;
00080                         glVertex3d( axisLength, 0.0, 0.0 ) ;
00081 
00082                         glColor4d( 0.0, 1.0, 0.0, alpha ) ;
00083                         glVertex3d( 0.0, 0.0, 0.0) ;
00084                         glVertex3d( 0.0, axisLength, 0.0 ) ;
00085 
00086                         glColor4d( 0.0, 0.0, 1.0, alpha ) ;
00087                         glVertex3d( 0.0, 0.0, 0.0) ;
00088                         glVertex3d( 0.0, 0.0, axisLength ) ;
00089                 glEnd() ;
00090         }
00091         
00092         if( lighting )
00093         {
00094                 glEnable( GL_LIGHTING ) ;
00095         }
00096         if( blend )
00097         {
00098                 glEnable( GL_BLEND ) ;
00099         }
00100   //## end GL_Frame::GLDraw%926014530.body
00101 }
00102 
00103 bool GL_Frame::DrawExplicit () const
00104 {
00105   //## begin GL_Frame::DrawExplicit%950480123.body preserve=yes
00106         assert( false ) ;
00107         return false ;
00108   //## end GL_Frame::DrawExplicit%950480123.body
00109 }
00110 
00111 // Additional Declarations
00112   //## begin GL_Frame%3731DD4E010E.declarations preserve=yes
00113   //## end GL_Frame%3731DD4E010E.declarations
00114 
00115 //## begin module%3731DD4E010E.epilog preserve=yes
00116 //## end module%3731DD4E010E.epilog

Generated on Sat Apr 1 21:30:35 2006 for Motion Planning Kernel by  doxygen 1.4.6-NO