当前位置: 首页>>代码示例>>C++>>正文


C++ QOpenGLFunctions_2_1::glDisable方法代码示例

本文整理汇总了C++中QOpenGLFunctions_2_1::glDisable方法的典型用法代码示例。如果您正苦于以下问题:C++ QOpenGLFunctions_2_1::glDisable方法的具体用法?C++ QOpenGLFunctions_2_1::glDisable怎么用?C++ QOpenGLFunctions_2_1::glDisable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QOpenGLFunctions_2_1的用法示例。


在下文中一共展示了QOpenGLFunctions_2_1::glDisable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawStratPos

void ccSample::drawStratPos(CC_DRAW_CONTEXT& context)
{
    if (MACRO_Draw3D(context)) {

        QOpenGLFunctions_2_1* glFunc = context.glFunctions<QOpenGLFunctions_2_1>();
        assert(glFunc != nullptr);

        QFont font(context.display->getTextDisplayFont()); // takes rendering zoom into
        // account!
        font.setPointSize(font.pointSize());
        font.setBold(true);

        //    // draw their name
        //	glPushAttrib(GL_DEPTH_BUFFER_BIT);
        glFunc->glDisable(GL_DEPTH_TEST);

        QString name = QString::number(getSample()->getStratigraphicPosition(), 'g', 3);



        context.display->display3DLabel(name,
            CCVector3(getSample()->getPosition().data()),
            ccColor::red.rgb, font);

        //    CCVector3 p (x,y,z);
        //    QString title = (getName());
        //    context.display->display3DLabel(	title,
        //                                    p + CCVector3(
        // context.pickedPointsTextShift,
        //                                                    context.pickedPointsTextShift,
        //                                                    context.pickedPointsTextShift),
        //                                    ccColor::magenta,
        //                                    font );

        //	glPopAttrib();

        glFunc->glEnable(GL_DEPTH_TEST);
    }
}
开发者ID:luca-penasa,项目名称:vombat,代码行数:39,代码来源:ccSample.cpp

示例2: DrawColorRamp


//.........这里部分代码省略.........
				{
					ccColorScale::LabelSet::iterator toDelete = it;
					++it;
					keyValues.erase(toDelete);
				}
			}
		}
	}

	const ccGui::ParamStruct& displayParams = win->getDisplayParameters();

	//default color: text color
	const ccColor::Rgbub& textColor = displayParams.textDefaultCol;

	//histogram?
	const ccScalarField::Histogram histogram = sf->getHistogram();
	bool showHistogram = (displayParams.colorScaleShowHistogram && !logScale && histogram.maxValue != 0 && histogram.size() > 1);

	//display area
	QFont font = win->getTextDisplayFont(); //takes rendering zoom into account!
	const int strHeight = static_cast<int>(displayParams.defaultFontSize * renderZoom); //QFontMetrics(font).height() --> always returns the same value?!
	const int scaleWidth = static_cast<int>(displayParams.colorScaleRampWidth * renderZoom);
	const int scaleMaxHeight = (keyValues.size() > 1 ? std::max(glH - static_cast<int>(140 * renderZoom), 2 * strHeight) : scaleWidth); //if 1 value --> we draw a cube

	//centered orthoprojective view (-halfW,-halfH,halfW,halfH)
	int halfW = (glW >> 1);
	int halfH = (glH >> 1);

	//top-right corner of the scale ramp
	const int xShift = static_cast<int>(20 * renderZoom) + (showHistogram ? scaleWidth / 2 : 0);
	const int yShift = halfH - scaleMaxHeight / 2 - static_cast<int>(10 * renderZoom);

	glFunc->glPushAttrib(GL_DEPTH_BUFFER_BIT);
	glFunc->glDisable(GL_DEPTH_TEST);

	std::vector<double> sortedKeyValues(keyValues.begin(),keyValues.end());
	double maxRange = sortedKeyValues.back()-sortedKeyValues.front();

	//display color ramp
	{
		glFunc->glPushAttrib(GL_LINE_BIT);
		glFunc->glLineWidth(renderZoom);

		//(x,y): current display area coordinates (top-left corner)
		int x = halfW-xShift-scaleWidth;
		int y = halfH-yShift-scaleMaxHeight;

		if (keyValues.size() > 1)
		{
			int histoStart = x + scaleWidth + std::min(std::max(scaleWidth / 8, 3), static_cast<int>(15 * renderZoom));

			glFunc->glBegin(GL_LINES);
			for (int j=0; j<scaleMaxHeight; ++j)
			{
				double baseValue = sortedKeyValues.front() + (j * maxRange) / scaleMaxHeight;
				double value = baseValue;
				if (logScale)
				{
					value = exp(value*c_log10);
				}
				const ColorCompType* col = sf->getColor(static_cast<ScalarType>(value));
				if (!col)
				{
					//special case: if we have user-defined labels, we want all the labels to be displayed with their associated color
					if (customLabels)
					{
开发者ID:Puwong,项目名称:CloudCompare,代码行数:67,代码来源:ccRenderingTools.cpp

示例3: 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();
	}
}
开发者ID:stephaniewxk,项目名称:trunk,代码行数:101,代码来源:cc2DLabel.cpp


注:本文中的QOpenGLFunctions_2_1::glDisable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。