diff libinterp/corefcn/gl-render.cc @ 21684:1449e3b98941

store OpenGL version info in figure properties * gl-render.cc (gl_get_string): New static function. (opengl_renderer::draw_figure): Set OpenGL version info in figure properties. * graphics.in.h (figure::properties::__gl_extensions__, figure::properties::__gl_renderer__, figure::properties::__gl_vendor__, figure::properties::__gl_version__): New properties. * genprops.awk (emit_declarations): Make set function const for mutable properties. Don't call mark_modified from set function for mutable properties.
author John W. Eaton <jwe@octave.org>
date Mon, 09 May 2016 14:14:22 -0400
parents 53728df3e4c9
children 9467549bd5ff
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Mon May 09 12:53:49 2016 +0200
+++ b/libinterp/corefcn/gl-render.cc	Mon May 09 14:14:22 2016 -0400
@@ -646,6 +646,18 @@
     }
 }
 
+static std::string
+gl_get_string (GLenum id)
+{
+  // This is kind of ugly, but glGetString returns a pointer to GLubyte
+  // and there is no std::string constructor that matches.  Is there a
+  // better way?
+
+  std::ostringstream buf;
+  buf << glGetString (id);
+  return std::string (buf.str ());
+}
+
 void
 opengl_renderer::draw_figure (const figure::properties& props)
 {
@@ -653,6 +665,11 @@
 
   init_gl_context (props.is___enhanced__ (), props.get_color_rgb ());
 
+  props.set___gl_extensions__ (gl_get_string (GL_EXTENSIONS));
+  props.set___gl_renderer__ (gl_get_string (GL_RENDERER));
+  props.set___gl_vendor__ (gl_get_string (GL_VENDOR));
+  props.set___gl_version__ (gl_get_string (GL_VERSION));
+
   // Draw children
 
   draw (props.get_all_children (), false);