MCPcopy Create free account
hub / github.com/android/ndk-samples / Render

Method Render

endless-tunnel/app/src/main/cpp/tex_quad.cpp:82–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void TexQuad::Render(glm::mat4* transform) {
83 float aspect = SceneManager::GetInstance()->GetScreenAspect();
84 glm::mat4 orthoMat = glm::ortho(0.0f, aspect, 0.0f, 1.0f);
85 glm::mat4 modelMat, mat;
86
87 bool hadDepthTest = glIsEnabled(GL_DEPTH_TEST);
88 glDisable(GL_DEPTH_TEST);
89
90 modelMat =
91 glm::translate(glm::mat4(1.0f), glm::vec3(mCenterX, mCenterY, 0.0f));
92 modelMat =
93 glm::scale(modelMat, glm::vec3(mScale * mHeight, mScale * mHeight, 0.0f));
94 if (transform) {
95 mat = orthoMat * (*transform) * modelMat;
96 } else {
97 mat = orthoMat * modelMat;
98 }
99
100 mOurShader->BeginRender(mGeom->vbuf);
101 mOurShader->SetTexture(mTexture);
102 mOurShader->Render(mGeom->ibuf, &mat);
103 mOurShader->EndRender();
104
105 if (hadDepthTest) {
106 glEnable(GL_DEPTH_TEST);
107 }
108}

Callers

nothing calls this directly

Calls 4

GetScreenAspectMethod · 0.80
SetTextureMethod · 0.80
EndRenderMethod · 0.80
BeginRenderMethod · 0.45

Tested by

no test coverage detected