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

Method DrawQuad

Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1241–1267  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1239
1240//------------------------------------------------------------------------------
1241void vtkOpenGLContextDevice2D::DrawQuad(float* f, int n)
1242{
1243 if (SkipDraw())
1244 {
1245 return;
1246 }
1247
1248 if (!f || n <= 0)
1249 {
1250 vtkWarningMacro(<< "Points supplied that were not of type float.");
1251 return;
1252 }
1253
1254 // convert quads to triangles
1255 std::vector<float> tverts;
1256 int numTVerts = 6 * n / 4;
1257 tverts.resize(numTVerts * 2);
1258 int offset[6] = { 0, 1, 2, 0, 2, 3 };
1259 for (int i = 0; i < numTVerts; i++)
1260 {
1261 int index = 2 * (4 * (i / 6) + offset[i % 6]);
1262 tverts[i * 2] = f[index];
1263 tverts[i * 2 + 1] = f[index + 1];
1264 }
1265
1266 this->CoreDrawTriangles(tverts);
1267}
1268
1269void vtkOpenGLContextDevice2D::CoreDrawTriangles(
1270 std::vector<float>& tverts, unsigned char* colors, int numComp)

Callers 2

Calls 3

CoreDrawTrianglesMethod · 0.95
SkipDrawFunction · 0.85
resizeMethod · 0.45

Tested by

no test coverage detected