MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / drawGrid_xy

Method drawGrid_xy

GUI/OpenGL/MiniGL.cpp:373–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373void MiniGL::drawGrid_xy(float *color)
374{
375 Vector3f diffcolor(color);
376 Vector3f speccolor(1.0, 1.0, 1.0);
377
378 const int size = 5;
379
380 VectorXr grid((2*size + 1) * 4 * 3);
381 for (int i = -size; i <= size; i++)
382 {
383 grid.segment<12>((i+size) * 12) << (float)i, (float)-size, 0.0f,
384 (float)i, (float)size, 0.0f,
385 (float)-size, (float)i, 0.0f,
386 (float)size, (float)i, 0.0f;
387 }
388 enableShader(diffcolor, diffcolor, speccolor, 100.0);
389 glUniform1i(m_shader.getUniform("lighting"), GL_FALSE);
390 supplyVertices(0, (2*size + 1) * 4, &grid(0));
391 glDrawArrays(GL_LINES, 0, (2*size + 1) * 4);
392 glDisableVertexAttribArray(0);
393 disableShader();
394
395 float lineWidth = 1.0;
396
397 drawVector(Vector3r(-size, 0.0, 0.0), Vector3r(0.0, 0.0, 0.0), lineWidth, color);
398 drawVector(Vector3r(1.0, 0.0, 0.0), Vector3r(size, 0.0, 0.0), lineWidth, color);
399 drawVector(Vector3r(0.0, -size, 0.0), Vector3r(0.0, 0.0, 0.0), lineWidth, color);
400 drawVector(Vector3r(0.0, 1.0, 0.0), Vector3r(0.0, size, 0.0), lineWidth, color);
401}
402
403void MiniGL::setViewport(float pfovy, float pznear, float pzfar, const Vector3r &peyepoint, const Vector3r &plookat)
404{

Callers

nothing calls this directly

Calls 1

getUniformMethod · 0.80

Tested by

no test coverage detected