Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/opengl/KisOpenGLModeProber.cpp
Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | |||||
117 | 117 | | |||
118 | boost::optional<KisOpenGLModeProber::Result> | 118 | boost::optional<KisOpenGLModeProber::Result> | ||
119 | KisOpenGLModeProber::probeFormat(const QSurfaceFormat &format, bool adjustGlobalState) | 119 | KisOpenGLModeProber::probeFormat(const QSurfaceFormat &format, bool adjustGlobalState) | ||
120 | { | 120 | { | ||
121 | QScopedPointer<AppAttributeSetter> sharedContextSetter; | 121 | QScopedPointer<AppAttributeSetter> sharedContextSetter; | ||
122 | QScopedPointer<AppAttributeSetter> glSetter; | 122 | QScopedPointer<AppAttributeSetter> glSetter; | ||
123 | QScopedPointer<AppAttributeSetter> glesSetter; | 123 | QScopedPointer<AppAttributeSetter> glesSetter; | ||
124 | QScopedPointer<SurfaceFormatSetter> formatSetter; | 124 | QScopedPointer<SurfaceFormatSetter> formatSetter; | ||
125 | QScopedPointer<QApplication> application; | 125 | QScopedPointer<QGuiApplication> application; | ||
126 | 126 | | |||
127 | int argc = 1; | 127 | int argc = 1; | ||
128 | QByteArray probeAppName("krita"); | 128 | QByteArray probeAppName("krita"); | ||
129 | char *argv = probeAppName.data(); | 129 | char *argv = probeAppName.data(); | ||
130 | 130 | | |||
131 | 131 | | |||
132 | 132 | | |||
133 | if (adjustGlobalState) { | 133 | if (adjustGlobalState) { | ||
134 | sharedContextSetter.reset(new AppAttributeSetter(Qt::AA_ShareOpenGLContexts, false)); | 134 | sharedContextSetter.reset(new AppAttributeSetter(Qt::AA_ShareOpenGLContexts, false)); | ||
135 | 135 | | |||
136 | if (format.renderableType() != QSurfaceFormat::DefaultRenderableType) { | 136 | if (format.renderableType() != QSurfaceFormat::DefaultRenderableType) { | ||
137 | glSetter.reset(new AppAttributeSetter(Qt::AA_UseDesktopOpenGL, format.renderableType() != QSurfaceFormat::OpenGLES)); | 137 | glSetter.reset(new AppAttributeSetter(Qt::AA_UseDesktopOpenGL, format.renderableType() != QSurfaceFormat::OpenGLES)); | ||
138 | glesSetter.reset(new AppAttributeSetter(Qt::AA_UseOpenGLES, format.renderableType() == QSurfaceFormat::OpenGLES)); | 138 | glesSetter.reset(new AppAttributeSetter(Qt::AA_UseOpenGLES, format.renderableType() == QSurfaceFormat::OpenGLES)); | ||
139 | } | 139 | } | ||
140 | 140 | | |||
141 | formatSetter.reset(new SurfaceFormatSetter(format)); | 141 | formatSetter.reset(new SurfaceFormatSetter(format)); | ||
142 | application.reset(new QApplication(argc, &argv)); | 142 | | ||
143 | QGuiApplication::setDesktopSettingsAware(false); | ||||
144 | application.reset(new QGuiApplication(argc, &argv)); | ||||
145 | QGuiApplication::setDesktopSettingsAware(true); | ||||
143 | } | 146 | } | ||
144 | 147 | | |||
145 | QWindow surface; | 148 | QWindow surface; | ||
146 | surface.setFormat(format); | 149 | surface.setFormat(format); | ||
147 | surface.setSurfaceType(QSurface::OpenGLSurface); | 150 | surface.setSurfaceType(QSurface::OpenGLSurface); | ||
148 | surface.create(); | 151 | surface.create(); | ||
149 | QOpenGLContext context; | 152 | QOpenGLContext context; | ||
150 | context.setFormat(format); | 153 | context.setFormat(format); | ||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |