annotate libinterp/corefcn/gl-render.h @ 21195:53ac24e210e4

* gl-render.h (opengl_renderer:set_interpreter): Pass argument by const reference.
author John W. Eaton <jwe@octave.org>
date Thu, 04 Feb 2016 16:02:44 -0500
parents 4a04de049ff9
children bd96c2efd4fe
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
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 18868
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
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20715
diff changeset
23 #if ! defined (octave_gl_render_h)
17822
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
18866
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
19909
06979876af7d Fix compilation error when building without OpenGL
Mike Miller <mtmiller@ieee.org>
parents: 19861
diff changeset
52 #if defined (HAVE_OPENGL)
06979876af7d Fix compilation error when building without OpenGL
Mike Miller <mtmiller@ieee.org>
parents: 19861
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 (),
20285
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20232
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)
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
73 {
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19909
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
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
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: 19713
diff changeset
77 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
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
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
80 if (obj)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
81 draw (obj, toplevel);
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
82 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
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);
19713
1a6fa5a523e4 Correctly use GL2PS_POLYGON_OFFSET_FILL (bug #44111, bug #44125).
Rik <rik@octave.org>
parents: 19697
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);
21195
53ac24e210e4 * gl-render.h (opengl_renderer:set_interpreter): Pass argument by const reference.
John W. Eaton <jwe@octave.org>
parents: 21194
diff changeset
111 virtual void set_interpreter (const caseless_str& interp)
20285
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20232
diff changeset
112 {
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20232
diff changeset
113 interpreter = interp;
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20232
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
20623
2be59ab36110 Add method in gl_render to get a list of parsed ft_string (bug #31468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20531
diff changeset
127 virtual void text_to_strlist (const std::string& txt,
2be59ab36110 Add method in gl_render to get a list of parsed ft_string (bug #31468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20531
diff changeset
128 std::list<ft_render::ft_string>& lst,
2be59ab36110 Add method in gl_render to get a list of parsed ft_string (bug #31468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20531
diff changeset
129 Matrix& bbox,
20715
5b7643257978 Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents: 20623
diff changeset
130 int halign = 0, int valign = 0,
20623
2be59ab36110 Add method in gl_render to get a list of parsed ft_string (bug #31468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20531
diff changeset
131 double rotation = 0.0);
2be59ab36110 Add method in gl_render to get a list of parsed ft_string (bug #31468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20531
diff changeset
132
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
133 virtual Matrix render_text (const std::string& txt,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 9950
diff changeset
134 double x, double y, double z,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 9950
diff changeset
135 int halign, int valign, double rotation = 0.0);
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
136
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
137 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
138 GLenum type, const GLvoid *data);
9950
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9941
diff changeset
139
12321
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
140 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
141 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
142 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
143 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
144
12321
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
145 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
146 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
147 double dx, double dy, double dz,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
148 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
149
12321
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
150 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
151 const string_vector& ticklabels,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
152 double lim1, double lim2,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
153 double p1, double p2,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
154 int xyz, int ha, int va,
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
155 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
156
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
157 private:
21194
4a04de049ff9 don't provide copy constructor or assignment operator for opengl_renderer
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
158
4a04de049ff9 don't provide copy constructor or assignment operator for opengl_renderer
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
159 // No copying!
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
160
21194
4a04de049ff9 don't provide copy constructor or assignment operator for opengl_renderer
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
161 opengl_renderer (const opengl_renderer&);
4a04de049ff9 don't provide copy constructor or assignment operator for opengl_renderer
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
162
4a04de049ff9 don't provide copy constructor or assignment operator for opengl_renderer
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
163 opengl_renderer& operator = (const opengl_renderer&);
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
164
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
165 bool is_nan_or_inf (double x, double y, double z) const
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
166 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
167 return (xisnan (x) || xisnan (y) || xisnan (z)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
168 || xisinf (x) || xisinf (y) || xisinf (z));
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
169 }
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
170
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
171 octave_uint8 clip_code (double x, double y, double z) const
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
172 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
173 return ((x < xmin ? 1 : 0)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
174 | (x > xmax ? 1 : 0) << 1
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
175 | (y < ymin ? 1 : 0) << 2
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
176 | (y > ymax ? 1 : 0) << 3
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
177 | (z < zmin ? 1 : 0) << 4
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
178 | (z > zmax ? 1 : 0) << 5
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19713
diff changeset
179 | (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: 19713
diff changeset
180 }
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
181
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
182 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
183 bool filled) const;
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
184
12327
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_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
186 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
187
12327
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_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
189 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
190 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
191
6ba28900706b opengl_renderer::draw_axes: simplify with subfunctions
John W. Eaton <jwe@octave.org>
parents: 12126
diff changeset
192 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
193
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
194 private:
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
195 // 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
196 graphics_toolkit toolkit;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
197
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
198 // axes transformation data
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
199 graphics_xform xform;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
200
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
201 // axis limits in model scaled coordinate
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
202 double xmin, xmax;
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
203 double ymin, ymax;
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
204 double zmin, zmax;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
205
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
206 // Z projection limits in windows coordinate
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
207 double xZ1, xZ2;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
208
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
209 // call lists identifiers for markers
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
210 unsigned int marker_id, filled_marker_id;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
211
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7866
diff changeset
212 // camera information for primitive sorting
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
213 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
214
20285
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20232
diff changeset
215 // 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: 20232
diff changeset
216 caseless_str interpreter;
6db2ea5556a4 Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20232
diff changeset
217
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
218 #if HAVE_FREETYPE
18736
333901476119 maint: Use "FreeType" rather than "freetype" in messages and comments.
Rik <rik@octave.org>
parents: 17822
diff changeset
219 // FreeType render, used for text rendering
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
220 ft_render text_renderer;
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
221 #endif
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
222
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
223 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
224 class patch_tesselator;
7825
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
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
227 #endif
19909
06979876af7d Fix compilation error when building without OpenGL
Mike Miller <mtmiller@ieee.org>
parents: 19861
diff changeset
228
06979876af7d Fix compilation error when building without OpenGL
Mike Miller <mtmiller@ieee.org>
parents: 19861
diff changeset
229 #endif