=== modified file 'src/canvas-x11.cpp'
@@ -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'
@@ -91,6 +91,7 @@
Display *xdpy_;
private:
+ void resize_no_viewport(int width, int height);
bool ensure_x_window();
};