void cleanup() { if (g_bQAReadback) { cudaFree(d_pos); cudaFree(d_normal); } else { cutilCheckError( cutDeleteTimer( timer )); deleteVBO(&posVbo, &cuda_posvbo_resource); deleteVBO(&normalVbo, &cuda_normalvbo_resource); } cudppDestroyPlan(scanplan); cutilSafeCall(cudaFree(d_edgeTable)); cutilSafeCall(cudaFree(d_triTable)); cutilSafeCall(cudaFree(d_numVertsTable)); cutilSafeCall(cudaFree(d_voxelVerts)); cutilSafeCall(cudaFree(d_voxelVertsScan)); cutilSafeCall(cudaFree(d_voxelOccupied)); cutilSafeCall(cudaFree(d_voxelOccupiedScan)); cutilSafeCall(cudaFree(d_compVoxelArray)); if (d_volume) cutilSafeCall(cudaFree(d_volume)); if (g_CheckRender) { delete g_CheckRender; g_CheckRender = NULL; } if (g_FrameBufferObject) { delete g_FrameBufferObject; g_FrameBufferObject = NULL; } }
void cleanup() { // DEPRECATED: cutilSafeCall(cudaGLUnregisterBufferObject(heightVertexBuffer)); cutilSafeCall(cudaGraphicsUnregisterResource(cuda_heightVB_resource)); // DEPRECATED: cutilSafeCall(cudaGLUnregisterBufferObject(slopeVertexBuffer)); cutilSafeCall(cudaGraphicsUnregisterResource(cuda_slopeVB_resource)); deleteVBO(&posVertexBuffer); deleteVBO(&heightVertexBuffer); deleteVBO(&slopeVertexBuffer); cutilSafeCall( cudaFree(d_h0) ); cutilSafeCall( cudaFree(d_slope) ); free(h_h0); cufftDestroy(fftPlan); }
Renderable::~Renderable() { deleteVBO(); if (vertexBuffer) { delete [] vertexBuffer; vertexBuffer = NULL; } if (vertexNormalBuffer) { delete [] vertexNormalBuffer; vertexNormalBuffer = NULL; } if (faceBuffer) { delete [] faceBuffer; faceBuffer = NULL; } if (colorBuffer) { delete [] colorBuffer; colorBuffer = NULL; } for (int i = 0, lim = children.size(); i < lim; i++) { if (children[i]) { delete children[i]; children[i] = NULL; } } }
ParticleRenderer::~ParticleRenderer() { delete m_particleSystem; deleteShaders(); deleteVBO(); deleteEBOs(); }
void cleanup() { sdkDeleteTimer(&timer); if (vbo) { deleteVBO(&vbo, cuda_vbo_resource); } }
void ParticleRenderer::createVBO() { deleteVBO(); glGenBuffers(1, &m_vbo); glBindBuffer(GL_ARRAY_BUFFER, m_vbo); glBufferData(GL_ARRAY_BUFFER, 3 * sizeof(float) * getNumActive(), m_particleSystem->getPositions(), GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); CHECK_GL_ERROR(); }
void cleanup() { cutilCheckError( cutDeleteTimer( timer)); deleteVBO(&vbo); if (g_CheckRender) { delete g_CheckRender; g_CheckRender = NULL; } }
bool Mesh::updateContextItem(bool changed) { if (_texture != NULL) _texture->updateContext(); if (changed) { deleteVBO(); createVBO(); } return true; }
void CloudPointData::VBO::genBufferColor( unsigned int& idColor, const void* data, int size, GLenum target, GLenum usage ) { //test if current VBO is already existing if( idColor != 0 ) //if idColor is not null deleteVBO( ); //delete current VBO const int dataSize = size * 3 * sizeof(float); glGenBuffers( 1, &(_idColor) ); // create a VBO glBindBuffer( target, _idColor ); // activate VBO id to use glBufferData( target, dataSize, data, usage ); // upload data to video card // check data size in VBO is same as input array, if not return 0 and delete VBO int bufferSize = 0; glGetBufferParameteriv( target, GL_BUFFER_SIZE, &bufferSize ); if( dataSize != bufferSize ) //mismatch between data size and input array (control) { deleteVBO( ); std::cout << "[createVBO()] Mismatch between Data size and input array" << std::endl; } }
Model::~Model(void) { if(model) glmDelete(model); if(colors) delete[] colors; if(bbox) delete bbox; unbindVBO(); deleteVBO(); }
void ScaleTool::buildVBO() { deleteVBO(); QVector<vec3> data; data += vec3( 0, 0, 0 ); data += vec3( 0, 1, 0 ); static const int resolution = 60; static const float dAngle = 2.f*(float)M_PI/resolution; vec3 center = vec3( 0, 1-m_radius, 0 ); for ( int i = 0; i < resolution; ++i ) { float theta0 = i*dAngle; float theta1 = (i+1)*dAngle; float y0 = cosf(theta0); float y1 = cosf(theta1); float r0 = sinf(theta0); float r1 = sinf(theta1); for ( int j = 0; j < resolution; ++j ) { float phi0 = j*dAngle; float phi1 = (j+1)*dAngle; float x0 = cosf(phi0); float x1 = cosf(phi1); float z0 = -sinf(phi0); float z1 = -sinf(phi1); data += ( center + m_radius*vec3(r0*x0, y0, r0*z0) ); data += ( center + m_radius*vec3(r1*x0, y1, r1*z0) ); data += ( center + m_radius*vec3(r1*x1, y1, r1*z1) ); data += ( center + m_radius*vec3(r0*x1, y0, r0*z1) ); } } glGenBuffers( 1, &m_vbo ); glBindBuffer( GL_ARRAY_BUFFER, m_vbo ); glBufferData( GL_ARRAY_BUFFER, data.size()*sizeof(vec3), data.data(), GL_STATIC_DRAW ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); m_vboSize = data.size(); }
void Mesh::cleanupContextItem() { deleteVBO(); }
ScaleTool::~ScaleTool() { deleteVBO(); }