本文整理汇总了C++中Mat4::ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4::ptr方法的具体用法?C++ Mat4::ptr怎么用?C++ Mat4::ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4
的用法示例。
在下文中一共展示了Mat4::ptr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runMeshProgram
void DrawDevice::runMeshProgram(Mesh *mesh, Texture *tex, const Mat4 &mv) {
glEnable(GL_DEPTH_TEST);
mainBuffer->bind();
tex->bind();
glViewport(0, 0, w/4, h/4);
simpleProgram->bind();
mesh->bind();
bindStandardAttributes(simpleProgram);
Mat4 f = Mat4::createFrustumMatrix(-1, 1, -1, 1, 2, 1000);
f = f * mv;
glUniformMatrix4fv(glGetUniformLocation(simpleProgram->program, "mvp"),
1, GL_TRUE, f.ptr());
mesh->draw();
}
示例2: updateUniforms
void TriangleGeometry::updateUniforms()
{
// Compute the normal matrix
Mat4 normalMatrix = mModelMatrix.getInverse().transpose();
// Upload the new geometry and material properties to the GPU
glBindBuffer(GL_UNIFORM_BUFFER, mUniformBuffer);
glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(float) * 16,mModelMatrix.ptr());
glBufferSubData(GL_UNIFORM_BUFFER, sizeof(float) * 16, sizeof(float) * 16,normalMatrix.ptr());
glBufferSubData(GL_UNIFORM_BUFFER, sizeof(float) * 32, sizeof(float) * 1,&mShininess);
glBufferSubData(GL_UNIFORM_BUFFER, sizeof(float) * 33, sizeof(float) * 1,&mLineWidth);
glBufferSubData(GL_UNIFORM_BUFFER, sizeof(float) * 36, sizeof(float) * 4,mColor.ptr());
glBufferSubData(GL_UNIFORM_BUFFER, sizeof(float) * 40, sizeof(float) * 4,mLineColor.ptr());
glBufferSubData(GL_UNIFORM_BUFFER, sizeof(float) * 44, sizeof(float) * 4,mLightPosition[0].ptr());
glBufferSubData(GL_UNIFORM_BUFFER, sizeof(float) * 48, sizeof(float) * 4,mLightPosition[1].ptr());
glBufferSubData(GL_UNIFORM_BUFFER, sizeof(float) * 52, sizeof(float) * 4,mLightPosition[2].ptr());
glBindBuffer(GL_UNIFORM_BUFFER, 0);
}