annotate libinterp/corefcn/gl-render.h @ 20614:10ec79b47808

use new string_value method to handle value extraction errors * __voronoi__.cc, chol.cc, colamd.cc, fftw.cc: Use new string_value method.
author John W. Eaton <jwe@octave.org>
date Thu, 08 Oct 2015 18:15:56 -0400
parents dcfbf4c1c3c8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
1 /*
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
2
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 18902
diff changeset
3 Copyright (C) 2008-2015 Michael Goffioul
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
4
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
5 This file is part of Octave.
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
6
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
10 option) any later version.
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
11
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
15 for more details.
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
16
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
20
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
21 */
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
22
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17744
diff changeset
23 #if !defined (octave_gl_render_h)
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17744
diff changeset
24 #define octave_gl_render_h 1
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
25
7845
25f5d628bc8a Fix OpenGL/FLTK compilation under Windows.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7834
diff changeset
26 #ifdef HAVE_WINDOWS_H
10346
65d5776379c3 Reduce the amount of stuff included by windows.h and avoid min/max being #define-d
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10313
diff changeset
27 #define WIN32_LEAN_AND_MEAN
7845
25f5d628bc8a Fix OpenGL/FLTK compilation under Windows.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7834
diff changeset
28 #include <windows.h>
25f5d628bc8a Fix OpenGL/FLTK compilation under Windows.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7834
diff changeset
29 #endif
25f5d628bc8a Fix OpenGL/FLTK compilation under Windows.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7834
diff changeset
30
7945
456578a22388 check for OpenGL/gl[u].h
carlo@guglielmo.local
parents: 7914
diff changeset
31 #ifdef HAVE_GL_GL_H
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents: 7833
diff changeset
32 #include <GL/gl.h>
8724
a50228129dba Introduce new macro OCTAVE_GLUTESSCALLBACK_THREEDOTS. Use definitions HAVE_FRAMEWORK_OPENGL and HAVE_GLUTESSCALLBACK_THREEDOTS for Mac's framework OpenGL implementation.
Ben Abbott <bpabbott@mac.com>
parents: 8022
diff changeset
33 #elif defined HAVE_OPENGL_GL_H || defined HAVE_FRAMEWORK_OPENGL
7945
456578a22388 check for OpenGL/gl[u].h
carlo@guglielmo.local
parents: 7914
diff changeset
34 #include <OpenGL/gl.h>
456578a22388 check for OpenGL/gl[u].h
carlo@guglielmo.local
parents: 7914
diff changeset
35 #endif
456578a22388 check for OpenGL/gl[u].h
carlo@guglielmo.local
parents: 7914
diff changeset
36
456578a22388 check for OpenGL/gl[u].h
carlo@guglielmo.local
parents: 7914
diff changeset
37 #ifdef HAVE_GL_GLU_H
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents: 7833
diff changeset
38 #include <GL/glu.h>
8724
a50228129dba Introduce new macro OCTAVE_GLUTESSCALLBACK_THREEDOTS. Use definitions HAVE_FRAMEWORK_OPENGL and HAVE_GLUTESSCALLBACK_THREEDOTS for Mac's framework OpenGL implementation.
Ben Abbott <bpabbott@mac.com>
parents: 8022
diff changeset
39 #elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL
7945
456578a22388 check for OpenGL/gl[u].h
carlo@guglielmo.local
parents: 7914
diff changeset
40 #include <OpenGL/glu.h>
456578a22388 check for OpenGL/gl[u].h
carlo@guglielmo.local
parents: 7914
diff changeset
41 #endif
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents: 7833
diff changeset
42
18900
95b69b880b19 Allow conpile of gl-render.cc under mingw.
John Donoghue
parents: 17822
diff changeset
43 #ifdef HAVE_GL_GLEXT_H
95b69b880b19 Allow conpile of gl-render.cc under mingw.
John Donoghue
parents: 17822
diff changeset
44 #include <GL/glext.h>
95b69b880b19 Allow conpile of gl-render.cc under mingw.
John Donoghue
parents: 17822
diff changeset
45 #elif defined HAVE_OPENGL_GLEXT_H || defined HAVE_FRAMEWORK_OPENGL
95b69b880b19 Allow conpile of gl-render.cc under mingw.
John Donoghue
parents: 17822
diff changeset
46 #include <OpenGL/glext.h>
95b69b880b19 Allow conpile of gl-render.cc under mingw.
John Donoghue
parents: 17822
diff changeset
47 #endif
95b69b880b19 Allow conpile of gl-render.cc under mingw.
John Donoghue
parents: 17822
diff changeset
48
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
49 #include "graphics.h"
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
50 #include "txt-eng-ft.h"
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
51
19944
06979876af7d Fix compilation error when building without OpenGL
Mike Miller <mtmiller@ieee.org>
parents: 19895
diff changeset
52 #if defined (HAVE_OPENGL)
06979876af7d Fix compilation error when building without OpenGL
Mike Miller <mtmiller@ieee.org>
parents: 19895
diff changeset
53
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
54 class
7914
e998e81224b5 Various compilation fixes for MSVC.
John W. Eaton <jwe@octave.org>
parents: 7874
diff changeset
55 OCTINTERP_API
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
56 opengl_renderer
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
57 {
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
58 public:
11584
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
59 opengl_renderer (void)
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
60 : toolkit (), xform (), xmin (), xmax (), ymin (), ymax (),
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
61 zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (),
20320
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20267
diff changeset
62 camera_pos (), camera_dir (), interpreter ("none")
11584
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
63 #if HAVE_FREETYPE
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
64 , text_renderer ()
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
65 #endif
11584
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
66 { }
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
67
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
68 virtual ~opengl_renderer (void) { }
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
69
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12334
diff changeset
70 virtual void draw (const graphics_object& go, bool toplevel = true);
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
71
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12334
diff changeset
72 virtual void draw (const Matrix& hlist, bool toplevel = false)
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
73 {
20267
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19944
diff changeset
74 int len = hlist.numel ();
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
75
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
76 for (int i = len-1; i >= 0; i--)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
77 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
78 graphics_object obj = gh_manager::get_object (hlist(i));
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
79
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
80 if (obj)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
81 draw (obj, toplevel);
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
82 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
83 }
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
84
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
85 virtual void set_viewport (int w, int h);
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10346
diff changeset
86 virtual graphics_xform get_transform (void) const { return xform; }
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
87
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
88 protected:
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
89 virtual void draw_figure (const figure::properties& props);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
90 virtual void draw_axes (const axes::properties& props);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
91 virtual void draw_line (const line::properties& props);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
92 virtual void draw_surface (const surface::properties& props);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
93 virtual void draw_patch (const patch::properties& props);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
94 virtual void draw_hggroup (const hggroup::properties& props);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
95 virtual void draw_text (const text::properties& props);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
96 virtual void draw_image (const image::properties& props);
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12334
diff changeset
97 virtual void draw_uipanel (const uipanel::properties& props,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12334
diff changeset
98 const graphics_object& go);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12334
diff changeset
99
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12334
diff changeset
100 virtual void init_gl_context (bool enhanced, const Matrix& backgroundColor);
14836
a1e1f914ae79 Make some opengl_renderer methods virtual.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 14138
diff changeset
101 virtual void setup_opengl_transformation (const axes::properties& props);
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
102
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
103 virtual void set_color (const Matrix& c);
19747
1a6fa5a523e4 Correctly use GL2PS_POLYGON_OFFSET_FILL (bug #44111, bug #44125).
Rik <rik@octave.org>
parents: 19731
diff changeset
104 virtual void set_polygon_offset (bool on, float offset = 0.0f);
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
105 virtual void set_linewidth (float w);
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
106 virtual void set_linestyle (const std::string& s, bool stipple = false);
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
107 virtual void set_clipbox (double x1, double x2, double y1, double y2,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 9950
diff changeset
108 double z1, double z2);
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
109 virtual void set_clipping (bool on);
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
110 virtual void set_font (const base_properties& props);
20566
dcfbf4c1c3c8 eliminate trailing whitespace and tabs from sources
John W. Eaton <jwe@octave.org>
parents: 20320
diff changeset
111 virtual void set_interpreter (const caseless_str interp)
20320
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20267
diff changeset
112 {
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20267
diff changeset
113 interpreter = interp;
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20267
diff changeset
114 }
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
115
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
116 virtual void init_marker (const std::string& m, double size, float width);
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
117 virtual void end_marker (void);
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
118 virtual void draw_marker (double x, double y, double z,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 9950
diff changeset
119 const Matrix& lc, const Matrix& fc);
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
120
9834
92d8f35ff217 compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
121 virtual void text_to_pixels (const std::string& txt,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 9950
diff changeset
122 uint8NDArray& pixels,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 9950
diff changeset
123 Matrix& bbox,
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10346
diff changeset
124 int halign = 0, int valign = 0,
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10346
diff changeset
125 double rotation = 0.0);
9834
92d8f35ff217 compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
126
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
127 virtual Matrix render_text (const std::string& txt,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 9950
diff changeset
128 double x, double y, double z,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 9950
diff changeset
129 int halign, int valign, double rotation = 0.0);
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
130
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
131 virtual void draw_pixels (GLsizei w, GLsizei h, GLenum format,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 9950
diff changeset
132 GLenum type, const GLvoid *data);
9950
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9941
diff changeset
133
12321
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
134 virtual void render_grid (const std::string& gridstyle, const Matrix& ticks,
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
135 double lim1, double lim2,
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
136 double p1, double p1N, double p2, double p2N,
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
137 int xyz, bool is_3D);
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
138
12321
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
139 virtual void render_tickmarks (const Matrix& ticks, double lim1, double lim2,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
140 double p1, double p1N, double p2, double p2N,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
141 double dx, double dy, double dz,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
142 int xyz, bool doubleside);
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
143
12321
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
144 virtual void render_ticktexts (const Matrix& ticks,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
145 const string_vector& ticklabels,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
146 double lim1, double lim2,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
147 double p1, double p2,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
148 int xyz, int ha, int va,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
149 int& wmax, int& hmax);
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
150
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
151 private:
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
152 opengl_renderer (const opengl_renderer&)
11584
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
153 : toolkit (), xform (), xmin (), xmax (), ymin (), ymax (),
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
154 zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (),
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
155 camera_pos (), camera_dir ()
11584
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
156 #if HAVE_FREETYPE
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
157 , text_renderer ()
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11576
diff changeset
158 #endif
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
159 { }
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
160
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
161 opengl_renderer& operator = (const opengl_renderer&)
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
162 { return *this; }
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
163
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
164 bool is_nan_or_inf (double x, double y, double z) const
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
165 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
166 return (xisnan (x) || xisnan (y) || xisnan (z)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
167 || xisinf (x) || xisinf (y) || xisinf (z));
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
168 }
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
169
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
170 octave_uint8 clip_code (double x, double y, double z) const
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
171 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
172 return ((x < xmin ? 1 : 0)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
173 | (x > xmax ? 1 : 0) << 1
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
174 | (y < ymin ? 1 : 0) << 2
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
175 | (y > ymax ? 1 : 0) << 3
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
176 | (z < zmin ? 1 : 0) << 4
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
177 | (z > zmax ? 1 : 0) << 5
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
178 | (is_nan_or_inf (x, y, z) ? 0 : 1) << 6);
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19747
diff changeset
179 }
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
180
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
181 unsigned int make_marker_list (const std::string& m, double size,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 9950
diff changeset
182 bool filled) const;
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
183
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
184 void draw_axes_planes (const axes::properties& props);
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
185 void draw_axes_boxes (const axes::properties& props);
12321
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
186
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
187 void draw_axes_x_grid (const axes::properties& props);
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
188 void draw_axes_y_grid (const axes::properties& props);
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
189 void draw_axes_z_grid (const axes::properties& props);
12321
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
190
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
191 void draw_axes_children (const axes::properties& props);
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
192
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
193 private:
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
194 // The graphics toolkit associated with the figure being rendered.
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
195 graphics_toolkit toolkit;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
196
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
197 // axes transformation data
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
198 graphics_xform xform;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
199
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
200 // axis limits in model scaled coordinate
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
201 double xmin, xmax;
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
202 double ymin, ymax;
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
203 double zmin, zmax;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
204
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
205 // Z projection limits in windows coordinate
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
206 double xZ1, xZ2;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
207
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
208 // call lists identifiers for markers
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
209 unsigned int marker_id, filled_marker_id;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
210
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
211 // camera information for primitive sorting
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
212 ColumnVector camera_pos, camera_dir;
7833
8ff92634982d Add initial support for patch rendering through GLU tessellation (no transparency, no border, no markers yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
213
20320
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20267
diff changeset
214 // interpreter to be used by text_to_pixels
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20267
diff changeset
215 caseless_str interpreter;
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20267
diff changeset
216
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
217 #if HAVE_FREETYPE
18770
333901476119 maint: Use "FreeType" rather than "freetype" in messages and comments.
Rik <rik@octave.org>
parents: 17822
diff changeset
218 // FreeType render, used for text rendering
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
219 ft_render text_renderer;
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
220 #endif
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
221
7833
8ff92634982d Add initial support for patch rendering through GLU tessellation (no transparency, no border, no markers yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
222 private:
8ff92634982d Add initial support for patch rendering through GLU tessellation (no transparency, no border, no markers yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
223 class patch_tesselator;
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
224 };
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
225
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
226 #endif
19944
06979876af7d Fix compilation error when building without OpenGL
Mike Miller <mtmiller@ieee.org>
parents: 19895
diff changeset
227
06979876af7d Fix compilation error when building without OpenGL
Mike Miller <mtmiller@ieee.org>
parents: 19895
diff changeset
228 #endif