本文整理汇总了C++中Mat4f::getPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4f::getPtr方法的具体用法?C++ Mat4f::getPtr怎么用?C++ Mat4f::getPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4f
的用法示例。
在下文中一共展示了Mat4f::getPtr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawCurve
void drawCurve( const Curve& curve, float framesize )
{
// Save current state of OpenGL
glPushAttrib( GL_ALL_ATTRIB_BITS );
// Setup for line drawing
glDisable( GL_LIGHTING );
glColor4f( 1, 1, 1, 1 );
glLineWidth( 1 );
// Draw curve
glBegin( GL_LINE_STRIP );
for( unsigned i = 0; i < curve.size(); ++i )
{
glVertex( curve[ i ].V );
}
glEnd();
glLineWidth( 1 );
// Draw coordinate frames if framesize nonzero
if( framesize != 0.0f )
{
Mat4f M;
for( unsigned i = 0; i < curve.size(); ++i )
{
M.setCol( 0, Vec4f( curve[i].N, 0 ) );
M.setCol( 1, Vec4f( curve[i].B, 0 ) );
M.setCol( 2, Vec4f( curve[i].T, 0 ) );
M.setCol( 3, Vec4f( curve[i].V, 1 ) );
glPushMatrix();
glMultMatrixf( M.getPtr() );
glScaled( framesize, framesize, framesize );
glBegin( GL_LINES );
glColor3f( 1, 0, 0 ); glVertex3d( 0, 0, 0 ); glVertex3d( 1, 0, 0 );
glColor3f( 0, 1, 0 ); glVertex3d( 0, 0, 0 ); glVertex3d( 0, 1, 0 );
glColor3f( 0, 0, 1 ); glVertex3d( 0, 0, 0 ); glVertex3d( 0, 0, 1 );
glEnd();
glPopMatrix();
}
}
// Pop state
glPopAttrib();
}
示例2: setGl
void cameraProto::setGl() {
//// Set up a perspective view, with square aspect ratio
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// extern void gluPerspective (GLdouble fov_y, GLdouble aspect, GLdouble zNear, GLdouble zFar);
gluPerspective((GLdouble)fov_, (GLdouble)1.0, (GLdouble)near_clip_, (GLdouble)far_clip_);
// Rotate the image
glMatrixMode( GL_MODELVIEW ); // Current matrix affects objects position_s
glLoadIdentity(); // Initialize to the identity
Mat4f modelView;
current_quat_.get(modelView);
gluLookAt(0, 0, current_dist_,
0, 0, 0,
0, 1, 0);
glMultMatrixf(modelView.getPtr());
glTranslatef(this->look_at_.x, this->look_at_.y,this->look_at_.z);
}
示例3: if
void setUniform (int loc, const Mat4f& v) { if (loc >= 0) glUniformMatrix4fv(loc, 1, false, v.getPtr()); }