MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / drawTextureQuad

Method drawTextureQuad

testbed/src/SceneDemo.cpp:430–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428}
429
430void SceneDemo::drawTextureQuad() {
431
432 glViewport(mViewportX, mViewportY, mViewportWidth, mViewportHeight);
433 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
434
435 // Clear previous frame values
436 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
437
438
439 const int SHADOW_MAP_TEXTURE_TO_DRAW = 0;
440 const GLuint textureUnit = SHADOW_MAP_TEXTURE_TO_DRAW;
441
442 mVAOQuad.bind();
443 mQuadShader.bind();
444 mShadowMapTexture[SHADOW_MAP_TEXTURE_TO_DRAW].bind();
445 mQuadShader.setIntUniform("textureSampler", textureUnit);
446 mVBOQuad.bind();
447
448 GLint vertexPositionLoc = mQuadShader.getAttribLocation("vertexPosition");
449 glEnableVertexAttribArray(vertexPositionLoc);
450
451 glVertexAttribPointer(
452 vertexPositionLoc, // attribute 0. No particular reason for 0, but must match the layout in the shader.
453 3, // size
454 GL_FLOAT, // type
455 GL_FALSE, // normalized?
456 0, // stride
457 (void*)0 // array buffer offset
458 );
459
460 // Draw the triangles !
461 glDrawArrays(GL_TRIANGLES, 0, 6); // 2*3 indices starting at 0 -> 2 triangles
462
463 glDisableVertexAttribArray(vertexPositionLoc);
464
465 mVBOQuad.unbind();
466 mShadowMapTexture[SHADOW_MAP_TEXTURE_TO_DRAW].unbind();
467 mQuadShader.unbind();
468 mVAOQuad.unbind();
469}
470
471// Gather and create snapshots contact points
472void SceneDemo::updateSnapshotContactPoints() {

Callers

nothing calls this directly

Calls 4

setIntUniformMethod · 0.80
getAttribLocationMethod · 0.80
bindMethod · 0.45
unbindMethod · 0.45

Tested by

no test coverage detected