本文整理汇总了C++中QOpenGLContext::isOpenGLES方法的典型用法代码示例。如果您正苦于以下问题:C++ QOpenGLContext::isOpenGLES方法的具体用法?C++ QOpenGLContext::isOpenGLES怎么用?C++ QOpenGLContext::isOpenGLES使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QOpenGLContext
的用法示例。
在下文中一共展示了QOpenGLContext::isOpenGLES方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bind
void ShaderEffectSource::bind()
{
GLint filtering = smooth() ? GL_LINEAR : GL_NEAREST;
GLuint hwrap = (m_wrapMode == Repeat || m_wrapMode == RepeatHorizontally) ? GL_REPEAT : GL_CLAMP_TO_EDGE;
GLuint vwrap = (m_wrapMode == Repeat || m_wrapMode == RepeatVertically) ? GL_REPEAT : GL_CLAMP_TO_EDGE;
QOpenGLContext *context = QOpenGLContext::currentContext();
QOpenGLFunctions *f = context->functions();
if (!context->isOpenGLES())
f->glEnable(GL_TEXTURE_2D);
if (m_fbo && m_fbo->isValid()) {
f->glBindTexture(GL_TEXTURE_2D, m_fbo->texture());
} else {
m_dirtyTexture = true;
emit repaintRequired();
markSourceItemDirty();
f->glBindTexture(GL_TEXTURE_2D, 0);
}
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, smooth() ? GL_LINEAR : GL_NEAREST);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, hwrap);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, vwrap);
}
示例2: ba
QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
{
QOpenGLContext *ctx = QOpenGLContext::currentContext();
QOpenGLFunctions *funcs = ctx->functions();
const char *extensionStr = 0;
if (ctx->isOpenGLES() || ctx->format().majorVersion() < 3)
extensionStr = reinterpret_cast<const char *>(funcs->glGetString(GL_EXTENSIONS));
if (extensionStr) {
QByteArray ba(extensionStr);
QList<QByteArray> extensions = ba.split(' ');
m_extensions = extensions.toSet();
} else {
#ifdef QT_OPENGL_3
// clear error state
while (funcs->glGetError()) {}
if (ctx) {
qt_glGetStringi glGetStringi = (qt_glGetStringi)ctx->getProcAddress("glGetStringi");
if (!glGetStringi)
return;
GLint numExtensions;
funcs->glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
for (int i = 0; i < numExtensions; ++i) {
const char *str = reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i));
m_extensions.insert(str);
}
}
#endif // QT_OPENGL_3
}
}
示例3: isOpenGLES
bool isOpenGLES()
{
#ifdef QT_OPENGL_DYNAMIC
QOpenGLContext *ctx = QOpenGLContext::currentContext();
// desktop openGLModuleType() can create es compatible context, so prefer QOpenGLContext::isOpenGLES().
// qApp->testAttribute(Qt::AA_UseOpenGLES) is what user requested, but not the result can be different. reproduce: dygl set AA_ShareOpenGLContexts|AA_UseOpenGLES, fallback to desktop (why?)
return ctx ? ctx->isOpenGLES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL;
#endif //QT_OPENGL_DYNAMIC
#ifdef QT_OPENGL_ES_2
return true;
#endif //QT_OPENGL_ES_2
#if defined(QT_OPENGL_ES_2_ANGLE_STATIC) || defined(QT_OPENGL_ES_2_ANGLE)
return true;
#endif //QT_OPENGL_ES_2_ANGLE_STATIC
return false;
}
示例4: qCritical
OpenGLInfo::OpenGLInfo()
{
QOpenGLContext context;
QOffscreenSurface surface;
surface.create();
if (!context.create()) {
qCritical() << "Could not create QOpenGLContext";
return;
}
if (context.makeCurrent(&surface)) {
KWin::GLPlatform *platform = KWin::GLPlatform::instance();
if (context.isOpenGLES() || !QX11Info::isPlatformX11()) {
platform->detect(KWin::EglPlatformInterface);
} else {
platform->detect(KWin::GlxPlatformInterface);
}
if (platform->glRendererString().isEmpty()) {
qCritical() << "Neither GLX or EGL detection worked!";
}
openGLRenderer = QString::fromUtf8(platform->glRendererString());
openGLVersion = QString::fromUtf8(platform->glVersionString());
mesaVersion = KWin::GLPlatform::versionToString(platform->mesaVersion());
if (platform->driver() == KWin::Driver::Driver_Unknown) {
kwinDriver = platform->glVendorString();
} else {
kwinDriver = KWin::GLPlatform::driverToString(platform->driver());
}
displayServerVersion = KWin::GLPlatform::versionToString(platform->serverVersion());
}
else {
qCritical() <<"Error: makeCurrent() failed\n";
}
context.doneCurrent();
}
示例5: defined
QT_BEGIN_NAMESPACE
QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
{
// Resolve EXT_direct_state_access entry points if present.
// However, disable it on some systems where DSA is known to be unreliable.
bool allowDSA = true;
const char *renderer = reinterpret_cast<const char *>(context->functions()->glGetString(GL_RENDERER));
// QTBUG-40653, QTBUG-44988
if (renderer && strstr(renderer, "AMD Radeon HD"))
allowDSA = false;
if (allowDSA && !context->isOpenGLES()
&& context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT")));
TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT")));
TextureParameterfEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLfloat )>(context->getProcAddress(QByteArrayLiteral("glTextureParameterfEXT")));
TextureParameterfvEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLfloat *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterfvEXT")));
GenerateTextureMipmapEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum )>(context->getProcAddress(QByteArrayLiteral("glGenerateTextureMipmapEXT")));
TextureStorage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage3DEXT")));
TextureStorage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage2DEXT")));
TextureStorage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage1DEXT")));
TextureStorage3DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage3DMultisampleEXT")));
TextureStorage2DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage2DMultisampleEXT")));
TextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DEXT")));
TextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DEXT")));
TextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureImage1DEXT")));
TextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureSubImage3DEXT")));
TextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureSubImage2DEXT")));
TextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureSubImage1DEXT")));
CompressedTextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureSubImage1DEXT")));
CompressedTextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureSubImage2DEXT")));
CompressedTextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureSubImage3DEXT")));
CompressedTextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureImage1DEXT")));
CompressedTextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureImage2DEXT")));
CompressedTextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureImage3DEXT")));
// Use the real DSA functions
TextureParameteri = &QOpenGLTextureHelper::dsa_TextureParameteri;
TextureParameteriv = &QOpenGLTextureHelper::dsa_TextureParameteriv;
TextureParameterf = &QOpenGLTextureHelper::dsa_TextureParameterf;
TextureParameterfv = &QOpenGLTextureHelper::dsa_TextureParameterfv;
GenerateTextureMipmap = &QOpenGLTextureHelper::dsa_GenerateTextureMipmap;
TextureStorage3D = &QOpenGLTextureHelper::dsa_TextureStorage3D;
TextureStorage2D = &QOpenGLTextureHelper::dsa_TextureStorage2D;
TextureStorage1D = &QOpenGLTextureHelper::dsa_TextureStorage1D;
TextureStorage3DMultisample = &QOpenGLTextureHelper::dsa_TextureStorage3DMultisample;
TextureStorage2DMultisample = &QOpenGLTextureHelper::dsa_TextureStorage2DMultisample;
TextureImage3D = &QOpenGLTextureHelper::dsa_TextureImage3D;
TextureImage2D = &QOpenGLTextureHelper::dsa_TextureImage2D;
TextureImage1D = &QOpenGLTextureHelper::dsa_TextureImage1D;
TextureSubImage3D = &QOpenGLTextureHelper::dsa_TextureSubImage3D;
TextureSubImage2D = &QOpenGLTextureHelper::dsa_TextureSubImage2D;
TextureSubImage1D = &QOpenGLTextureHelper::dsa_TextureSubImage1D;
CompressedTextureSubImage1D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage1D;
CompressedTextureSubImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage2D;
CompressedTextureSubImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage3D;
CompressedTextureImage1D = &QOpenGLTextureHelper::dsa_CompressedTextureImage1D;
CompressedTextureImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureImage2D;
CompressedTextureImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureImage3D;
} else {
// Use our own DSA emulation
TextureParameteri = &QOpenGLTextureHelper::qt_TextureParameteri;
TextureParameteriv = &QOpenGLTextureHelper::qt_TextureParameteriv;
TextureParameterf = &QOpenGLTextureHelper::qt_TextureParameterf;
TextureParameterfv = &QOpenGLTextureHelper::qt_TextureParameterfv;
GenerateTextureMipmap = &QOpenGLTextureHelper::qt_GenerateTextureMipmap;
TextureStorage3D = &QOpenGLTextureHelper::qt_TextureStorage3D;
TextureStorage2D = &QOpenGLTextureHelper::qt_TextureStorage2D;
TextureStorage1D = &QOpenGLTextureHelper::qt_TextureStorage1D;
TextureStorage3DMultisample = &QOpenGLTextureHelper::qt_TextureStorage3DMultisample;
TextureStorage2DMultisample = &QOpenGLTextureHelper::qt_TextureStorage2DMultisample;
TextureImage3D = &QOpenGLTextureHelper::qt_TextureImage3D;
TextureImage2D = &QOpenGLTextureHelper::qt_TextureImage2D;
TextureImage1D = &QOpenGLTextureHelper::qt_TextureImage1D;
TextureSubImage3D = &QOpenGLTextureHelper::qt_TextureSubImage3D;
TextureSubImage2D = &QOpenGLTextureHelper::qt_TextureSubImage2D;
TextureSubImage1D = &QOpenGLTextureHelper::qt_TextureSubImage1D;
CompressedTextureSubImage1D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage1D;
CompressedTextureSubImage2D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage2D;
CompressedTextureSubImage3D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage3D;
CompressedTextureImage1D = &QOpenGLTextureHelper::qt_CompressedTextureImage1D;
CompressedTextureImage2D = &QOpenGLTextureHelper::qt_CompressedTextureImage2D;
CompressedTextureImage3D = &QOpenGLTextureHelper::qt_CompressedTextureImage3D;
}
// Some DSA functions are part of NV_texture_multisample instead
if (!context->isOpenGLES()
&& context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) {
TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV")));
TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV")));
TextureImage3DMultisample = &QOpenGLTextureHelper::dsa_TextureImage3DMultisample;
TextureImage2DMultisample = &QOpenGLTextureHelper::dsa_TextureImage2DMultisample;
} else {
TextureImage3DMultisample = &QOpenGLTextureHelper::qt_TextureImage3DMultisample;
TextureImage2DMultisample = &QOpenGLTextureHelper::qt_TextureImage2DMultisample;
}
//.........这里部分代码省略.........