summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-08-06 13:10:20 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-08-06 13:10:20 (GMT)
commit47bed030ffedded5914d8309bf2e1cccc1fd78d0 (patch)
tree6e497e442549b6bc405995a4a2b45c6ce6b600f0 /src/plugins/platforms
parent1d8ce23abdb0bd980292e4a9c8d87c019585150a (diff)
downloadQt-47bed030ffedded5914d8309bf2e1cccc1fd78d0.zip
Qt-47bed030ffedded5914d8309bf2e1cccc1fd78d0.tar.gz
Qt-47bed030ffedded5914d8309bf2e1cccc1fd78d0.tar.bz2
Added reduced config to glxconfig
should help if there are not many glxconfigs available. Also made QGLTemporaryContext use a QWidget again instead of a QGLWidget; This allows us to ask for a smaller window size before making the context.
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/testlite/qglxintegration.cpp68
-rw-r--r--src/plugins/platforms/testlite/qglxintegration.h1
2 files changed, 50 insertions, 19 deletions
diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp
index 050643c..ba161c1 100644
--- a/src/plugins/platforms/testlite/qglxintegration.cpp
+++ b/src/plugins/platforms/testlite/qglxintegration.cpp
@@ -113,28 +113,33 @@ QVector<int> QGLXGLContext::buildSpec(const QPlatformWindowFormat &format)
GLXFBConfig QGLXGLContext::findConfig(const MyDisplay *xd, const QPlatformWindowFormat &format)
{
- QVector<int> spec = buildSpec(format);
- int confcount = 0;
- GLXFBConfig *configs;
+ bool reduced = true;
GLXFBConfig chosenConfig = 0;
- configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount);
- if (confcount)
- {
- for (int i = 0; i < confcount; i++) {
- chosenConfig = configs[i];
-
- // Make sure we try to get an ARGB visual if the format asked for an alpha:
- if (format.alpha()) {
- int alphaSize;
- glXGetFBConfigAttrib(xd->display,configs[i],GLX_ALPHA_SIZE,&alphaSize);
- if (alphaSize > 0)
- break;
- } else {
- break; // Just choose the first in the list if there's no alpha requested
+ QPlatformWindowFormat reducedFormat = format;
+ while (!chosenConfig && reduced) {
+ QVector<int> spec = buildSpec(reducedFormat);
+ int confcount = 0;
+ GLXFBConfig *configs;
+ configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount);
+ if (confcount)
+ {
+ for (int i = 0; i < confcount; i++) {
+ chosenConfig = configs[i];
+
+ // Make sure we try to get an ARGB visual if the format asked for an alpha:
+ if (format.alpha()) {
+ int alphaSize;
+ glXGetFBConfigAttrib(xd->display,configs[i],GLX_ALPHA_SIZE,&alphaSize);
+ if (alphaSize > 0)
+ break;
+ } else {
+ break; // Just choose the first in the list if there's no alpha requested
+ }
}
- }
- XFree(configs);
+ XFree(configs);
+ }
+ reducedFormat = reducePlatformWindowFormat(format,&reduced);
}
if (!chosenConfig)
@@ -206,6 +211,31 @@ QPlatformWindowFormat QGLXGLContext::platformWindowFromGLXFBConfig(Display *disp
return format;
}
+QPlatformWindowFormat QGLXGLContext::reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced)
+{
+ QPlatformWindowFormat retFormat = format;
+ *reduced = true;
+
+ if (retFormat.sampleBuffers()) {
+ retFormat.setSampleBuffers(false);
+ } else if (retFormat.stereo()) {
+ retFormat.setStereo(false);
+ } else if (retFormat.accum()) {
+ retFormat.setAccum(false);
+ }else if (retFormat.stencil()) {
+ retFormat.setStencil(false);
+ }else if (retFormat.alpha()) {
+ retFormat.setAlpha(false);
+ }else if (retFormat.depth()) {
+ retFormat.setDepth(false);
+ }else if (retFormat.doubleBuffer()) {
+ retFormat.setDoubleBuffer(false);
+ }else{
+ *reduced = false;
+ }
+ return retFormat;
+}
+
QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format)
: QPlatformGLContext()
, m_xd(xd)
diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h
index 562967a..479be4b 100644
--- a/src/plugins/platforms/testlite/qglxintegration.h
+++ b/src/plugins/platforms/testlite/qglxintegration.h
@@ -75,6 +75,7 @@ private:
static GLXFBConfig findConfig(const MyDisplay *xd,const QPlatformWindowFormat &format);
static QVector<int> buildSpec(const QPlatformWindowFormat &format);
static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context);
+ static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced);
MyDisplay *m_xd;