本文整理汇总了C++中QOpenGLFunctions_2_1::glVertex2d方法的典型用法代码示例。如果您正苦于以下问题:C++ QOpenGLFunctions_2_1::glVertex2d方法的具体用法?C++ QOpenGLFunctions_2_1::glVertex2d怎么用?C++ QOpenGLFunctions_2_1::glVertex2d使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QOpenGLFunctions_2_1
的用法示例。
在下文中一共展示了QOpenGLFunctions_2_1::glVertex2d方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tab
//.........这里部分代码省略.........
glFunc->glEnable(GL_BLEND);
glFunc->glMatrixMode(GL_MODELVIEW);
glFunc->glPushMatrix();
glFunc->glTranslatef(static_cast<GLfloat>(-halfW + xStart), static_cast<GLfloat>(-halfH + yStart), 0);
if (!pushName)
{
//compute arrow base position relatively to the label rectangle (for 0 to 8)
int arrowBaseConfig = 0;
int iArrowDestX = static_cast<int>(arrowDestX)-xStart;
int iArrowDestY = static_cast<int>(arrowDestY)-yStart;
{
if (iArrowDestX < m_labelROI.left()) //left
arrowBaseConfig += 0;
else if (iArrowDestX > m_labelROI.right()) //Right
arrowBaseConfig += 2;
else //Middle
arrowBaseConfig += 1;
if (iArrowDestY > -m_labelROI.top()) //Top
arrowBaseConfig += 0;
else if (iArrowDestY < -m_labelROI.bottom()) //Bottom
arrowBaseConfig += 6;
else //Middle
arrowBaseConfig += 3;
}
//we make the arrow base start from the nearest corner
if (arrowBaseConfig != 4) //4 = label above point!
{
glFunc->glColor4ubv(defaultBorderColor.rgba);
glFunc->glBegin(GL_TRIANGLE_FAN);
glFunc->glVertex2d(arrowDestX - xStart, arrowDestY - yStart);
switch(arrowBaseConfig)
{
case 0: //top-left corner
glFunc->glVertex2i(m_labelROI.left(), -m_labelROI.top()-2*arrowBaseSize);
glFunc->glVertex2i(m_labelROI.left(), -m_labelROI.top());
glFunc->glVertex2i(m_labelROI.left()+2*arrowBaseSize, -m_labelROI.top());
break;
case 1: //top-middle edge
glFunc->glVertex2i(std::max(m_labelROI.left(),iArrowDestX-arrowBaseSize), -m_labelROI.top());
glFunc->glVertex2i(std::min(m_labelROI.right(),iArrowDestX+arrowBaseSize), -m_labelROI.top());
break;
case 2: //top-right corner
glFunc->glVertex2i(m_labelROI.right(), -m_labelROI.top()-2*arrowBaseSize);
glFunc->glVertex2i(m_labelROI.right(), -m_labelROI.top());
glFunc->glVertex2i(m_labelROI.right()-2*arrowBaseSize, -m_labelROI.top());
break;
case 3: //middle-left edge
glFunc->glVertex2i(m_labelROI.left(), std::min(-m_labelROI.top(),iArrowDestY+arrowBaseSize));
glFunc->glVertex2i(m_labelROI.left(), std::max(-m_labelROI.bottom(),iArrowDestY-arrowBaseSize));
break;
case 4: //middle of rectangle!
break;
case 5: //middle-right edge
glFunc->glVertex2i(m_labelROI.right(), std::min(-m_labelROI.top(),iArrowDestY+arrowBaseSize));
glFunc->glVertex2i(m_labelROI.right(), std::max(-m_labelROI.bottom(),iArrowDestY-arrowBaseSize));
break;
case 6: //bottom-left corner
glFunc->glVertex2i(m_labelROI.left(), -m_labelROI.bottom()+2*arrowBaseSize);
glFunc->glVertex2i(m_labelROI.left(), -m_labelROI.bottom());
glFunc->glVertex2i(m_labelROI.left()+2*arrowBaseSize, -m_labelROI.bottom());
break;
case 7: //bottom-middle edge