TAPs 0.7.7.3
TAPsCUDA_GL_ModelElasticRod.cu
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsCUDA_GL_ModelElasticRod.cu
00003 ******************************************************************************/
00009 /******************************************************************************
00010 SUKITTI PUNAK   (09/03/2009)
00011 UPDATE          (09/18/2009)
00012 ******************************************************************************/
00013 #ifndef TAPs_CUDA_GL_MODEL_ELASTIC_ROD_HPP
00014 #define TAPs_CUDA_GL_MODEL_ELASTIC_ROD_HPP
00015 
00016 #include "TAPsCUDA_DataPool.cu"
00017 
00018 
00020 //texture<Type, Dim, ReadMode>  TexRef;
00021 texture <float4, 2, cudaReadModeElementType>    CudaTexGLElasticRod;        
00022 
00023 BEGIN_NAMESPACE_TAPs__CUDA
00024 //=============================================================================
00025 // CUDA for Drawing by OpenGL
00026 //-----------------------------------------------------------------------------
00027 //#if defined(__gl_h_) || defined(__GL_H__)
00028 
00029 
00031 bool GL__IsInitailizeDataForElasticRodModel_Drawing ();
00032 
00034 bool TAPsCUDA_GL__InitailizeDataForElasticRodModel_Drawing (
00035     unsigned int    numberOfCrossSectionVertices,   
00036     float *         crossSectionVertexData,         
00037     GLuint          vbo_GL                          
00038 );
00039 
00041 void GL__ClearDataForElasticRodModel_Drawing ();
00042 
00044 void GL__UnregisterBufferObject ( GLuint & vbo_GL )
00045 {
00046     CUDA_SAFE_CALL( cudaGLUnregisterBufferObject( vbo_GL ) );
00047 }
00048 
00050 void GL__GenCylinderForElasticRodModel (
00051     unsigned int cudaID,        
00052     unsigned int numOfNodes,    
00053     unsigned int numOfThreads,  
00054     GLuint       vbo_GL,        
00055     unsigned int numOfCrossSectionVertices, 
00056     float        radius         
00057 );
00058 
00060 void GL__GenCylinderForElasticRodModel_PLHM (
00061     unsigned int cudaID,        
00062     unsigned int numOfNodes,    
00063     unsigned int numOfThreads,  
00064     GLuint       vbo_GL,        
00065     unsigned int numOfCrossSectionVertices, 
00066     float        radius         
00067 );
00068 
00069 
00070 class CUDA_GL_ElasticRod
00071 {
00072 public:
00073     // MEMBER FUNCTIONS -------------------------------------------------------
00075     CUDA_GL_ElasticRod ();
00076 
00078     ~CUDA_GL_ElasticRod ();
00079     
00081     static bool IsInitialized ()    { return g_isInitialized; }
00082     
00084     bool Create ( 
00085         unsigned int    numberOfCrossSectionVertices,   
00086         float *         crossSectionVertexData,         
00087         GLuint          vbo_GL                          
00088     );
00089 
00091     void Clear ();
00092 
00094     void BindCrossSectionVertices ()
00095     {
00096         CUDA_SAFE_CALL( cudaBindTextureToArray( CudaTexGLElasticRod, g_Ptr_Mem_CrossSectionVertexList ) );
00097         CUT_CHECK_ERROR( "Binding Cross Section's Vertex List Failed!" );
00098     }
00099 
00101     void UnbindCrossSectionVertices ()  { CUDA_SAFE_CALL( cudaUnbindTexture( CudaTexGLElasticRod ) ); }
00102 
00103 private:
00104     // DATA MEMBERS -----------------------------------------------------------
00105     static bool         g_isInitialized;                    
00106     static cudaArray *  g_Ptr_Mem_CrossSectionVertexList;   
00107     static unsigned int g_numOfCrossSectionVertices;        
00108     static unsigned int g_sizeOfCrossSectionVertexData;     
00109 };
00110 
00111 CUDA_GL_ElasticRod      Cuda_GL_ElasticRod; 
00112 
00113 //#endif //#if defined(__gl_h_) || defined(__GL_H__)
00114 //-----------------------------------------------------------------------------
00115 // CUDA for Drawing by OpenGL
00116 //=============================================================================
00117 END_NAMESPACE_TAPs__CUDA
00118 //-----------------------------------------------------------------------------
00119 #include "TAPsCUDA_GL_ModelElasticRod_Def.cu"
00120 
00121 #endif
00122 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00123 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines