本文整理汇总了C++中QOpenGLFunctions_2_1::glMultMatrixf方法的典型用法代码示例。如果您正苦于以下问题:C++ QOpenGLFunctions_2_1::glMultMatrixf方法的具体用法?C++ QOpenGLFunctions_2_1::glMultMatrixf怎么用?C++ QOpenGLFunctions_2_1::glMultMatrixf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QOpenGLFunctions_2_1
的用法示例。
在下文中一共展示了QOpenGLFunctions_2_1::glMultMatrixf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawMeOnly
void ccIndexedTransformationBuffer::drawMeOnly(CC_DRAW_CONTEXT& context)
{
//no picking enabled on trans. buffers
if (MACRO_DrawEntityNames(context))
return;
//only in 3D
if (!MACRO_Draw3D(context))
return;
//get the set of OpenGL functions (version 2.1)
QOpenGLFunctions_2_1 *glFunc = context.glFunctions<QOpenGLFunctions_2_1>();
assert( glFunc != nullptr );
if ( glFunc == nullptr )
return;
size_t count = size();
//show path
{
ccGL::Color3v(glFunc, ccColor::green.rgba);
glFunc->glBegin(count > 1 && m_showAsPolyline ? GL_LINE_STRIP : GL_POINTS); //show path as a polyline or points?
for (ccIndexedTransformationBuffer::const_iterator it=begin(); it!=end(); ++it)
glFunc->glVertex3fv(it->getTranslation());
glFunc->glEnd();
}
//show trihedrons?
if (m_showTrihedrons)
{
for (ccIndexedTransformationBuffer::const_iterator it=begin(); it!=end(); ++it)
{
glFunc->glMatrixMode(GL_MODELVIEW);
glFunc->glPushMatrix();
glFunc->glMultMatrixf(it->data());
//force line width
glFunc->glPushAttrib(GL_LINE_BIT);
glFunc->glLineWidth(2.0f);
glFunc->glBegin(GL_LINES);
glFunc->glColor3f(1.0f,0.0f,0.0f);
glFunc->glVertex3f(0.0f,0.0f,0.0f);
glFunc->glVertex3f(m_trihedronsScale,0.0f,0.0f);
glFunc->glColor3f(0.0f,1.0f,0.0f);
glFunc->glVertex3f(0.0f,0.0f,0.0f);
glFunc->glVertex3f(0.0f,m_trihedronsScale,0.0f);
glFunc->glColor3f(0.0f,0.7f,1.0f);
glFunc->glVertex3f(0.0f,0.0f,0.0f);
glFunc->glVertex3f(0.0f,0.0f,m_trihedronsScale);
glFunc->glEnd();
glFunc->glPopAttrib(); //GL_LINE_BIT
glFunc->glPopMatrix();
}
}
}
示例2: drawBB
void ccHObject::drawBB(CC_DRAW_CONTEXT& context, const ccColor::Rgb& col)
{
QOpenGLFunctions_2_1 *glFunc = context.glFunctions<QOpenGLFunctions_2_1>();
assert(glFunc != nullptr);
if (glFunc == nullptr)
return;
glFunc->glPushAttrib(GL_LINE_BIT);
glFunc->glLineWidth(1.0f);
switch (m_selectionBehavior)
{
case SELECTION_AA_BBOX:
getDisplayBB_recursive(true, m_currentDisplay).draw(context, col);
break;
case SELECTION_FIT_BBOX:
{
//get the set of OpenGL functions (version 2.1)
QOpenGLFunctions_2_1 *glFunc = context.glFunctions<QOpenGLFunctions_2_1>();
assert( glFunc != nullptr );
if ( glFunc == nullptr )
break;
ccGLMatrix trans;
ccBBox box = getOwnFitBB(trans);
if (box.isValid())
{
glFunc->glMatrixMode(GL_MODELVIEW);
glFunc->glPushMatrix();
glFunc->glMultMatrixf(trans.data());
box.draw(context, col);
glFunc->glPopMatrix();
}
}
break;
case SELECTION_IGNORED:
break;
default:
assert(false);
}
glFunc->glPopAttrib(); //GL_LINE_BIT
}
示例3: drawMeOnly
//.........这里部分代码省略.........
{
if (m_width != 0)
{
glFunc->glPushAttrib(GL_LINE_BIT);
glFunc->glLineWidth(static_cast<GLfloat>(m_width));
}
//DGM: we do the 'GL_LINE_LOOP' manually as I have a strange bug
//on one on my graphic card with this mode!
//glBegin(m_isClosed ? GL_LINE_LOOP : GL_LINE_STRIP);
glFunc->glBegin(GL_LINE_STRIP);
for (unsigned i = 0; i < vertCount; ++i)
{
ccGL::Vertex3v(glFunc, getPoint(i)->u);
}
if (m_isClosed)
{
ccGL::Vertex3v(glFunc, getPoint(0)->u);
}
glFunc->glEnd();
//display arrow
if (m_showArrow && m_arrowIndex < vertCount && (m_arrowIndex > 0 || m_isClosed))
{
const CCVector3* P0 = getPoint(m_arrowIndex == 0 ? vertCount - 1 : m_arrowIndex - 1);
const CCVector3* P1 = getPoint(m_arrowIndex);
//direction of the last polyline chunk
CCVector3 u = *P1 - *P0;
u.normalize();
if (m_mode2D)
{
u *= -m_arrowLength;
static const PointCoordinateType s_defaultArrowAngle = static_cast<PointCoordinateType>(15.0 * CC_DEG_TO_RAD);
static const PointCoordinateType cost = cos(s_defaultArrowAngle);
static const PointCoordinateType sint = sin(s_defaultArrowAngle);
CCVector3 A(cost * u.x - sint * u.y, sint * u.x + cost * u.y, 0);
CCVector3 B(cost * u.x + sint * u.y, -sint * u.x + cost * u.y, 0);
glFunc->glBegin(GL_POLYGON);
ccGL::Vertex3v(glFunc, (A + *P1).u);
ccGL::Vertex3v(glFunc, (B + *P1).u);
ccGL::Vertex3v(glFunc, (*P1).u);
glFunc->glEnd();
}
else
{
if (!c_unitArrow)
{
c_unitArrow = QSharedPointer<ccCone>(new ccCone(0.5, 0.0, 1.0));
c_unitArrow->showColors(true);
c_unitArrow->showNormals(false);
c_unitArrow->setVisible(true);
c_unitArrow->setEnabled(true);
}
if (colorsShown())
c_unitArrow->setTempColor(m_rgbColor);
else
c_unitArrow->setTempColor(context.pointsDefaultCol);
//build-up unit arrow own 'context'
CC_DRAW_CONTEXT markerContext = context;
markerContext.drawingFlags &= (~CC_DRAW_ENTITY_NAMES); //we must remove the 'push name flag' so that the sphere doesn't push its own!
markerContext.display = 0;
glFunc->glMatrixMode(GL_MODELVIEW);
glFunc->glPushMatrix();
ccGL::Translate(glFunc, P1->x, P1->y, P1->z);
ccGLMatrix rotMat = ccGLMatrix::FromToRotation(u, CCVector3(0, 0, PC_ONE));
glFunc->glMultMatrixf(rotMat.inverse().data());
glFunc->glScalef(m_arrowLength, m_arrowLength, m_arrowLength);
ccGL::Translate(glFunc, 0.0, 0.0, -0.5);
c_unitArrow->draw(markerContext);
glFunc->glPopMatrix();
}
}
if (m_width != 0)
{
glFunc->glPopAttrib();
}
}
//display vertices
if (m_showVertices)
{
glFunc->glPushAttrib(GL_POINT_BIT);
glFunc->glPointSize((GLfloat)m_vertMarkWidth);
glFunc->glBegin(GL_POINTS);
for (unsigned i = 0; i < vertCount; ++i)
{
ccGL::Vertex3v(glFunc, getPoint(i)->u);
}
glFunc->glEnd();
glFunc->glPopAttrib();
}
if (pushName)
glFunc->glPopName();
}