diff mbox

[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
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org Nov. 30, 2011, 11:04 a.m. UTC
------------------------------------------------------------
revno: 171
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
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
diff mbox

Patch

=== 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<float>(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<float>(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();
 };