7#include <QOpenGLContext>
12#include <QtGui/private/qglxconvenience_p.h>
14#include <qpa/qplatformsurface.h>
32 return DefaultRootWindow(
display());
61#if !defined(QT_NO_OPENGL) && QT_CONFIG(xcb_glx_plugin)
102#if !defined(QT_NO_OPENGL) && QT_CONFIG(xcb_glx_plugin)
106 QOffscreenX11GLXContext *glxPlatformContext =
static_cast<QOffscreenX11GLXContext *
>(
context->handle());
107 if (glxPlatformContext)
108 return glxPlatformContext->glxConfig();
113 QOffscreenX11GLXContext *glxPlatformContext =
static_cast<QOffscreenX11GLXContext *
>(
context->handle());
114 if (glxPlatformContext)
115 return glxPlatformContext->glxContext();
123Display *QOffscreenX11PlatformNativeInterface::display()
const
136 m_screenNumber = m_display ? DefaultScreen(m_display) : -1;
142 XCloseDisplay((
Display *)m_display);
149 return m_x11Info.
data();
152#if QT_CONFIG(xcb_glx_plugin)
153class QOffscreenX11GLXContextData
159 GLXContext shareContext =
nullptr;
160 GLXFBConfig
config =
nullptr;
166 Colormap cmap = XCreateColormap(x11->
display(), x11->
root(), visualInfo->visual, AllocNone);
167 XSetWindowAttributes
a;
175 0, visualInfo->
depth, InputOutput, visualInfo->visual,
176 CWBackPixel|CWBorderPixel|CWColormap, &
a);
177 XFreeColormap(x11->
display(), cmap);
183 XVisualInfo *visualInfo = glXGetVisualFromFBConfig(x11->
display(),
config);
185 qFatal(
"Could not initialize GLX");
192 :
d(new QOffscreenX11GLXContextData)
204 d->shareContext =
nullptr;
206 d->shareContext =
static_cast<QOffscreenX11GLXContext *
>(
context->shareHandle())->
d->context;
212 d->context = glXCreateNewContext(x11->
display(),
config, GLX_RGBA_TYPE,
d->shareContext,
true);
213 if (!
d->context &&
d->shareContext) {
214 d->shareContext =
nullptr;
216 d->context = glXCreateNewContext(x11->
display(),
config, GLX_RGBA_TYPE,
nullptr,
true);
228 qFatal(
"Could not initialize GLX");
229 d->context = glXCreateContext(x11->
display(), visualInfo,
d->shareContext,
true);
230 if (!
d->context &&
d->shareContext) {
232 d->shareContext =
nullptr;
233 d->context = glXCreateContext(x11->
display(), visualInfo,
nullptr,
true);
241QOffscreenX11GLXContext::~QOffscreenX11GLXContext()
243 glXDestroyContext(
d->x11->display(),
d->context);
244 XDestroyWindow(
d->x11->display(),
d->window);
251 XResizeWindow(
d->x11->display(),
d->window,
size.width(),
size.height());
252 XSync(
d->x11->display(),
true);
254 if (glXMakeCurrent(
d->x11->display(),
d->window,
d->context)) {
255 glViewport(0, 0,
size.width(),
size.height());
262void QOffscreenX11GLXContext::doneCurrent()
264 glXMakeCurrent(
d->x11->display(), 0,
nullptr);
271QFunctionPointer QOffscreenX11GLXContext::getProcAddress(
const char *procName)
273 return (QFunctionPointer)glXGetProcAddressARB(
reinterpret_cast<const GLubyte *
>(procName));
281bool QOffscreenX11GLXContext::isSharing()
const
283 return d->shareContext;
286bool QOffscreenX11GLXContext::isValid()
const
288 return d->context &&
d->window;
291GLXContext QOffscreenX11GLXContext::glxContext()
const
296void *QOffscreenX11GLXContext::glxConfig()
const
QByteArray toLower() const &
QScopedPointer< QPlatformNativeInterface > m_nativeInterface
bool hasCapability(QPlatformIntegration::Capability cap) const override
~QOffscreenX11Connection()
QOffscreenX11Connection()
QOffscreenX11Info * x11Info()
Display * display() const
QOffscreenX11Info(QOffscreenX11Connection *connection)
bool hasCapability(QPlatformIntegration::Capability cap) const override
QOffscreenX11PlatformNativeInterface * nativeInterface() const override
QOffscreenX11Integration(const QStringList ¶mList)
~QOffscreenX11Integration()
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
The QScreen class is used to query screen properties. \inmodule QtGui.
const QChar * constData() const
Returns a pointer to the data stored in the QString.
virtual QSize size() const =0
Returns the size of the surface in pixels.
[Window class with invokable method]
struct wl_display * display
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
static QString displayName(CGDirectDisplayID displayID)
DBusConnection * connection
void qglx_surfaceFormatFromGLXFBConfig(QSurfaceFormat *format, Display *display, GLXFBConfig config, int flags)
GLXFBConfig qglx_findConfig(Display *display, int screen, QSurfaceFormat format, bool highestPixelFormat, int drawableBit, int flags)
XVisualInfo * qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *format, int drawableBit, int flags)
static Window createDummyWindow(Display *dpy, XVisualInfo *visualInfo, int screenNumber, Window rootWin)
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum format
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)