TAPs 0.7.7.3
TAPsCUDA_GL_ModelElasticRod.cu File Reference
Include dependency graph for TAPsCUDA_GL_ModelElasticRod.cu:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CUDA_GL_ElasticRod
 A CUDA's GL Interoperability for generating draw data (generalized cylinders) for the Elastic Rod model. More...

Defines

#define TAPs_CUDA_GL_MODEL_ELASTIC_ROD_HPP

Functions

BEGIN_NAMESPACE_TAPs__CUDA bool GL__IsInitailizeDataForElasticRodModel_Drawing ()
 Is the texture for cross section's vertex data initialized?
bool TAPsCUDA_GL__InitailizeDataForElasticRodModel_Drawing (unsigned int numberOfCrossSectionVertices, float *crossSectionVertexData, GLuint vbo_GL)
 Initialize the CUDA/GL for elastic rod's drawing.
void GL__ClearDataForElasticRodModel_Drawing ()
 Clear the CUDA/GL for elastic rod's drawing.
void GL__UnregisterBufferObject (GLuint &vbo_GL)
 Clear the CUDA/GL for elastic rod's drawing.
void GL__GenCylinderForElasticRodModel (unsigned int cudaID, unsigned int numOfNodes, unsigned int numOfThreads, GLuint vbo_GL, unsigned int numOfCrossSectionVertices, float radius)
 Compute the generalized cylinder for the elastic rod.
