changeset 22349:2aac9ec7df29

Do not call GL functions before window is open. (bug #48669) * gl-render.cc (opengl_renderer): Move call of get_maxlights() from constructor to draw_axes_children.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 04 Aug 2016 09:20:20 +0200
parents 9deb86bb5632
children 4304656d413d
files libinterp/corefcn/gl-render.cc
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Sat Aug 20 15:24:42 2016 +0200
+++ b/libinterp/corefcn/gl-render.cc	Thu Aug 04 09:20:20 2016 +0200
@@ -633,9 +633,6 @@
     if (! ok)
       error ("the size of GLsizei is smaller than the size of int");
 
-    // Check actual maximum number of lights possible
-    max_lights = get_maxlights ();
-
 #else
 
     err_disabled_feature ("opengl_renderer", "OpenGL");
@@ -1750,6 +1747,13 @@
 
     // 1st pass: draw light objects
 
+    // FIXME: max_lights only needs to be set once.
+    // It would be better if this could be in the constructor for gl_renderer
+    // but this seems to lead to calls of OpenGL functions before the context
+    // is actually initialized.  See bug #48669.
+    // Check actual maximum number of lights possible
+    max_lights = get_maxlights ();
+
     // Start with the last element of the array of child objects to
     // display them in the order they were added to the array.