MCPcopy Create free account
hub / github.com/Kitware/VTK / AddAttributeMatrixWithDivisor

Method AddAttributeMatrixWithDivisor

Rendering/OpenGL2/vtkOpenGLVertexArrayObject.cxx:358–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358bool vtkOpenGLVertexArrayObject::AddAttributeMatrixWithDivisor(vtkShaderProgram* program,
359 vtkOpenGLBufferObject* buffer, const std::string& name, int offset, size_t stride,
360 int elementType, int elementTupleSize, bool normalize, int divisor, int tupleOffset)
361{
362 // bind the first row of values
363 bool result = this->AddAttributeArrayWithDivisor(
364 program, buffer, name, offset, stride, elementType, elementTupleSize, normalize, divisor, true);
365
366 if (!result)
367 {
368 return result;
369 }
370
371 const GLchar* namePtr = static_cast<const GLchar*>(name.c_str());
372 VertexAttributes attribs;
373 attribs.Index = glGetAttribLocation(this->Internal->HandleProgram, namePtr);
374
375 for (int i = 1; i < elementTupleSize; i++)
376 {
377 glEnableVertexAttribArray(attribs.Index + i);
378 glVertexAttribPointer(attribs.Index + i, elementTupleSize, convertTypeToGL(elementType),
379 normalize, static_cast<GLsizei>(stride), BUFFER_OFFSET(offset + tupleOffset * i));
380 if (divisor > 0)
381 {
382#ifdef GL_ES_VERSION_3_0
383 glVertexAttribDivisor(attribs.Index + i, 1);
384#else
385 if (GLAD_GL_ARB_instanced_arrays)
386 {
387 glVertexAttribDivisorARB(attribs.Index + i, 1);
388 }
389#endif
390 }
391 }
392
393 return true;
394}
395
396bool vtkOpenGLVertexArrayObject::RemoveAttributeArray(const std::string& name)
397{

Callers 2

GlyphRenderInstancesMethod · 0.80
RunCullingShadersMethod · 0.80

Calls 3

convertTypeToGLFunction · 0.70
c_strMethod · 0.45

Tested by

no test coverage detected