From 176f30b13739b352cbe453cba7796d9a9c808bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 21 Jun 2011 13:39:26 +0200 Subject: OpenGL API refactor. Rename QGuiGLFormat to QSurfaceFormat, and make QWindow sub-class of QSurface and QPlatformWindow sub-class of QPlatformSurface, instead of having QPlatformGLSurface accessor in QWindow. --- examples/opengl/hellowindow/hellowindow.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'examples/opengl/hellowindow/hellowindow.cpp') diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index a88fcf1edb6..afdf08026af 100644 --- a/examples/opengl/hellowindow/hellowindow.cpp +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -15,7 +15,7 @@ Renderer::Renderer() m_context = new QGuiGLContext(m_format); } -QGuiGLFormat Renderer::format() const +QSurfaceFormat Renderer::format() const { return m_format; } @@ -24,10 +24,9 @@ HelloWindow::HelloWindow(Renderer *renderer) : m_colorIndex(0) , m_renderer(renderer) { - setSurfaceType(OpenGLSurface); setWindowTitle(QLatin1String("Hello Window")); - setGLFormat(renderer->format()); + setFormat(renderer->format()); setGeometry(QRect(10, 10, 640, 480)); @@ -62,13 +61,13 @@ void HelloWindow::updateColor() void HelloWindow::render() { - if (glSurface()) - m_renderer->render(glSurface(), m_color, geometry().size()); + m_renderer->render(this, m_color, geometry().size()); } -void Renderer::render(QPlatformGLSurface *surface, const QColor &color, const QSize &viewSize) +void Renderer::render(QSurface *surface, const QColor &color, const QSize &viewSize) { - m_context->makeCurrent(surface); + if (!m_context->makeCurrent(surface)) + return; if (!m_initialized) { initialize(); -- cgit v1.2.3