summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-05-14 12:07:51 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-06-01 08:12:14 (GMT)
commitf3a920be362b85d248a9b76c1b15a0b096d7c90e (patch)
tree4b2d4c33ae0cc67cd731ba474f3153699c74928a /src/opengl
parent28580117adf5149e7ca15a43a398b412f4ec0ab4 (diff)
downloadQt-f3a920be362b85d248a9b76c1b15a0b096d7c90e.zip
Qt-f3a920be362b85d248a9b76c1b15a0b096d7c90e.tar.gz
Qt-f3a920be362b85d248a9b76c1b15a0b096d7c90e.tar.bz2
gl on openkode. QGLWidget only works for toplevel widgets
and QGLWindowSurface is used for anything else
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/opengl.pro10
-rw-r--r--src/opengl/qgl_lite.cpp104
2 files changed, 3 insertions, 111 deletions
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 6eb4ebe..53f9d3e 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -77,16 +77,12 @@ SOURCES += qgl.cpp \
}
embedded_lite {
+ DEFINES += QT_NO_EGL
+
SOURCES += qgl_lite.cpp
HEADERS += qglplatformintegration_lite.h
- # If we have EGL, use the EGL implementation of QGLPixelBuffer, otherwise we just provide
- # a stubbed out one. PBuffers aren't too interesting anyway.
- contains(QT_CONFIG, egl) {
- SOURCES += qglpixelbuffer_egl.cpp
- } else {
- SOURCES += qglpixelbuffer_stub.cpp
- }
+ SOURCES += qglpixelbuffer_stub.cpp
}
x11 {
diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp
index 426683b..636c711 100644
--- a/src/opengl/qgl_lite.cpp
+++ b/src/opengl/qgl_lite.cpp
@@ -49,110 +49,6 @@
#include "qgl_p.h"
#include "qglplatformintegration_lite.h"
-#ifndef QT_NO_EGL
-#include "qgl_egl_p.h"
-
-void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLFormat& glFormat)
-{
- int redSize = glFormat.redBufferSize();
- int greenSize = glFormat.greenBufferSize();
- int blueSize = glFormat.blueBufferSize();
- int alphaSize = glFormat.alphaBufferSize();
- int depthSize = glFormat.depthBufferSize();
- int stencilSize = glFormat.stencilBufferSize();
- int sampleCount = glFormat.samples();
-
- // QGLFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that
- // type has been requested. So we must check QGLFormat's booleans too if size is -1:
- if (glFormat.alpha() && alphaSize <= 0)
- alphaSize = 1;
- if (glFormat.depth() && depthSize <= 0)
- depthSize = 1;
- if (glFormat.stencil() && stencilSize <= 0)
- stencilSize = 1;
- if (glFormat.sampleBuffers() && sampleCount <= 0)
- sampleCount = 1;
-
- // We want to make sure 16-bit configs are chosen over 32-bit configs as they will provide
- // the best performance. The EGL config selection algorithm is a bit stange in this regard:
- // The selection criteria for EGL_BUFFER_SIZE is "AtLeast", so we can't use it to discard
- // 32-bit configs completely from the selection. So it then comes to the sorting algorithm.
- // The red/green/blue sizes have a sort priority of 3, so they are sorted by first. The sort
- // order is special and described as "by larger _total_ number of color bits.". So EGL will
- // put 32-bit configs in the list before the 16-bit configs. However, the spec also goes on
- // to say "If the requested number of bits in attrib_list for a particular component is 0,
- // then the number of bits for that component is not considered". This part of the spec also
- // seems to imply that setting the red/green/blue bits to zero means none of the components
- // are considered and EGL disregards the entire sorting rule. It then looks to the next
- // highest priority rule, which is EGL_BUFFER_SIZE. Despite the selection criteria being
- // "AtLeast" for EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are
- // put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit,
- // we must set the red/green/blue sizes to zero. This has an unfortunate consequence that
- // if the application sets the red/green/blue size to 5/6/5 on the QGLFormat, they will
- // probably get a 32-bit config, even when there's an RGB565 config avaliable. Oh well.
-
- // Now normalize the values so -1 becomes 0
- redSize = redSize > 0 ? redSize : 0;
- greenSize = greenSize > 0 ? greenSize : 0;
- blueSize = blueSize > 0 ? blueSize : 0;
- alphaSize = alphaSize > 0 ? alphaSize : 0;
- depthSize = depthSize > 0 ? depthSize : 0;
- stencilSize = stencilSize > 0 ? stencilSize : 0;
- sampleCount = sampleCount > 0 ? sampleCount : 0;
-
- eglProperties.setValue(EGL_RED_SIZE, redSize);
- eglProperties.setValue(EGL_GREEN_SIZE, greenSize);
- eglProperties.setValue(EGL_BLUE_SIZE, blueSize);
- eglProperties.setValue(EGL_ALPHA_SIZE, alphaSize);
- eglProperties.setValue(EGL_DEPTH_SIZE, depthSize);
- eglProperties.setValue(EGL_STENCIL_SIZE, stencilSize);
- eglProperties.setValue(EGL_SAMPLES, sampleCount);
- eglProperties.setValue(EGL_SAMPLE_BUFFERS, sampleCount ? 1 : 0);
-}
-
-// Updates "format" with the parameters of the selected configuration.
-void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config)
-{
- EGLint redSize = 0;
- EGLint greenSize = 0;
- EGLint blueSize = 0;
- EGLint alphaSize = 0;
- EGLint depthSize = 0;
- EGLint stencilSize = 0;
- EGLint sampleCount = 0;
- EGLint level = 0;
-
- EGLDisplay display = QEgl::display();
- eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize);
- eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize);
- eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &blueSize);
- eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaSize);
- eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize);
- eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize);
- eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount);
- eglGetConfigAttrib(display, config, EGL_LEVEL, &level);
-
- format.setRedBufferSize(redSize);
- format.setGreenBufferSize(greenSize);
- format.setBlueBufferSize(blueSize);
- format.setAlphaBufferSize(alphaSize);
- format.setDepthBufferSize(depthSize);
- format.setStencilBufferSize(stencilSize);
- format.setSamples(sampleCount);
- format.setPlane(level + 1); // EGL calls level 0 "normal" whereas Qt calls 1 "normal"
- format.setDirectRendering(true); // All EGL contexts are direct-rendered
- format.setRgba(true); // EGL doesn't support colour index rendering
- format.setStereo(false); // EGL doesn't support stereo buffers
- format.setAccumBufferSize(0); // EGL doesn't support accululation buffers
-
- // Clear the EGL error state because some of the above may
- // have errored out because the attribute is not applicable
- // to the surface type. Such errors don't matter.
- eglGetError();
-}
-#endif
-
-
QT_BEGIN_NAMESPACE
QPlatformGLContext::QPlatformGLContext()