summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fixed an assert when running the composition demo on Mac.Trond Kjernåsen2009-10-201-16/+19
| | | | | | | We can't create a QGLWidget in the QGLEngineSelector, since it may be called before a QApplication object has been constructed. Reviewed-by: Kim
* Separate modification & destruction pixmap cleanup hooksTom Cooksey2009-10-191-4/+17
| | | | | | | | | | | | | Before the QExplicitlySharedDataPointer change, the ref-count was 0 when calling the cleanup hooks from ~QPixmap. That enabled the hook to figure out if the pixmap is being modified or deleted. As the ref count is now 1 when calling the cleanup hooks in ~QPixmap, we need to seperate the hooks. This change should make using textre-from-pixmap faster as the EGL/glX surface wont get re-created everytime the pixmap is modified. Reviewed-By: Gunnar
* Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6Gunnar Sletta2009-10-191-15/+8
|\
| * Remove unnecessary QWSGLPaintDevice now that we have QGLPaintDeviceRhys Weatherley2009-10-151-1/+0
| | | | | | | | Reviewed-by: Tom
| * Centralize all GL paint engine creations into qt_qgl_paint_engine()Rhys Weatherley2009-10-151-14/+8
| | | | | | | | | | | | | | | | | | The qt_qgl_paint_engine() function was being used by QWS, but there's no reason why it can't be used by other platforms too. This should also fix ES 2.0 paint engine support under QWS, which was stubbed out. Reviewed-by: Sarah Smith Reviewed-by: Gunnar
| * Work around broken ATI X1600 drivers on Mac OS XGunnar Sletta2009-10-131-1/+19
| | | | | | | | | | | | | | | | | | | | The GLSL implementation messes up return values from functions so that all our srcPixel()'s become black and several matrices are off. We don't want to rewrite the shader code to fit an "ancient" graphics card, so we simply fall back to the GL 1 engine. Reviewed-by: Trond (cherry picked from commit 33ed3d0bacddce214a43be60eb6481903e753a88)
* | Optimized QPixmap::fill for GL backend when pixmap is used as is.Samuel Rødal2009-10-151-19/+27
| | | | | | | | | | | | | | | | | | When QGLPixmapData is bound after a fill(), without being painted on in the mean-time, it's cheaper to directly generate a source image than to go through convertToGLFormat(), since all the pixels in the image will have the same value. Reviewed-by: Trond
* | Fixed buggy bitmap drawing in GL 2 engine on X11.Samuel Rødal2009-10-151-1/+1
| | | | | | | | | | | | Don't use texture_from_pixmap extension for QBitmaps. Reviewed-by: Tom
* | Work around broken ATI X1600 drivers on Mac OS XGunnar Sletta2009-10-131-1/+19
|/ | | | | | | | | The GLSL implementation messes up return values from functions so that all our srcPixel()'s become black and several matrices are off. We don't want to rewrite the shader code to fit an "ancient" graphics card, so we simply fall back to the GL 1 engine. Reviewed-by: Trond
* Fixed an assert occuring on X11 when destroying QPixmaps under GL.Trond Kjernåsen2009-10-061-2/+4
| | | | | | | The cleanup code for the QX11PixmapData was called incorrectly for QGLPixmapData. Reviewed-by: Samuel
* Fixed the X11 error output from the demos/boxes demo.Trond Kjernåsen2009-10-061-0/+5
| | | | | | | | | After we started caching the current context internally, it revealed an old bug: when a QGLWidget is reparented under X11, it will get a new window id, but its context will still be bound to the old window, so we need to rebind it. Reviewed-by: Samuel
* Merge QGLContextReference into QGLContextGroupRhys Weatherley2009-10-041-22/+42
| | | | Reviewed-by: trustme
* Move QGLContextResource management into QGLContextGroupRhys Weatherley2009-10-041-84/+25
| | | | | | | | | Context resources are per-group, so they should be managed by the group. This should also improve performance of context shutdown slightly by removing QGLSignalProxy::aboutToDestroyContext() signal dispatches to the resources. Reviewed-by: trustme
* Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6Gunnar Sletta2009-10-021-32/+41
|\
| * Remove QHash overhead from QGLShareRegisterRhys Weatherley2009-10-021-22/+18
| | | | | | | | | | | | | | Move the list of shared contexts from QGLShareRegister into QGLContextGroup. There is then no need for the QHash. Reviewed-by: trustme
| * Doc: Mark new overloads with \since 4.6.Volker Hilsheimer2009-10-011-1/+6
| |
| * QGLContext::areSharing() to check for GL share relationshipsRhys Weatherley2009-10-011-6/+15
| | | | | | | | Reviewed-by: Samuel
| * Fix EGL/GLX surface leak when using texture-from-pixmapTom Cooksey2009-09-291-3/+2
| | | | | | | | | | | | | | | | | | The QScopedPointer changes mean that the pixmap data's reference count is now decremented after the cleanup hooks are called. The hooks should also only be called when the pixmap data gets deleted, so we don't actually have to check the reference count at all. Reviewed-by: TrustMe
* | Added timings to the QGL_BIND_TEXTURE_DEBUG debug outputsGunnar Sletta2009-10-021-8/+20
|/ | | | Reviewed-by: TrustMe
* Fixed a crash in the boxes demo when using -graphicssystem opengl.Trond Kjernaasen2009-09-281-1/+1
| | | | | | | | | | | | Several problems: 1. The demo leaked the scene contents, which caused cleanup problems. 2. The QGLContext::currentContext() could be changed behind Qt's back under Windows (the temp contexts never reset the current context). 3. QGLFormat::openGLVersionFlags() function would return uninitialized flags if the QGLWidget constructor happened to call qt_gl_preferGL2Engine(). Reviewed-by: Kim
* QGLContext::drawTexture() is not supported under OpenGL/ES 2.0Rhys Weatherley2009-09-281-2/+15
| | | | Reviewed-by: trustme
* Start to separate the EGLSurface from QEglContext in QtOpenGLRhys Weatherley2009-09-241-0/+1
| | | | | | | Also, move the EGL makeCurrent(), doneCurrent(), swapBuffers(), and reset() functions into the common qgl_egl.cpp. Reviewed-by: Sarah Smith
* qdoc: QGLContext::drawTexture referring to itself.Rhys Weatherley2009-09-171-4/+0
|
* Performance: reduce TLS overhead of QGLContext::currentContext()Rhys Weatherley2009-09-141-3/+24
| | | | | | | | | | | | | The handling for the current QGLContext was looking up the same TLS data several times per call (hasLocalData() and localData() calls particularly). This change also refactors the code a little so that the setting of the QGLContext within makeCurrent() and doneCurrent() is in one location in the code instead of six (one per platform). Reviewed-by: Michael Brasser Reviewed-by: Sarah Smith
* qdoc: QGLWidget::colormap() returns a QGLColormap, not a QColormapRhys Weatherley2009-09-141-2/+2
|
* Use redF(), etc when setting GL colorsRhys Weatherley2009-09-141-5/+3
| | | | Reviewed-by: Sarah Smith
* qdoc: QGLFormat documentation improvementsRhys Weatherley2009-09-141-5/+9
|
* qdoc: QGLWidgets -> QGLWidget, etc, for proper doc linking.Rhys Weatherley2009-09-131-10/+10
|
* QGLWidget::fontDisplayListBase() is not supported under OpenGL/ESRhys Weatherley2009-09-131-2/+8
| | | | | | Update documentation and #ifdef out the implementation. Reviewed-by: trustme
* qdoc: qglColor() doesn't work under OpenGL/ES 2.0Rhys Weatherley2009-09-131-0/+4
|
* Make QGLWidget::renderText() desktop onlyRhys Weatherley2009-09-131-175/+72
| | | | | | | | | The renderText() function is only for legacy desktop systems, so revert the previous attempts to port it to OpenGL/ES. Documentation note added to direct users to QPainter::drawText() for the correct way to render text onto an OpenGL paint device. Reviewed-by: trustme
* Make mipmaps work on OpenGL/ES 2.0Rhys Weatherley2009-09-111-0/+12
| | | | Reviewed-by: Gunnar
* Dump texture formats in hex, not decimalRhys Weatherley2009-09-111-2/+2
| | | | Reviewed-by: trustme
* Recognize the OES_packed_depth_stencil extensionRhys Weatherley2009-09-111-0/+4
| | | | Reviewed-by: trustme
* Resolve ARB_framebuffer_object and OES_framebuffer_object extensionsRhys Weatherley2009-09-101-0/+9
| | | | Reviewed-by: trustme
* Upload texturedata in matching internal format..Gunnar Sletta2009-09-101-12/+26
| | | | Reviewed-by: Tom
* Fixed crash on shutdown with GL when leaking QGLWidgetsGunnar Sletta2009-09-101-2/+7
| | | | | | | | The problem was the QGLContextResource destructor which was called when the QtOpenGL dll was unloaded. At this point in time, the gl driver had already been unloaded so any gl calls at this point in time would crash. It is simply wrong for the destructor to try to clean up, so we instead output a warning if resources are leaked.
* Suppress warnings in QtOpenGL on OpenGL/ES 1.1 systemsRhys Weatherley2009-09-091-2/+5
| | | | Reviewed-by: trustme
* Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6Rhys Weatherley2009-09-091-4/+4
|\
| * Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | | | | | Reviewed-by: Trust Me
* | Clean up shader programs properlyRhys Weatherley2009-09-091-0/+29
|/ | | | | | | | | | | | | | | QGLShader and QGLShaderProgram used to delete the GL object id in the wrong context. But fixing this means we must keep track of when contexts are destroyed so that we don't try to access a context from a shader if it goes away. We also need to transfer ownership from one context to another when they are shared. This change introduces QGLSharedResourceGuard, which keeps track of a context and a GL object identifier. When the context goes away, ownership is passed to a shared context. When there are no more shared contexts, the identifier automatically zeroes. Reviewed-by: trustme
* Cleanup of QGLPaintDevice before it goes inTom Cooksey2009-09-081-237/+0
| | | | | | | | | This is the last patch in the QGLPaintDevice series. Although previous patches have not been reviewed individually, Samuel's reviewed QGLPaintDevice API and all the changes as the code stands with this patch. Reviewed-by: Samuel
* Move buffer clear out of the paint engine and into the QGLPaintDevicesTom Cooksey2009-09-081-5/+4
| | | | | | | | | | | | Previously, the paint engine cleared the surface's buffers in begin. This logic really belongs in QGLPaintDevice::beginPaint as not all paint devices will want this behaviour (in fact most don't). This also makes QGLPaintDevice API much simpler as the virtual getters for the clear color, etc. can be removed. It's much cleaner this way. The only possible problem is with the GL1 engine, which also cleared the accumulation & depth buffers in begin. However, the engine will also clear the depth buffer later as part of it's clipping logic. It also doesn't use the accumulation buffer, so clearing it seems unnessisary.
* Replace QGLDrawable with a new QGLPaintDeviceTom Cooksey2009-09-081-1/+4
| | | | | | | | | | | | | | | | | This patch adds a new abstract base class which inherits from QPaintDevice called QGLPaintDevice. This base class will contain everything the GL paint engines need to know about the surface they are drawing onto. As such, new surfaces can be targeted by the GL paint engines without having to modify QtOpenGL. This is very useful for plugins, specifically QGraphicsSystem plugins. To unify things a little, the GL paint engines will use the same QGLPaintDevice API to render into existing target surfaces (QGLWidget, QGLPixelBuffer & QGLFrameBufferObject). Ideally we'd make QGLPaintDevice a common ancestor for these surfaces, but obviously that wil break B/C. This patch only implements QGLWidget using the new interface. Rendering to other surfaces will be fixed in following patches.
* Added a public function to enforce usage og the old GL engine.Trond Kjernåsen2009-09-081-0/+68
| | | | | | | | | | | Some applications that uses a mix of OpenGL and QPainter code may not work correctly with the new GL 2 engine (e.g. the composition demo). The same is most likely also true for user apps, therefore we need a way to enforce the usage of the old GL 1 engine for the sake of compatibility. Task-number: 260872 Reviewed-by: Samuel
* Texture format must be GL_RGB when pixel type is GL_UNSIGNED_SHORT_5_6_5Rhys Weatherley2009-09-081-0/+1
| | | | | | | | | | | | QImage::Format_RGB16 textures were broken on some OpenGL/ES 1.1 systems because the "format" was set to GL_RGBA and the "texture_format" was set to GL_RGB, with a pixel type of GL_UNSIGNED_SHORT_5_6_5. OpenGL/ES 1.1, ES 2.0, and desktop GL all require the two format parameters to glTexImage2D() to be GL_RGB if the pixel type is GL_UNSIGNED_SHORT_5_6_5. Reviewed-by: Sarah Smith
* Make the matrix and viewport logic in renderText() a bit betterRhys Weatherley2009-09-081-50/+137
| | | | | | | The original renderText() was using the highly unportable (to OpenGL/ES) glGetDoublev() and glGetIntegerv() functions. Reviewed-by: Sarah Smith
* qdoc: improve the QGLFormat documentationRhys Weatherley2009-09-071-17/+20
| | | | Reviewed-by: trustme
* Performance: Convert QGLFormat to use implicit sharingRhys Weatherley2009-09-071-4/+34
| | | | | | | | | | | | QGLFormat was being deep-copied many times per frame because of code like this: if (context()->format().doubleBuffer()) { ... This change modifies QGLFormat to use implicit sharing to reduce the overhead of the above type of checks. Reviewed-by: Sarah Smith
* Update QGLFormat::operator== to include all fields.Rhys Weatherley2009-09-061-1/+6
| | | | | | | The documentation says "Returns true if all the options of the two QGLFormats are equal", but that's not what it was doing. Reviewed-by: Sarah Smith