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

Method Render

endless-tunnel/app/src/main/cpp/shader.cpp:168–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168void Shader::Render(IndexBuf* ibuf, glm::mat4* mvpMat) {
169 MY_ASSERT(mPreparedVertexBuf != NULL);
170
171 // push MVP matrix to shader
172 PushMVPMatrix(mvpMat);
173
174 if (ibuf) {
175 // draw with index buffer
176 ibuf->BindBuffer();
177 glDrawElements(mPreparedVertexBuf->GetPrimitive(), ibuf->GetCount(),
178 GL_UNSIGNED_SHORT, nullptr);
179 ibuf->UnbindBuffer();
180 } else {
181 // draw straight from vertex buffer
182 glDrawArrays(mPreparedVertexBuf->GetPrimitive(), 0,
183 mPreparedVertexBuf->GetCount());
184 }
185}
186
187void Shader::EndRender() {
188 if (mPreparedVertexBuf) {

Callers 2

RenderTunnelMethod · 0.45
RenderObstaclesMethod · 0.45

Calls 4

GetPrimitiveMethod · 0.80
BindBufferMethod · 0.45
GetCountMethod · 0.45
UnbindBufferMethod · 0.45

Tested by

no test coverage detected