void GL__GenCylinderForElasticRodModel_PLHM (unsigned int cudaID, unsigned int numOfNodes, unsigned int numOfThreads, GLuint vbo_GL, unsigned int numOfCrossSectionVertices, float radius)
 Compute the generalized cylinder for the elastic rod (with CUDA's PLHM)

Variables

texture< float4,
2, cudaReadModeElementType > 
CudaTexGLElasticRod
 Texture References.
CUDA_GL_ElasticRod Cuda_GL_ElasticRod
 CUDA/GL for drawing the elastic rod model.

Define Documentation

#define TAPs_CUDA_GL_MODEL_ELASTIC_ROD_HPP

Definition at line 14 of file TAPsCUDA_GL_ModelElasticRod.cu.


Function Documentation

void GL__ClearDataForElasticRodModel_Drawing ( )

Clear the CUDA/GL for elastic rod's drawing.

Definition at line 279 of file TAPsCUDA_GL_ModelElasticRod_Def.cu.

void GL__GenCylinderForElasticRodModel ( unsigned int  cudaID,
unsigned int  numOfNodes,
unsigned int  numOfThreads,
GLuint  vbo_GL,
unsigned int  numOfCrossSectionVertices,
float  radius 
)

Compute the generalized cylinder for the elastic rod.

Parameters:
cudaIDCUDA ID
numOfNodesnumber of nodes
numOfThreadsnumber of threads per CUDA thread block
vbo_GLOpenGL vertex buffer object
numOfCrossSectionVerticesnumber of cross section's vertices
radiusradius

Definition at line 285 of file TAPsCUDA_GL_ModelElasticRod_Def.cu.

Referenced by ElasticRod_CompByCUDA< T >::GenCylinderVertexDataForDrawing().

{
    // Kernel invocation
    unsigned int numOfThreadBlocks = ( numOfNodes + numOfThreads - 1 ) / numOfThreads;
    dim3 Dg( numOfThreadBlocks, 1, 1 );
    dim3 Db( numOfThreads, 1, 1 );
    size_t Ns = 0;
    cudaStream_t S = 0;

    // Bind Textures
    DATA_GlobalPool.DataForVertexList[cudaID]->BindVertexList( numOfNodes );
    DATA_GlobalPool.DataForVertexList[cudaID]->BindOrientationList( numOfNodes );
    Cuda_GL_ElasticRod.BindCrossSectionVertices();
    // Map to GL
    float4 * pVertexData;
    CUDA_SAFE_CALL( cudaGLMapBufferObject( (void**)&pVertexData, vbo_GL ) );
    CUT_CHECK_ERROR( "Mapping an OpenGL buffer object FAILED!" );

    // Call the CUDA kernel
    GL__GenCylinderForElasticRodModel_CU<<< Dg, Db, Ns, S >>>( 
        numOfNodes, numOfThreads, pVertexData, numOfCrossSectionVertices, radius
    );
    CUT_CHECK_ERROR( "GenCylinderForElasticRodModel Kernel execution failed!" );

    // Unbind Textures
    DATA_GlobalPool.DataForVertexList[cudaID]->UnbindVertexList();
    DATA_GlobalPool.DataForVertexList[cudaID]->UnbindOrientationList();
    Cuda_GL_ElasticRod.UnbindCrossSectionVertices();
    // Unmap from GL
    CUDA_SAFE_CALL( cudaGLUnmapBufferObject( vbo_GL ) );
}

Here is the caller graph for this function:

void GL__GenCylinderForElasticRodModel_PLHM ( unsigned int  cudaID,
unsigned int  numOfNodes,
unsigned int  numOfThreads,
GLuint  vbo_GL,
unsigned int  numOfCrossSectionVertices,
float  radius 
)

Compute the generalized cylinder for the elastic rod (with CUDA's PLHM)

Parameters:
cudaIDCUDA ID
numOfNodesnumber of nodes
numOfThreadsnumber of threads per CUDA thread block
vbo_GLOpenGL vertex buffer object
numOfCrossSectionVerticesnumber of cross section's vertices
radiusradius

Definition at line 326 of file TAPsCUDA_GL_ModelElasticRod_Def.cu.

Referenced by ElasticRod_CompByCUDA< T >::GenCylinderVertexDataForDrawing().

{
    // Kernel invocation
    unsigned int numOfThreadBlocks = ( numOfNodes + numOfThreads - 1 ) / numOfThreads;
    dim3 Dg( numOfThreadBlocks, 1, 1 );
    dim3 Db( numOfThreads, 1, 1 );
    size_t Ns = 0;
    cudaStream_t S = 0;

    // Bind Texture
    Cuda_GL_ElasticRod.BindCrossSectionVertices();
    // Map to GL
    float4 * pVertexData;
    CUDA_SAFE_CALL( cudaGLMapBufferObject( (void**)&pVertexData, vbo_GL ) );
    CUT_CHECK_ERROR( "Mapping an OpenGL buffer object FAILED!" );

    // Call the CUDA kernel
    GL__GenCylinderForElasticRodModel_PLHM_CU<<< Dg, Db, Ns, S >>>( 
        numOfNodes, numOfThreads,
        DATA_GlobalPool.DataForVertexListPLHM[cudaID]->GetDevVertexList(),
        DATA_GlobalPool.DataForVertexListPLHM[cudaID]->GetDevOrientationList(),
        pVertexData, numOfCrossSectionVertices, radius
    );
    CUT_CHECK_ERROR( "GenCylinderForElasticRodModel Kernel execution failed!" );

    // Unbind Texture
    Cuda_GL_ElasticRod.UnbindCrossSectionVertices();
    // Unmap from GL
    CUDA_SAFE_CALL( cudaGLUnmapBufferObject( vbo_GL ) );
}

Here is the caller graph for this function:

BEGIN_NAMESPACE_TAPs__CUDA bool GL__IsInitailizeDataForElasticRodModel_Drawing ( )

Is the texture for cross section's vertex data initialized?

Definition at line 265 of file TAPsCUDA_GL_ModelElasticRod_Def.cu.

void GL__UnregisterBufferObject ( GLuint &  vbo_GL)

Clear the CUDA/GL for elastic rod's drawing.

Definition at line 44 of file TAPsCUDA_GL_ModelElasticRod.cu.

Referenced by ModelElasticRod< T >::ClearGL().

{
    CUDA_SAFE_CALL( cudaGLUnregisterBufferObject( vbo_GL ) );
}

Here is the caller graph for this function:

bool TAPsCUDA_GL__InitailizeDataForElasticRodModel_Drawing ( unsigned int  numberOfCrossSectionVertices,
float *  crossSectionVertexData,
GLuint  vbo_GL 
)

Initialize the CUDA/GL for elastic rod's drawing.

Parameters:
numberOfCrossSectionVerticesnumber of cross section's vertices
crossSectionVertexDatacross section's vertex data
vbo_GLthe OpenGL buffer object for vertex data

Variable Documentation

texture<float4, 2, cudaReadModeElementType> CudaTexGLElasticRod

Texture References.

texture for list of cross section vertices for drawing (dim1 is position, dim2 is normal, dim3 is texture coordinates)

Definition at line 21 of file TAPsCUDA_GL_ModelElasticRod.cu.

Referenced by CUDA_GL_ElasticRod::BindCrossSectionVertices(), GL__GenCylinderForElasticRodModel_CU(), GL__GenCylinderForElasticRodModel_PLHM_CU(), and CUDA_GL_ElasticRod::UnbindCrossSectionVertices().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines