本文整理汇总了C++中QOpenGLContext::getProcAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ QOpenGLContext::getProcAddress方法的具体用法?C++ QOpenGLContext::getProcAddress怎么用?C++ QOpenGLContext::getProcAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QOpenGLContext
的用法示例。
在下文中一共展示了QOpenGLContext::getProcAddress方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeHardware
void XCompositeGLXClientBufferIntegration::initializeHardware(QtWayland::Display *)
{
qDebug() << "Initializing GLX integration";
QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
if (nativeInterface) {
mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWindow("Display",m_compositor->window()));
if (!mDisplay)
qFatal("could not retireve Display from platform integration");
} else {
qFatal("Platform integration doesn't have native interface");
}
mScreen = XDefaultScreen(mDisplay);
mHandler = new XCompositeHandler(m_compositor->handle(), mDisplay);
QOpenGLContext *glContext = new QOpenGLContext();
glContext->create();
m_glxBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT"));
if (!m_glxBindTexImageEXT) {
qDebug() << "Did not find glxBindTexImageExt, everything will FAIL!";
}
m_glxReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT"));
if (!m_glxReleaseTexImageEXT) {
qDebug() << "Did not find glxReleaseTexImageExt";
}
delete glContext;
}
示例2: initializeExtension
gl::glProc HeadlessBackend::initializeExtension(const char* name) {
#if QT_VERSION >= 0x050000
QOpenGLContext* thisContext = QOpenGLContext::currentContext();
return thisContext->getProcAddress(name);
#else
const QGLContext* thisContext = QGLContext::currentContext();
return reinterpret_cast<mbgl::gl::glProc>(thisContext->getProcAddress(name));
#endif
}
示例3: return
static void *get_proc_address(void *ctx, const char *name)
{
Q_UNUSED(ctx);
QOpenGLContext *glctx = QOpenGLContext::currentContext();
if(!glctx) return nullptr;
return (void *)glctx->getProcAddress(QByteArray(name));
}
示例4: 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;
}
示例5: get_proc_address
static void* get_proc_address(void* ctx, const char* name)
{
Q_UNUSED(ctx);
QOpenGLContext* glctx = QOpenGLContext::currentContext();
if (!glctx)
return NULL;
void *res = (void *)glctx->getProcAddress(QByteArray(name));
if (strcmp(name, "glMPGetNativeDisplay") == 0)
{
return (void *)&MPGetNativeDisplay;
}
#ifdef Q_OS_WIN32
// wglGetProcAddress(), which is used by Qt, does not always resolve all
// builtin functions with all drivers (only extensions). Qt compensates this
// for a degree, but does this only for functions Qt happens to need. So
// we need our own falback as well.
if (!res)
{
HMODULE handle = (HMODULE)QOpenGLContext::openGLModuleHandle();
if (handle)
res = (void *)GetProcAddress(handle, name);
}
#endif
return res;
}
示例6: 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
}
}
示例7: QGLMultiTextureExtensions
static QGLMultiTextureExtensions *resolveMultiTextureExtensions
(const QOpenGLContext *ctx)
{
Q_ASSERT(ctx);
if (!qt_multitexture_funcs)
qt_multitexture_funcs = new QGLMultiTextureExtensions();
if (!(qt_multitexture_funcs->multiTextureResolved)) {
qt_multitexture_funcs->multiTextureResolved = true;
if (!qt_multitexture_funcs->clientActiveTexture) {
QOpenGLContext *vctx = const_cast<QOpenGLContext*>(ctx);
qt_multitexture_funcs->clientActiveTexture = (q_PFNGLCLIENTACTIVETEXTUREPROC)
vctx->getProcAddress("glClientActiveTexture");
}
if (!qt_multitexture_funcs->clientActiveTexture) {
QOpenGLContext *vctx = const_cast<QOpenGLContext*>(ctx);
qt_multitexture_funcs->clientActiveTexture = (q_PFNGLCLIENTACTIVETEXTUREPROC)
vctx->getProcAddress("glClientActiveTextureARB");
}
}
return qt_multitexture_funcs;
}
示例8: invalidate
void QMapboxGLPrivate::invalidate()
{
// Map thread
if (!q_ptr->isExposed()) {
return;
}
if (!context) {
context.reset(new QOpenGLContext());
context->setFormat(q_ptr->requestedFormat());
context->create();
context->makeCurrent(q_ptr);
mbgl::gl::InitializeExtensions([](const char *name) {
QOpenGLContext *thisContext = QOpenGLContext::currentContext();
return thisContext->getProcAddress(name);
});
}
emit viewInvalidated();
}
示例9: get_proc_address
// This callback is called by VLC to get OpenGL functions.
static void* get_proc_address(void* data, const char* current)
{
VLCVideo* that = static_cast<VLCVideo*>(data);
QOpenGLContext *ctx = that->mWidget->context();
return reinterpret_cast<void*>(ctx->getProcAddress(current));
}
示例10: dumpOpenGLdiagnostics
// Debug info about OpenGL capabilities.
void StelMainView::dumpOpenGLdiagnostics() const
{
QOpenGLContext *context = QOpenGLContext::currentContext();
if (context)
{
context->functions()->initializeOpenGLFunctions();
qDebug() << "initializeOpenGLFunctions()...";
QOpenGLFunctions::OpenGLFeatures oglFeatures=context->functions()->openGLFeatures();
qDebug() << "OpenGL Features:";
qDebug() << " - glActiveTexture() function" << (oglFeatures&QOpenGLFunctions::Multitexture ? "is" : "is NOT") << "available.";
qDebug() << " - Shader functions" << (oglFeatures&QOpenGLFunctions::Shaders ? "are" : "are NOT ") << "available.";
qDebug() << " - Vertex and index buffer functions" << (oglFeatures&QOpenGLFunctions::Buffers ? "are" : "are NOT") << "available.";
qDebug() << " - Framebuffer object functions" << (oglFeatures&QOpenGLFunctions::Framebuffers ? "are" : "are NOT") << "available.";
qDebug() << " - glBlendColor()" << (oglFeatures&QOpenGLFunctions::BlendColor ? "is" : "is NOT") << "available.";
qDebug() << " - glBlendEquation()" << (oglFeatures&QOpenGLFunctions::BlendEquation ? "is" : "is NOT") << "available.";
qDebug() << " - glBlendEquationSeparate()" << (oglFeatures&QOpenGLFunctions::BlendEquationSeparate ? "is" : "is NOT") << "available.";
qDebug() << " - glBlendFuncSeparate()" << (oglFeatures&QOpenGLFunctions::BlendFuncSeparate ? "is" : "is NOT") << "available.";
qDebug() << " - Blend subtract mode" << (oglFeatures&QOpenGLFunctions::BlendSubtract ? "is" : "is NOT") << "available.";
qDebug() << " - Compressed texture functions" << (oglFeatures&QOpenGLFunctions::CompressedTextures ? "are" : "are NOT") << "available.";
qDebug() << " - glSampleCoverage() function" << (oglFeatures&QOpenGLFunctions::Multisample ? "is" : "is NOT") << "available.";
qDebug() << " - Separate stencil functions" << (oglFeatures&QOpenGLFunctions::StencilSeparate ? "are" : "are NOT") << "available.";
qDebug() << " - Non power of two textures" << (oglFeatures&QOpenGLFunctions::NPOTTextures ? "are" : "are NOT") << "available.";
qDebug() << " - Non power of two textures" << (oglFeatures&QOpenGLFunctions::NPOTTextureRepeat ? "can" : "CANNOT") << "use GL_REPEAT as wrap parameter.";
qDebug() << " - The fixed function pipeline" << (oglFeatures&QOpenGLFunctions::FixedFunctionPipeline ? "is" : "is NOT") << "available.";
qDebug() << "OpenGL shader capabilities and details:";
qDebug() << " - Vertex Shader:" << (QOpenGLShader::hasOpenGLShaders(QOpenGLShader::Vertex, context) ? "YES" : "NO");
qDebug() << " - Fragment Shader:" << (QOpenGLShader::hasOpenGLShaders(QOpenGLShader::Fragment, context) ? "YES" : "NO");
qDebug() << " - Geometry Shader:" << (QOpenGLShader::hasOpenGLShaders(QOpenGLShader::Geometry, context) ? "YES" : "NO");
qDebug() << " - TessellationControl Shader:" << (QOpenGLShader::hasOpenGLShaders(QOpenGLShader::TessellationControl, context) ? "YES" : "NO");
qDebug() << " - TessellationEvaluation Shader:" << (QOpenGLShader::hasOpenGLShaders(QOpenGLShader::TessellationEvaluation, context) ? "YES" : "NO");
qDebug() << " - Compute Shader:" << (QOpenGLShader::hasOpenGLShaders(QOpenGLShader::Compute, context) ? "YES" : "NO");
// GZ: List available extensions. Not sure if this is in any way useful?
QSet<QByteArray> extensionSet=context->extensions();
qDebug() << "We have" << extensionSet.count() << "OpenGL extensions:";
QMap<QString, QString> extensionMap;
QSetIterator<QByteArray> iter(extensionSet);
while (iter.hasNext())
{
if (!iter.peekNext().isEmpty()) {// Don't insert empty lines
extensionMap.insert(QString(iter.peekNext()), QString(iter.peekNext()));
}
iter.next();
}
QMapIterator<QString, QString> iter2(extensionMap);
while (iter2.hasNext()) {
qDebug() << " -" << iter2.next().key();
}
// Apparently EXT_gpu_shader4 is required for GLSL1.3. (http://en.wikipedia.org/wiki/OpenGL#OpenGL_3.0).
qDebug() << "EXT_gpu_shader4" << (extensionSet.contains(("EXT_gpu_shader4")) ? "present, OK." : "MISSING!");
QFunctionPointer programParameterPtr =context->getProcAddress("glProgramParameteri");
if (programParameterPtr == 0) {
qDebug() << "glProgramParameteri cannot be resolved here. BAD!";
}
programParameterPtr =context->getProcAddress("glProgramParameteriEXT");
if (programParameterPtr == 0) {
qDebug() << "glProgramParameteriEXT cannot be resolved here. BAD!";
}
}
else
{
qDebug() << "dumpOpenGLdiagnostics(): No OpenGL context";
}
}