summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-01-20 17:18:38 +0000
committerManolo Gouy <Manolo>2017-01-20 17:18:38 +0000
commitc8fc8cc241aab4847e6dd03e9eda23994e657b2d (patch)
treeb3fca6399bc2e1f8a2109077bac7f59cba10ea54
parent898d2580d3a8c2a4d4e30370cf26e75881850652 (diff)
Allow resizable Fl_Gl_Window drawn using the Fl_OpenGL_Graphics_Driver
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12165 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_Gl_Window.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx
index b305bb7f3..ac445e1d0 100644
--- a/src/Fl_Gl_Window.cxx
+++ b/src/Fl_Gl_Window.cxx
@@ -364,6 +364,11 @@ void Fl_Gl_Window::draw() {
glDisable(GL_DEPTH_TEST);
glPushMatrix();
glLoadIdentity();
+ GLint viewport[4];
+ glGetIntegerv (GL_VIEWPORT, viewport);
+ if (viewport[2] != pixel_w() || viewport[3] != pixel_h()) {
+ glViewport(0, 0, pixel_w(), pixel_h());
+ }
glOrtho(-0.5, w()-0.5, h()-0.5, -0.5, -1, 1);
// glOrtho(0, w(), h(), 0, -1, 1);
glLineWidth((GLfloat)pixels_per_unit()); // should be 1 or 2 (2 if highres OpenGL)
@@ -408,6 +413,7 @@ float Fl_Gl_Window::pixels_per_unit() {
}
// creates a unique, dummy Fl_Gl_Window_Driver object used when no Fl_Gl_Window is around
+// necessary to support gl_start()/gl_finish()
Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::global() {
static Fl_Gl_Window_Driver *gwd = newGlWindowDriver(NULL);
return gwd;