本文整理汇总了C++中Matrix4d::toArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4d::toArray方法的具体用法?C++ Matrix4d::toArray怎么用?C++ Matrix4d::toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4d
的用法示例。
在下文中一共展示了Matrix4d::toArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void LegacyRenderer::render(const ICamera<float>& camera, const PointBuffer& buffer, const float pointSize)
{
const auto& positions = buffer.getPosition().get();// buffers[0].get();
const auto& colors = buffer.getColor().get();
if (positions.empty()) {
return;
}
GLfloat distance[] = { 0.0, 0.0, 1.0 };
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, distance);
glEnable(GL_POINT_SPRITE);
glEnable(GL_DEPTH_TEST);
glPointSize(pointSize);
Matrix4d<float> projectionMatrix = camera.getProjectionMatrix();
Matrix4d<float> modelviewMatrix = camera.getModelviewMatrix();;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glLoadMatrixf(projectionMatrix.toArray().data());
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glLoadMatrixf(modelviewMatrix.toArray().data());
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, positions.data());
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_FLOAT, 0, colors.data());
assert(glGetError() == GL_NO_ERROR);
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(positions.size()) / 3);
//glDrawElements(GL_POINTS, indices.size(), GL_UNSIGNED_INT, indices.data());
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisable(GL_DEPTH_TEST);
glDisable(GL_POINT_SPRITE);
}
示例2: renderAlphaBlend
void LegacyRenderer::renderAlphaBlend(const ICamera<float>& camera, const PointBuffer& buffer)
{
const auto& positions = buffer.getPosition().get();// buffers[0].get();
const auto& colors = buffer.getColor().get();
if (positions.empty()) {
return;
}
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glPointSize(10.0f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Matrix4d<float> projectionMatrix = camera.getProjectionMatrix();
Matrix4d<float> modelviewMatrix = camera.getModelviewMatrix();;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glLoadMatrixf(projectionMatrix.toArray().data());
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glLoadMatrixf(modelviewMatrix.toArray().data());
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, positions.data());
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_FLOAT, 0, colors.data());
assert(glGetError() == GL_NO_ERROR);
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(positions.size()) / 3);
//glDrawElements(GL_POINTS, indices.size(), GL_UNSIGNED_INT, indices.data());
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
}