本文整理汇总了C++中QOpenGLFunctions_2_1::glGetIntegerv方法的典型用法代码示例。如果您正苦于以下问题:C++ QOpenGLFunctions_2_1::glGetIntegerv方法的具体用法?C++ QOpenGLFunctions_2_1::glGetIntegerv怎么用?C++ QOpenGLFunctions_2_1::glGetIntegerv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QOpenGLFunctions_2_1
的用法示例。
在下文中一共展示了QOpenGLFunctions_2_1::glGetIntegerv方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeLightsNeutral
void ccMaterial::MakeLightsNeutral(const QOpenGLContext* context)
{
//get the set of OpenGL functions (version 2.1)
QOpenGLFunctions_2_1* glFunc = context->versionFunctions<QOpenGLFunctions_2_1>();
assert(glFunc != nullptr);
if (glFunc == nullptr)
return;
GLint maxLightCount;
glFunc->glGetIntegerv(GL_MAX_LIGHTS, &maxLightCount);
for (int i = 0; i < maxLightCount; ++i)
{
if (glFunc->glIsEnabled(GL_LIGHT0 + i))
{
float diffuse[4];
float ambiant[4];
float specular[4];
glFunc->glGetLightfv(GL_LIGHT0 + i, GL_DIFFUSE, diffuse);
glFunc->glGetLightfv(GL_LIGHT0 + i, GL_AMBIENT, ambiant);
glFunc->glGetLightfv(GL_LIGHT0 + i, GL_SPECULAR, specular);
diffuse[0] = diffuse[1] = diffuse[2] = ( diffuse[0] + diffuse[1] + diffuse[2]) / 3; //'mean' (gray) value
ambiant[0] = ambiant[1] = ambiant[2] = ( ambiant[0] + ambiant[1] + ambiant[2]) / 3; //'mean' (gray) value
specular[0] = specular[1] = specular[2] = (specular[0] + specular[1] + specular[2]) / 3; //'mean' (gray) value
glFunc->glLightfv(GL_LIGHT0 + i, GL_DIFFUSE, diffuse);
glFunc->glLightfv(GL_LIGHT0 + i, GL_AMBIENT, ambiant);
glFunc->glLightfv(GL_LIGHT0 + i, GL_SPECULAR, specular);
}
}
}
示例2: font
//.........这里部分代码省略.........
}
case 1:
{
//display point marker as spheres
{
if (!c_unitPointMarker)
{
c_unitPointMarker = QSharedPointer<ccSphere>(new ccSphere(1.0f, 0, "PointMarker", 12));
c_unitPointMarker->showColors(true);
c_unitPointMarker->setVisible(true);
c_unitPointMarker->setEnabled(true);
}
//build-up point maker 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;
if (isSelected() && !pushName)
c_unitPointMarker->setTempColor(ccColor::red);
else
c_unitPointMarker->setTempColor(context.labelDefaultMarkerCol);
const ccViewportParameters& viewPortParams = context.display->getViewportParameters();
ccGLCameraParameters camera;
context.display->getGLCameraParameters(camera);
for (unsigned i = 0; i<count; i++)
{
glFunc->glMatrixMode(GL_MODELVIEW);
glFunc->glPushMatrix();
const CCVector3* P = m_points[i].cloud->getPoint(m_points[i].index);
ccGL::Translate(glFunc, P->x, P->y, P->z);
float scale = context.labelMarkerSize * m_relMarkerScale;
if (viewPortParams.perspectiveView && viewPortParams.zFar > 0)
{
//in perspective view, the actual scale depends on the distance to the camera!
const double* M = camera.modelViewMat.data();
double d = (camera.modelViewMat * CCVector3d::fromArray(P->u)).norm();
double unitD = viewPortParams.zFar / 2; //we consider that the 'standard' scale is at half the depth
scale = static_cast<float>(scale * sqrt(d / unitD)); //sqrt = empirical (probably because the marker size is already partly compensated by ccGLWindow::computeActualPixelSize())
}
glFunc->glScalef(scale, scale, scale);
c_unitPointMarker->draw(markerContext);
glFunc->glPopMatrix();
}
}
if (m_dispIn3D && !pushName) //no need to display label in point picking mode
{
QFont font(context.display->getTextDisplayFont()); //takes rendering zoom into account!
//font.setPointSize(font.pointSize()+2);
font.setBold(true);
static const QChar ABC[3] = {'A','B','C'};
//we can't use the context 'ccGLCameraParameters' (viewport, modelView matrix, etc. )
//because it doesn't take the temporary 'GL transformation' into account!
ccGLCameraParameters camera;
//context.display->getGLCameraParameters(camera);
glFunc->glGetIntegerv(GL_VIEWPORT, camera.viewport);
glFunc->glGetDoublev(GL_PROJECTION_MATRIX, camera.projectionMat.data());
glFunc->glGetDoublev(GL_MODELVIEW_MATRIX, camera.modelViewMat.data());
//draw their name
glFunc->glPushAttrib(GL_DEPTH_BUFFER_BIT);
glFunc->glDisable(GL_DEPTH_TEST);
for (unsigned j=0; j<count; j++)
{
const CCVector3* P = m_points[j].cloud->getPoint(m_points[j].index);
QString title;
if (count == 1)
title = getName(); //for single-point labels we prefer the name
else if (count == 3)
title = ABC[j]; //for triangle-labels, we only display "A","B","C"
else
title = QString("P#%0").arg(m_points[j].index);
//project it in 2D screen coordinates
CCVector3d Q2D;
camera.project(*P, Q2D);
context.display->displayText( title,
static_cast<int>(Q2D.x) + context.labelMarkerTextShift_pix,
static_cast<int>(Q2D.y) + context.labelMarkerTextShift_pix,
ccGenericGLDisplay::ALIGN_DEFAULT,
context.labelOpacity / 100.0f,
ccColor::white.rgba,
&font );
}
glFunc->glPopAttrib();
}
}
}
if (pushName)
{
glFunc->glPopName();
}
}
示例3: drawMeOnly
void ccSNECloud::drawMeOnly(CC_DRAW_CONTEXT& context)
{
if (!MACRO_Foreground(context)) //2D foreground only
return; //do nothing
//draw point cloud
ccPointCloud::drawMeOnly(context);
//draw normal vectors
if (MACRO_Draw3D(context))
{
if (size() == 0) //no points -> bail!
return;
//get the set of OpenGL functions (version 2.1)
QOpenGLFunctions_2_1 *glFunc = context.glFunctions<QOpenGLFunctions_2_1>();
if (glFunc == nullptr) {
assert(false);
return;
}
//glDrawParams glParams;
//getDrawingParameters(glParams);
//get camera info
ccGLCameraParameters camera;
glFunc->glGetIntegerv(GL_VIEWPORT, camera.viewport);
glFunc->glGetDoublev(GL_PROJECTION_MATRIX, camera.projectionMat.data());
glFunc->glGetDoublev(GL_MODELVIEW_MATRIX, camera.modelViewMat.data());
const ccViewportParameters& viewportParams = context.display->getViewportParameters();
//get point size for drawing
float pSize;
glFunc->glGetFloatv(GL_POINT_SIZE, &pSize);
//draw normal vectors if highlighted
//if ((m_isHighlighted | m_isAlternate | m_isActive))
//{
//setup
if (pSize != 0)
{
glFunc->glPushAttrib(GL_LINE_BIT);
glFunc->glLineWidth(static_cast<GLfloat>(pSize));
}
glFunc->glMatrixMode(GL_MODELVIEW);
glFunc->glPushMatrix();
glFunc->glEnable(GL_BLEND);
//get normal vector properties
int thickID = getScalarFieldIndexByName("Thickness");
//int weightID = getScalarFieldIndexByName("Weight");
//float weight;
//float maxWeight = getScalarField( weightID )->getMax();
//draw normals
glFunc->glBegin(GL_LINES);
for (unsigned p = 0; p < size(); p++)
{
//get weight
//weight = getScalarField(weightID)->getValue(p);
//weight /= maxWeight;
//push colour
const ccColor::Rgb* col = m_currentDisplayedScalarField->getColor(m_currentDisplayedScalarField->getValue(p));
const ccColor::Rgba col4(col->r, col->g, col->b,200);
glFunc->glColor4ubv(col4.rgba);
//get length from thickness (if defined)
float length = 1.0;
if (thickID != -1)
{
length = getScalarField(thickID)->getValue(p);
}
//calculate start and end points of normal vector
const CCVector3 start = *getPoint(p);
CCVector3 end = start + (getPointNormal(p)*length);
//push line to opengl
ccGL::Vertex3v(glFunc, start.u);
ccGL::Vertex3v(glFunc, end.u);
}
glFunc->glEnd();
//cleanup
if (pSize != 0) {
glFunc->glPopAttrib();
}
glFunc->glPopMatrix();
}
}