本文整理汇总了C++中QOpenGLContext::hasExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ QOpenGLContext::hasExtension方法的具体用法?C++ QOpenGLContext::hasExtension怎么用?C++ QOpenGLContext::hasExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QOpenGLContext
的用法示例。
在下文中一共展示了QOpenGLContext::hasExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeGL
void GLWidget::initializeGL()
{
QPalette palette;
#ifndef Q_OS_WIN
// getProcAddress is not working for me on Windows.
if (Settings.playerGPU()) {
QOpenGLContext* cx = context()->contextHandle();
if (m_glslManager && cx->hasExtension("GL_ARB_sync")) {
ClientWaitSync = (ClientWaitSync_fp) cx->getProcAddress("glClientWaitSync");
}
if (!ClientWaitSync) {
emit gpuNotSupported();
delete m_glslManager;
m_glslManager = 0;
}
}
#endif
initializeOpenGLFunctions();
qglClearColor(palette.color(QPalette::Window));
glShadeModel(GL_FLAT);
glEnable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glDisable(GL_LIGHTING);
glDisable(GL_DITHER);
glDisable(GL_BLEND);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
m_condition.wakeAll();
m_isInitialized = true;
}
示例2: drawDecoration
void KisMirrorAxis::drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter* converter, KisCanvas2* canvas)
{
Q_UNUSED(updateArea);
Q_UNUSED(converter);
Q_UNUSED(canvas);
gc.setPen(QPen(QColor(0, 0, 0, 128), 1));
gc.setBrush(Qt::white);
gc.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QOpenGLContext *ctx = QOpenGLContext::currentContext();
bool hasMultisample = ((gc.paintEngine()->type() == QPaintEngine::OpenGL2) &&
(ctx->hasExtension("GL_ARB_multisample")));
// QPainter cannot anti-alias the edges of circles etc. when using OpenGL
// So instead, use native OpenGL anti-aliasing when available.
if (hasMultisample) {
gc.beginNativePainting();
ctx->functions()->glEnable(GL_MULTISAMPLE);
gc.endNativePainting();
}
float halfHandleSize = d->handleSize / 2;
d->recomputeVisibleAxes(gc.viewport());
if(d->mirrorHorizontal) {
if (!d->horizontalAxis.isNull()) {
// QPointF horizontalIndicatorCenter = d->horizontalAxis.unitVector().pointAt(15);
// QRectF horizontalIndicator = QRectF(horizontalIndicatorCenter.x() - halfHandleSize, horizontalIndicatorCenter.y() - halfHandleSize, d->handleSize, d->handleSize);
float horizontalHandlePosition = qBound<float>(d->minHandlePosition, d->horizontalHandlePosition, d->horizontalAxis.length() - d->minHandlePosition);
QPointF horizontalHandleCenter = d->horizontalAxis.unitVector().pointAt(horizontalHandlePosition);
d->horizontalHandle = QRectF(horizontalHandleCenter.x() - halfHandleSize, horizontalHandleCenter.y() - halfHandleSize, d->handleSize, d->handleSize);
gc.setPen(QPen(QColor(0, 0, 0, 64), 2, Qt::DashDotDotLine, Qt::RoundCap, Qt::RoundJoin));
gc.drawLine(d->horizontalAxis);
// gc.drawEllipse(horizontalIndicator);
// gc.drawPixmap(horizontalIndicator.adjusted(5, 5, -5, -5).toRect(), d->horizontalIcon);
gc.setPen(QPen(QColor(0, 0, 0, 128), 2));
gc.drawEllipse(d->horizontalHandle);
gc.drawPixmap(d->horizontalHandle.adjusted(5, 5, -5, -5).toRect(), d->horizontalIcon);
} else {
d->horizontalHandle = QRectF();
}
}
if(d->mirrorVertical) {
if (!d->verticalAxis.isNull()) {
gc.setPen(QPen(QColor(0, 0, 0, 64), 2, Qt::DashDotDotLine, Qt::RoundCap, Qt::RoundJoin));
gc.drawLine(d->verticalAxis);
// QPointF verticalIndicatorCenter = d->verticalAxis.unitVector().pointAt(15);
// QRectF verticalIndicator = QRectF(verticalIndicatorCenter.x() - halfHandleSize, verticalIndicatorCenter.y() - halfHandleSize, d->handleSize, d->handleSize);
float verticalHandlePosition = qBound<float>(d->minHandlePosition, d->verticalHandlePosition, d->verticalAxis.length() - d->minHandlePosition);
QPointF verticalHandleCenter = d->verticalAxis.unitVector().pointAt(verticalHandlePosition);
d->verticalHandle = QRectF(verticalHandleCenter.x() - halfHandleSize, verticalHandleCenter.y() - halfHandleSize, d->handleSize, d->handleSize);
// gc.drawEllipse(verticalIndicator);
// gc.drawPixmap(verticalIndicator.adjusted(5, 5, -5, -5).toRect(), d->verticalIcon);
gc.setPen(QPen(QColor(0, 0, 0, 128), 2));
gc.drawEllipse(d->verticalHandle);
gc.drawPixmap(d->verticalHandle.adjusted(5, 5, -5, -5).toRect(), d->verticalIcon);
} else {
d->verticalHandle = QRectF();
}
}
if (hasMultisample) {
gc.beginNativePainting();
ctx->functions()->glDisable(GL_MULTISAMPLE);
gc.endNativePainting();
}
}