summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond.kjernasen@nokia.com>2010-07-05 12:15:57 (GMT)
committerTrond Kjernåsen <trond.kjernasen@nokia.com>2010-07-05 12:15:57 (GMT)
commit40c8aba524831dd0d2f8dfcdf07797f5c2c47f5b (patch)
tree2b386c4124483da9317cb3a7b4bc31d9545b544b /src/opengl
parent21158f7b31b6053b4c704f434f3f480328a0ba65 (diff)
downloadQt-40c8aba524831dd0d2f8dfcdf07797f5c2c47f5b.zip
Qt-40c8aba524831dd0d2f8dfcdf07797f5c2c47f5b.tar.gz
Qt-40c8aba524831dd0d2f8dfcdf07797f5c2c47f5b.tar.bz2
QGLPixelBuffer should not rely on temporary QGLWidgets.
Use QGLTemporaryContext instead. Also, to re-use already registered window classes for the temporary native window, make qt_reg_wndclass() register a QWidget default class if it's passed a 0 pointer. Reviewed-by: Gunnar
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qglpixelbuffer_win.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/opengl/qglpixelbuffer_win.cpp b/src/opengl/qglpixelbuffer_win.cpp
index 8d0d105..df83566 100644
--- a/src/opengl/qglpixelbuffer_win.cpp
+++ b/src/opengl/qglpixelbuffer_win.cpp
@@ -239,8 +239,7 @@ static void qt_format_to_attrib_list(bool has_render_texture, const QGLFormat &f
bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget)
{
- QGLWidget dmy;
- dmy.makeCurrent(); // needed for wglGetProcAddress() to succeed
+ QGLTemporaryContext tempContext;
PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB =
(PFNWGLCREATEPBUFFERARBPROC) wglGetProcAddress("wglCreatePbufferARB");
@@ -254,7 +253,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
if (!wglCreatePbufferARB) // assumes that if one can be resolved, all of them can
return false;
- dc = GetDC(dmy.winId());
+ dc = wglGetCurrentDC();
Q_ASSERT(dc);
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB =
@@ -284,7 +283,6 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
if (num_formats == 0) {
qWarning("QGLPixelBuffer: Unable to find a pixel format with pbuffer - giving up.");
- ReleaseDC(dmy.winId(), dc);
return false;
}
format = pfiToQGLFormat(dc, pixel_format);
@@ -303,12 +301,10 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
has_render_texture = false;
if (!pbuf) {
qWarning("QGLPixelBuffer: Unable to create pbuffer [w=%d, h=%d] - giving up.", size.width(), size.height());
- ReleaseDC(dmy.winId(), dc);
return false;
}
}
- ReleaseDC(dmy.winId(), dc);
dc = wglGetPbufferDCARB(pbuf);
ctx = wglCreateContext(dc);