From patchwork Wed Nov 30 11:04:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 5395 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 84FF424017 for ; Wed, 30 Nov 2011 11:04:18 +0000 (UTC) Received: from mail-lpp01m010-f52.google.com (mail-lpp01m010-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 4ACD6A18218 for ; Wed, 30 Nov 2011 11:04:18 +0000 (UTC) Received: by laah2 with SMTP id h2so207251laa.11 for ; Wed, 30 Nov 2011 03:04:18 -0800 (PST) Received: by 10.152.135.179 with SMTP id pt19mr898274lab.47.1322651057951; Wed, 30 Nov 2011 03:04:17 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.41.198 with SMTP id h6cs7690lal; Wed, 30 Nov 2011 03:04:17 -0800 (PST) Received: by 10.216.30.209 with SMTP id k59mr241975wea.11.1322651055491; Wed, 30 Nov 2011 03:04:15 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ey2si524764wbb.130.2011.11.30.03.04.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Nov 2011 03:04:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1RVhxX-00083z-53 for ; Wed, 30 Nov 2011 11:04:15 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 1C11AE04E0 for ; Wed, 30 Nov 2011 11:04:15 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 171 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 171: CanvasX11: Call glViewport() only after binding a GL context. Message-Id: <20111130110415.13230.90389.launchpad@ackee.canonical.com> Date: Wed, 30 Nov 2011 11:04:15 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14404"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 8c20b5d9a987dd4a89cf8999e31f00059a1aac74 ------------------------------------------------------------ revno: 171 committer: Alexandros Frantzis branch nick: trunk timestamp: Thu 2011-11-24 17:52:33 +0200 message: CanvasX11: Call glViewport() only after binding a GL context. modified: src/canvas-x11.cpp src/canvas-x11.h --- lp:glmark2 https://code.launchpad.net/~glmark2-dev/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription === modified file 'src/canvas-x11.cpp' --- src/canvas-x11.cpp 2011-11-01 16:46:08 +0000 +++ src/canvas-x11.cpp 2011-11-24 15:52:33 +0000 @@ -40,7 +40,7 @@ if (!xdpy_) return false; - resize(width_, height_); + resize_no_viewport(width_, height_); if (!xwin_) return false; @@ -55,6 +55,8 @@ return false; } + glViewport(0, 0, width_, height_); + glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glEnable(GL_CULL_FACE); @@ -159,26 +161,8 @@ void CanvasX11::resize(int width, int height) { - /* Recreate an existing window only if it has actually been resized */ - if (xwin_) { - if (width_ != width || height_ != height) { - XDestroyWindow(xdpy_, xwin_); - xwin_ = 0; - } - else { - return; - } - } - - width_ = width; - height_ = height; - - if (!ensure_x_window()) - Log::error("Error: Couldn't create X Window!\n"); - + resize_no_viewport(width, height); glViewport(0, 0, width_, height_); - projection_ = LibMatrix::Mat4::perspective(60.0, width_ / static_cast(height_), - 1.0, 1024.0); } bool @@ -273,3 +257,27 @@ return true; } +void +CanvasX11::resize_no_viewport(int width, int height) +{ + /* Recreate an existing window only if it has actually been resized */ + if (xwin_) { + if (width_ != width || height_ != height) { + XDestroyWindow(xdpy_, xwin_); + xwin_ = 0; + } + else { + return; + } + } + + width_ = width; + height_ = height; + + if (!ensure_x_window()) + Log::error("Error: Couldn't create X Window!\n"); + + projection_ = LibMatrix::Mat4::perspective(60.0, width_ / static_cast(height_), + 1.0, 1024.0); +} + === modified file 'src/canvas-x11.h' --- src/canvas-x11.h 2011-11-01 16:49:42 +0000 +++ src/canvas-x11.h 2011-11-24 15:52:33 +0000 @@ -91,6 +91,7 @@ Display *xdpy_; private: + void resize_no_viewport(int width, int height); bool ensure_x_window(); };