void vesMapper::drawPrimitive(const vesRenderState &renderState, vesSharedPtr<vesPrimitive> primitive) { // Send the primitive type information out renderState.m_material->bindRenderData( renderState, vesRenderData(primitive->primitiveType(), this->pointSize(), this->lineWidth())); glDrawElements(primitive->primitiveType(), primitive->numberOfIndices(), primitive->indicesValueType(), (void*)0); }
void vesMapper::drawTriangles(const vesRenderState &renderState, vesSharedPtr<vesPrimitive> triangles) { assert(this->m_geometryData); const unsigned int numberOfIndices = triangles->numberOfIndices(); unsigned int drawnIndices = 0; while (drawnIndices < numberOfIndices) { int numberOfIndicesToDraw = numberOfIndices - drawnIndices; if (numberOfIndicesToDraw > this->m_maximumTriangleIndicesPerDraw) { numberOfIndicesToDraw = this->m_maximumTriangleIndicesPerDraw; } uintptr_t offset = 0; // Send the primitive type information out renderState.m_material->bindRenderData( renderState, vesRenderData(triangles->primitiveType(), this->pointSize(), this->lineWidth())); if (!this->m_enableWireframe) { offset = triangles->sizeOfDataType() * drawnIndices; glDrawElements(triangles->primitiveType(), numberOfIndicesToDraw, triangles->indicesValueType(), (void*)offset); } else { for(int i = 0; i < numberOfIndicesToDraw; i += 3) { offset = triangles->sizeOfDataType() * i + triangles->sizeOfDataType() * drawnIndices; glDrawElements(GL_LINE_LOOP, 3, triangles->indicesValueType(), (void*)offset); } } drawnIndices += numberOfIndicesToDraw; } }