Mercurial > octave
annotate libinterp/corefcn/gl-render.cc @ 26682:0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
* gl-render.cc (opengl_renderer::draw_axes_boxes): Check "xcolor", "ycolor",
and "zcolor" properties for special value of '[]' which means "none". Don't
draw boxes if "color" is empty.
* gl-render.cc (opengl_renderer::draw_axes_[xyz]_grid): Check "color" property
for "none" and determine possible fallback colors for "gridcolor" and
"minorgridcolor". Don't draw grids, axes, ticks, or ticklabels if final
color value is "none".
* gl-render.cc (opengl_renderer::draw_text): Don't draw text if "color" is
"none".
* gl-render.cc (opengl_renderer::set_color): Don't update
txt_renderer.set_color if "color" is "none".
* graphics.cc (text::properties::update_font): Don't update
txt_renderer.set_color if "color" is "none".
* graphics.in.h (axes): Add 'm' to "gridcolor" property so that changing the
color automatically flips "gridcolormode" to "manual".
* graphics.in.h (axes): Change "xcolor", "ycolor", "zcolor" properties to be a
color_property object with a possible radio_value of "none".
* graphics.in.h (text): Change "color" property to be a color_property object
with a possible radio_value of "none".
* graphics.in.h (text::update_color): Change updater function to verify color
is not "none" before proceeding.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 04 Feb 2019 12:06:07 -0800 |
parents | 879f22ca59c8 |
children | 4b4881ff0dc9 |
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 |
26376
00f796120a6d
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
26188
diff
changeset
|
3 Copyright (C) 2008-2019 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 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24523
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22740
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24523
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22740
diff
changeset
|
10 (at your option) any later version. |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22740
diff
changeset
|
11 |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22740
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22740
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22740
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22740
diff
changeset
|
15 GNU General Public License for more details. |
7825
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 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24523
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
7825
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 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21691
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21209
diff
changeset
|
24 # include "config.h" |
7825
13871b7de124
Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
25 #endif |
13871b7de124
Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
26 |
25438
cb1606f78f6b
prefer <istream>, <ostream>, or <iosfwd> to <iostream> where possible
John W. Eaton <jwe@octave.org>
parents:
25423
diff
changeset
|
27 #include <sstream> |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
28 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21691
diff
changeset
|
29 #if defined (HAVE_WINDOWS_H) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21198
diff
changeset
|
30 # define WIN32_LEAN_AND_MEAN |
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21198
diff
changeset
|
31 # include <windows.h> |
21196
bd96c2efd4fe
move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents:
21115
diff
changeset
|
32 #endif |
bd96c2efd4fe
move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents:
21115
diff
changeset
|
33 |
23479
06bf3a0b08bf
maint: Use "" instead of <> for our own include files.
John W. Eaton <jwe@octave.org>
parents:
23450
diff
changeset
|
34 #include "lo-mappers.h" |
8377
25bc2d31e1bf
improve OCTAVE_LOCAL_BUFFER
Jaroslav Hajek <highegg@gmail.com>
parents:
8263
diff
changeset
|
35 #include "oct-locbuf.h" |
13985
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13961
diff
changeset
|
36 #include "oct-refcount.h" |
21115
629643522cc0
include errwarn.h in all files that use gripe_disabled_feature
John W. Eaton <jwe@octave.org>
parents:
21109
diff
changeset
|
37 |
629643522cc0
include errwarn.h in all files that use gripe_disabled_feature
John W. Eaton <jwe@octave.org>
parents:
21109
diff
changeset
|
38 #include "errwarn.h" |
7825
13871b7de124
Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
39 #include "gl-render.h" |
21196
bd96c2efd4fe
move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents:
21115
diff
changeset
|
40 #include "oct-opengl.h" |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
41 #include "text-renderer.h" |
7825
13871b7de124
Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
42 |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
43 namespace octave |
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
44 { |
24725
edef866fba7b
* gl-render.cc: Fix compilation error when HAVE_OPENGL is not defined.
John W. Eaton <jwe@octave.org>
parents:
24722
diff
changeset
|
45 #if defined (HAVE_OPENGL) |
edef866fba7b
* gl-render.cc: Fix compilation error when HAVE_OPENGL is not defined.
John W. Eaton <jwe@octave.org>
parents:
24722
diff
changeset
|
46 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
47 static int |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
48 next_power_of_2 (int n) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
49 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
50 int m = 1; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
51 |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
52 while (m < n && m < std::numeric_limits<int>::max ()) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
53 m <<= 1; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
54 |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
55 return m; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
56 } |
22393
026067ffcf66
fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents:
22391
diff
changeset
|
57 |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7825
diff
changeset
|
58 #define LIGHT_MODE GL_FRONT_AND_BACK |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7825
diff
changeset
|
59 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
60 // Use symbolic names for axes |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
61 enum |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
62 { |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
63 X_AXIS, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
64 Y_AXIS, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
65 Z_AXIS |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
66 }; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
67 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
68 // Use symbolic names for color mode |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
69 enum |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
70 { |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
71 UNIFORM, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
72 FLAT, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
73 INTERP, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
74 TEXTURE |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
75 }; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
76 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
77 // Use symbolic names for lighting |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
78 enum |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
79 { |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
80 NONE, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
81 //FLAT, // Already declared in anonymous enum for color mode |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
82 GOURAUD = 2 |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
83 }; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
84 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
85 // Win32 API requires the CALLBACK attributes for |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
86 // GLU callback functions. Define it to empty on |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
87 // other platforms. |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21691
diff
changeset
|
88 #if ! defined (CALLBACK) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21198
diff
changeset
|
89 # define CALLBACK |
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:
7831
diff
changeset
|
90 #endif |
8ff92634982d
Add initial support for patch rendering through GLU tessellation (no transparency, no border, no markers yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7831
diff
changeset
|
91 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
92 class |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
93 opengl_texture |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
94 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
95 protected: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
96 class texture_rep |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
97 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
98 public: |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
99 texture_rep (opengl_functions& glfcns) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
100 : m_glfcns (glfcns), id (), w (), h (), tw (), th (), tx (), ty (), |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
101 valid (false), count (1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
102 { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
103 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
104 texture_rep (opengl_functions& glfcns, GLuint id_arg, |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
105 int w_arg, int h_arg, int tw_arg, int th_arg) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
106 : m_glfcns (glfcns), id (id_arg), w (w_arg), h (h_arg), |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
107 tw (tw_arg), th (th_arg), tx (double(w)/tw), ty (double(h)/th), |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
108 valid (true), count (1) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
109 { } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
110 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
111 ~texture_rep (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
112 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
113 if (valid) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
114 m_glfcns.glDeleteTextures (1, &id); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
115 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
116 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
117 void bind (int mode) const |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
118 { if (valid) m_glfcns.glBindTexture (mode, id); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
119 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
120 void tex_coord (double q, double r) const |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
121 { if (valid) m_glfcns.glTexCoord2d (q*tx, r*ty); } |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
122 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
123 opengl_functions& m_glfcns; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
124 GLuint id; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
125 int w, h; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
126 int tw, th; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
127 double tx, ty; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
128 bool valid; |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
129 refcount<int> count; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
130 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
131 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
132 texture_rep *rep; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
133 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
134 private: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
135 opengl_texture (texture_rep *_rep) : rep (_rep) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
136 |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
137 public: |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
138 opengl_texture (opengl_functions& glfcns) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
139 : rep (new texture_rep (glfcns)) { } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
140 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
141 opengl_texture (const opengl_texture& tx) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
142 : rep (tx.rep) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
143 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
144 rep->count++; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
145 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
146 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
147 ~opengl_texture (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
148 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
149 if (--rep->count == 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
150 delete rep; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
151 } |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
152 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
153 opengl_texture& operator = (const opengl_texture& tx) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
154 { |
26407
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
155 if (&tx != this) |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
156 { |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
157 if (--rep->count == 0) |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
158 delete rep; |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
159 |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
160 rep = tx.rep; |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
161 rep->count++; |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
162 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
163 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
164 return *this; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
165 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
166 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
167 static opengl_texture create (opengl_functions& glfcns, |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
168 const octave_value& data); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
169 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
170 void bind (int mode = GL_TEXTURE_2D) const |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
171 { rep->bind (mode); } |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
172 |
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
173 void tex_coord (double q, double r) const |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
174 { rep->tex_coord (q, r); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
175 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
176 bool is_valid (void) const |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
177 { return rep->valid; } |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
178 }; |
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
179 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
180 opengl_texture |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
181 opengl_texture::create (opengl_functions& glfcns, const octave_value& data) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
182 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
183 opengl_texture retval (glfcns); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
184 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
185 dim_vector dv (data.dims ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
186 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
187 // Expect RGB data |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
188 if (dv.ndims () == 3 && dv(2) == 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
189 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
190 // FIXME: dim_vectors hold octave_idx_type values. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
191 // Should we check for dimensions larger than intmax? |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
192 int h, w, tw, th; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
193 h = dv(0), w = dv(1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
194 GLuint id; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
195 bool ok = true; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
196 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
197 tw = next_power_of_2 (w); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
198 th = next_power_of_2 (h); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
199 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
200 glfcns.glGenTextures (1, &id); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
201 glfcns.glBindTexture (GL_TEXTURE_2D, id); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
202 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
203 if (data.is_double_type ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
204 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
205 const NDArray xdata = data.array_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
206 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
207 OCTAVE_LOCAL_BUFFER (float, a, (3*tw*th)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
208 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
209 for (int i = 0; i < h; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
210 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
211 for (int j = 0, idx = i*tw*3; j < w; j++, idx += 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
212 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
213 a[idx] = xdata(i,j,0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
214 a[idx+1] = xdata(i,j,1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
215 a[idx+2] = xdata(i,j,2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
216 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
217 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
218 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
219 glfcns.glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB, GL_FLOAT, a); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
220 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
221 else if (data.is_uint8_type ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
222 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
223 const uint8NDArray xdata = data.uint8_array_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
224 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
225 OCTAVE_LOCAL_BUFFER (octave_uint8, a, (3*tw*th)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
226 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
227 for (int i = 0; i < h; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
228 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
229 for (int j = 0, idx = i*tw*3; j < w; j++, idx += 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
230 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
231 a[idx] = xdata(i,j,0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
232 a[idx+1] = xdata(i,j,1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
233 a[idx+2] = xdata(i,j,2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
234 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
235 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
236 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
237 glfcns.glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
238 GL_RGB, GL_UNSIGNED_BYTE, a); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
239 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
240 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
241 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
242 ok = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
243 warning ("opengl_texture::create: invalid texture data type (double or uint8 required)"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
244 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
245 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
246 if (ok) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
247 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
248 glfcns.glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
249 glfcns.glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
250 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
251 if (glfcns.glGetError () != GL_NO_ERROR) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
252 warning ("opengl_texture::create: OpenGL error while generating texture data"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
253 else |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
254 retval = opengl_texture (new texture_rep (glfcns, id, w, h, tw, th)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
255 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
256 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
257 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
258 warning ("opengl_texture::create: invalid texture data size"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
259 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
260 return retval; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
261 } |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
262 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
263 class |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
264 opengl_tesselator |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
265 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
266 public: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
267 #if defined (HAVE_FRAMEWORK_OPENGL) && defined (HAVE_GLUTESSCALLBACK_THREEDOTS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
268 typedef GLvoid (CALLBACK *fcn) (...); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
269 #else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
270 typedef void (CALLBACK *fcn) (void); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
271 #endif |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
272 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
273 public: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
274 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23696
diff
changeset
|
275 opengl_tesselator (void) : glu_tess (nullptr), fill () { init (); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
276 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
277 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
278 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
279 opengl_tesselator (const opengl_tesselator&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
280 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
281 opengl_tesselator operator = (const opengl_tesselator&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
282 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
283 virtual ~opengl_tesselator (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
284 { if (glu_tess) gluDeleteTess (glu_tess); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
285 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
286 void begin_polygon (bool filled = true) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
287 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
288 gluTessProperty (glu_tess, GLU_TESS_BOUNDARY_ONLY, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
289 (filled ? GL_FALSE : GL_TRUE)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
290 fill = filled; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
291 gluTessBeginPolygon (glu_tess, this); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
292 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
293 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
294 void end_polygon (void) const |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
295 { gluTessEndPolygon (glu_tess); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
296 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
297 void begin_contour (void) const |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
298 { gluTessBeginContour (glu_tess); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
299 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
300 void end_contour (void) const |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
301 { gluTessEndContour (glu_tess); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
302 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
303 void add_vertex (double *loc, void *data) const |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
304 { gluTessVertex (glu_tess, loc, data); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
305 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
306 protected: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
307 virtual void begin (GLenum /*type*/) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
308 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
309 virtual void end (void) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
310 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
311 virtual void vertex (void * /*data*/) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
312 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
313 virtual void combine (GLdouble [3] /*c*/, void * [4] /*data*/, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
314 GLfloat [4] /*w*/, void ** /*out_data*/) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
315 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
316 virtual void edge_flag (GLboolean /*flag*/) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
317 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
318 virtual void error (GLenum err) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
319 { ::error ("OpenGL tesselation error (%d)", err); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
320 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
321 virtual void init (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
322 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
323 glu_tess = gluNewTess (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
324 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
325 gluTessCallback (glu_tess, GLU_TESS_BEGIN_DATA, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
326 reinterpret_cast<fcn> (tess_begin)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
327 gluTessCallback (glu_tess, GLU_TESS_END_DATA, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
328 reinterpret_cast<fcn> (tess_end)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
329 gluTessCallback (glu_tess, GLU_TESS_VERTEX_DATA, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
330 reinterpret_cast<fcn> (tess_vertex)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
331 gluTessCallback (glu_tess, GLU_TESS_COMBINE_DATA, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
332 reinterpret_cast<fcn> (tess_combine)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
333 gluTessCallback (glu_tess, GLU_TESS_EDGE_FLAG_DATA, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
334 reinterpret_cast<fcn> (tess_edge_flag)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
335 gluTessCallback (glu_tess, GLU_TESS_ERROR_DATA, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
336 reinterpret_cast<fcn> (tess_error)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
337 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
338 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
339 bool is_filled (void) const { return fill; } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
340 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
341 private: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
342 static void CALLBACK tess_begin (GLenum type, void *t) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
343 { reinterpret_cast<opengl_tesselator *> (t)->begin (type); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
344 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
345 static void CALLBACK tess_end (void *t) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
346 { reinterpret_cast<opengl_tesselator *> (t)->end (); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
347 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
348 static void CALLBACK tess_vertex (void *v, void *t) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
349 { reinterpret_cast<opengl_tesselator *> (t)->vertex (v); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
350 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
351 static void CALLBACK tess_combine (GLdouble c[3], void *v[4], GLfloat w[4], |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
352 void **out, void *t) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
353 { reinterpret_cast<opengl_tesselator *> (t)->combine (c, v, w, out); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
354 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
355 static void CALLBACK tess_edge_flag (GLboolean flag, void *t) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
356 { reinterpret_cast<opengl_tesselator *> (t)->edge_flag (flag); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
357 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
358 static void CALLBACK tess_error (GLenum err, void *t) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
359 { reinterpret_cast<opengl_tesselator *> (t)->error (err); } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
360 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
361 private: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
362 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
363 GLUtesselator *glu_tess; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
364 bool fill; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
365 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
366 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
367 class |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
368 vertex_data |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
369 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
370 public: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
371 class vertex_data_rep |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
372 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
373 public: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
374 Matrix coords; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
375 Matrix color; |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
376 Matrix vertex_normal; |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
377 Matrix face_normal; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
378 double alpha; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
379 float ambient; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
380 float diffuse; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
381 float specular; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
382 float specular_exp; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
383 float specular_color_refl; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
384 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
385 // reference counter |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
386 refcount<int> count; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
387 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
388 vertex_data_rep (void) |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
389 : coords (), color (), vertex_normal (), face_normal (), alpha (), |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
390 ambient (), diffuse (), specular (), specular_exp (), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
391 specular_color_refl (), count (1) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
392 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
393 vertex_data_rep (const Matrix& c, const Matrix& col, const Matrix& vn, |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
394 const Matrix& fn, double a, float as, float ds, float ss, |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
395 float se, float scr) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
396 : coords (c), color (col), vertex_normal (vn), face_normal (fn), |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
397 alpha (a), ambient (as), diffuse (ds), specular (ss), |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
398 specular_exp (se), specular_color_refl (scr), count (1) { } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
399 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
400 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
401 private: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
402 vertex_data_rep *rep; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
403 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23433
diff
changeset
|
404 vertex_data_rep * nil_rep (void) const |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
405 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
406 static vertex_data_rep *nr = new vertex_data_rep (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
407 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
408 return nr; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
409 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
410 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
411 public: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
412 vertex_data (void) : rep (nil_rep ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
413 { rep->count++; } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
414 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
415 vertex_data (const vertex_data& v) : rep (v.rep) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
416 { rep->count++; } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
417 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
418 vertex_data (const Matrix& c, const Matrix& col, const Matrix& vn, |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
419 const Matrix& fn, double a, float as, float ds, float ss, |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
420 float se, float scr) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
421 : rep (new vertex_data_rep (c, col, vn, fn, a, as, ds, ss, se, scr)) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
422 { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
423 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
424 vertex_data (vertex_data_rep *new_rep) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
425 : rep (new_rep) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
426 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
427 ~vertex_data (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
428 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
429 if (--rep->count == 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
430 delete rep; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
431 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
432 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
433 vertex_data& operator = (const vertex_data& v) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
434 { |
26407
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
435 if (&v != this) |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
436 { |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
437 if (--rep->count == 0) |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
438 delete rep; |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
439 |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
440 rep = v.rep; |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
441 rep->count++; |
31b0761cd641
gl-render.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
442 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
443 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
444 return *this; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
445 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
446 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23433
diff
changeset
|
447 vertex_data_rep * get_rep (void) const { return rep; } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
448 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
449 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
450 class |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
451 opengl_renderer::patch_tesselator : public opengl_tesselator |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
452 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
453 public: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
454 patch_tesselator (opengl_renderer *r, int cmode, int lmode, float idx = 0.0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
455 : opengl_tesselator (), renderer (r), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
456 color_mode (cmode), light_mode (lmode), index (idx), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
457 first (true), tmp_vdata () |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
458 { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
459 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
460 protected: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
461 void begin (GLenum type) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
462 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
463 opengl_functions& glfcns = renderer->get_opengl_functions (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
464 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
465 //printf ("patch_tesselator::begin (%d)\n", type); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
466 first = true; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
467 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
468 if (color_mode == INTERP || light_mode == GOURAUD) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
469 glfcns.glShadeModel (GL_SMOOTH); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
470 else |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
471 glfcns.glShadeModel (GL_FLAT); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
472 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
473 if (is_filled ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
474 renderer->set_polygon_offset (true, index); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
475 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
476 glfcns.glBegin (type); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
477 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
478 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
479 void end (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
480 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
481 opengl_functions& glfcns = renderer->get_opengl_functions (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
482 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
483 //printf ("patch_tesselator::end\n"); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
484 glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
485 renderer->set_polygon_offset (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
486 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
487 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
488 void vertex (void *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
489 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
490 opengl_functions& glfcns = renderer->get_opengl_functions (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
491 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
492 vertex_data::vertex_data_rep *v |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
493 = reinterpret_cast<vertex_data::vertex_data_rep *> (data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
494 //printf ("patch_tesselator::vertex (%g, %g, %g)\n", v->coords(0), v->coords(1), v->coords(2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
495 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
496 // NOTE: OpenGL can re-order vertices. For "flat" coloring of FaceColor |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
497 // the first vertex must be identified in the draw_patch routine. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
498 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
499 if (color_mode == INTERP || (color_mode == FLAT && ! is_filled ())) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
500 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
501 Matrix col = v->color; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
502 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
503 if (col.numel () == 3) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
504 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
505 glfcns.glColor4d (col(0), col(1), col(2), v->alpha); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
506 if (light_mode > 0) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
507 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
508 float buf[4] = { 0, 0, 0, 1 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
509 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
510 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
511 buf[k] = (v->ambient * col(k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
512 glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, buf); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
513 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
514 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
515 buf[k] = (v->diffuse * col(k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
516 glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, buf); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
517 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
518 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
519 buf[k] = v->specular * (v->specular_color_refl + |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
520 (1 - v->specular_color_refl) * col(k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
521 glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, buf); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
522 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
523 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
524 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
525 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
526 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
527 if (light_mode == FLAT && first) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
528 glfcns.glNormal3dv (v->face_normal.data ()); |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
529 else if (light_mode == GOURAUD) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
530 glfcns.glNormal3dv (v->vertex_normal.data ()); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
531 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
532 glfcns.glVertex3dv (v->coords.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
533 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
534 first = false; |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
535 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
536 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
537 void combine (GLdouble xyz[3], void *data[4], GLfloat w[4], void **out_data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
538 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
539 //printf ("patch_tesselator::combine\n"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
540 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
541 vertex_data::vertex_data_rep *v[4]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
542 int vmax = 4; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
543 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
544 for (int i = 0; i < 4; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
545 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
546 v[i] = reinterpret_cast<vertex_data::vertex_data_rep *> (data[i]); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
547 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
548 if (vmax == 4 && ! v[i]) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
549 vmax = i; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
550 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
551 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
552 Matrix vv (1, 3, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
553 Matrix cc; |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
554 Matrix vnn (1, 3, 0.0); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
555 Matrix fnn (1, 3, 0.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
556 double aa = 0.0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
557 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
558 vv(0) = xyz[0]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
559 vv(1) = xyz[1]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
560 vv(2) = xyz[2]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
561 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
562 if (v[0]->color.numel ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
563 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
564 cc.resize (1, 3, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
565 for (int ic = 0; ic < 3; ic++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
566 for (int iv = 0; iv < vmax; iv++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
567 cc(ic) += (w[iv] * v[iv]->color (ic)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
568 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
569 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
570 if (v[0]->vertex_normal.numel () > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
571 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
572 for (int in = 0; in < 3; in++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
573 for (int iv = 0; iv < vmax; iv++) |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
574 vnn(in) += (w[iv] * v[iv]->vertex_normal (in)); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
575 } |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
576 |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
577 if (v[0]->face_normal.numel () > 0) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
578 { |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
579 for (int in = 0; in < 3; in++) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
580 for (int iv = 0; iv < vmax; iv++) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
581 fnn(in) += (w[iv] * v[iv]->face_normal (in)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
582 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
583 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
584 for (int iv = 0; iv < vmax; iv++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
585 aa += (w[iv] * v[iv]->alpha); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
586 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
587 vertex_data new_v (vv, cc, vnn, fnn, aa, v[0]->ambient, v[0]->diffuse, |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
588 v[0]->specular, v[0]->specular_exp, |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
589 v[0]->specular_color_refl); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
590 tmp_vdata.push_back (new_v); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
591 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
592 *out_data = new_v.get_rep (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
593 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
594 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
595 private: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
596 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
597 // No copying! |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
598 |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22838
diff
changeset
|
599 patch_tesselator (const patch_tesselator&) = delete; |
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22838
diff
changeset
|
600 |
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22838
diff
changeset
|
601 patch_tesselator& operator = (const patch_tesselator&) = delete; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
602 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
603 opengl_renderer *renderer; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
604 int color_mode; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
605 int light_mode; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
606 int index; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
607 bool first; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
608 std::list<vertex_data> tmp_vdata; |
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:
7831
diff
changeset
|
609 }; |
8ff92634982d
Add initial support for patch rendering through GLU tessellation (no transparency, no border, no markers yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7831
diff
changeset
|
610 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
611 #else |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
612 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
613 class |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
614 opengl_renderer::patch_tesselator |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
615 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
616 // Dummy class. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
617 }; |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
618 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
619 #endif |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
620 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
621 opengl_renderer::opengl_renderer (opengl_functions& glfcns) |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
622 : m_glfcns (glfcns), toolkit (), xform (), xmin (), xmax (), ymin (), |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
623 ymax (), zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
624 filled_marker_id (), camera_pos (), camera_dir (), view_vector (), |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
625 interpreter ("none"), txt_renderer (), m_current_light (0), |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
626 m_max_lights (0), selecting (false), m_devpixratio (1.) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
627 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
628 // This constructor will fail if we don't have OpenGL or if the data |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
629 // types we assumed in our public interface aren't compatible with the |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
630 // OpenGL types. |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
631 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
632 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
633 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
634 // Ensure that we can't request an image larger than OpenGL can handle. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
635 // FIXME: should we check signed vs. unsigned? |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
636 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
637 static bool ok = (sizeof (int) <= sizeof (GLsizei)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
638 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
639 if (! ok) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
640 error ("the size of GLsizei is smaller than the size of int"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
641 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
642 #else |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
643 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
644 err_disabled_feature ("opengl_renderer", "OpenGL"); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
645 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
646 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
647 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
648 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
649 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
650 opengl_renderer::draw (const graphics_object& go, bool toplevel) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
651 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
652 if (! go.valid_object ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
653 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
654 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
655 const base_properties& props = go.get_properties (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
656 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
657 if (! toolkit) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
658 toolkit = props.get_toolkit (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
659 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
660 if (go.isa ("figure")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
661 draw_figure (dynamic_cast<const figure::properties&> (props)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
662 else if (go.isa ("axes")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
663 draw_axes (dynamic_cast<const axes::properties&> (props)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
664 else if (go.isa ("line")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
665 draw_line (dynamic_cast<const line::properties&> (props)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
666 else if (go.isa ("surface")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
667 draw_surface (dynamic_cast<const surface::properties&> (props)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
668 else if (go.isa ("patch")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
669 draw_patch (dynamic_cast<const patch::properties&> (props)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
670 else if (go.isa ("light")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
671 draw_light (dynamic_cast<const light::properties&> (props)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
672 else if (go.isa ("hggroup")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
673 draw_hggroup (dynamic_cast<const hggroup::properties&> (props)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
674 else if (go.isa ("text")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
675 draw_text (dynamic_cast<const text::properties&> (props)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
676 else if (go.isa ("image")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
677 draw_image (dynamic_cast<const image::properties&> (props)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
678 else if (go.isa ("uimenu") || go.isa ("uicontrol") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
679 || go.isa ("uicontextmenu") || go.isa ("uitoolbar") |
26112
36e0e5b428e7
Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents:
26025
diff
changeset
|
680 || go.isa ("uipushtool") || go.isa ("uitoggletool") |
36e0e5b428e7
Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents:
26025
diff
changeset
|
681 || go.isa ("uitable")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
682 ; // SKIP |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
683 else if (go.isa ("uipanel")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
684 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
685 if (toplevel) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
686 draw_uipanel (dynamic_cast<const uipanel::properties&> (props), go); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
687 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
688 else if (go.isa ("uibuttongroup")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
689 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
690 if (toplevel) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
691 draw_uibuttongroup (dynamic_cast<const uibuttongroup::properties&> (props), go); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
692 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
693 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
694 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
695 warning ("opengl_renderer: cannot render object of type '%s'", |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
696 props.graphics_object_name ().c_str ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
697 } |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
698 |
22500
1d3b71530539
fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents:
22494
diff
changeset
|
699 #if defined (HAVE_OPENGL) |
1d3b71530539
fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents:
22494
diff
changeset
|
700 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
701 GLenum gl_error = m_glfcns.glGetError (); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
702 if (gl_error) |
23042
c2ed86feba05
gl-render.cc: Show OpenGL error also as string
Andreas Weber <andy.weber.aw@gmail.com>
parents:
23012
diff
changeset
|
703 warning ("opengl_renderer: Error '%s' (%d) occurred drawing '%s' object", |
c2ed86feba05
gl-render.cc: Show OpenGL error also as string
Andreas Weber <andy.weber.aw@gmail.com>
parents:
23012
diff
changeset
|
704 gluErrorString (gl_error), gl_error, props.graphics_object_name ().c_str ()); |
22500
1d3b71530539
fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents:
22494
diff
changeset
|
705 |
1d3b71530539
fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents:
22494
diff
changeset
|
706 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
707 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
708 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
709 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
710 opengl_renderer::draw_figure (const figure::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
711 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
712 // Initialize OpenGL context |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
713 init_gl_context (props.is_graphicssmoothing (), props.get_color_rgb ()); |
7825
13871b7de124
Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
714 |
21689
9467549bd5ff
* gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents:
21684
diff
changeset
|
715 #if defined (HAVE_OPENGL) |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
716 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
717 props.set___gl_extensions__ (get_string (GL_EXTENSIONS)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
718 props.set___gl_renderer__ (get_string (GL_RENDERER)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
719 props.set___gl_vendor__ (get_string (GL_VENDOR)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
720 props.set___gl_version__ (get_string (GL_VERSION)); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
721 |
21689
9467549bd5ff
* gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents:
21684
diff
changeset
|
722 #endif |
21684
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
723 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
724 // Draw children |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
725 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
726 draw (props.get_all_children (), false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
727 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
728 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
729 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
730 opengl_renderer::draw_uipanel (const uipanel::properties& props, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
731 const graphics_object& go) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
732 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
733 graphics_object fig = go.get_ancestor ("figure"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
734 const figure::properties& figProps = |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
735 dynamic_cast<const figure::properties&> (fig.get_properties ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
736 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
737 // Initialize OpenGL context |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
738 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
739 init_gl_context (figProps.is_graphicssmoothing (), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
740 props.get_backgroundcolor_rgb ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
741 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
742 // Draw children |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
743 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
744 draw (props.get_all_children (), false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
745 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
746 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
747 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
748 opengl_renderer::draw_uibuttongroup (const uibuttongroup::properties& props, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
749 const graphics_object& go) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
750 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
751 graphics_object fig = go.get_ancestor ("figure"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
752 const figure::properties& figProps = |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
753 dynamic_cast<const figure::properties&> (fig.get_properties ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
754 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
755 // Initialize OpenGL context |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
756 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
757 init_gl_context (figProps.is_graphicssmoothing (), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
758 props.get_backgroundcolor_rgb ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
759 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
760 // Draw children |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
761 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
762 draw (props.get_all_children (), false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
763 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
764 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
765 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
766 opengl_renderer::init_gl_context (bool enhanced, const Matrix& c) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
767 { |
21689
9467549bd5ff
* gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents:
21684
diff
changeset
|
768 #if defined (HAVE_OPENGL) |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
769 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
770 // Initialize OpenGL context |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
771 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
772 m_glfcns.glEnable (GL_DEPTH_TEST); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
773 m_glfcns.glDepthFunc (GL_LEQUAL); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
774 m_glfcns.glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
775 m_glfcns.glAlphaFunc (GL_GREATER, 0.0f); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
776 m_glfcns.glEnable (GL_NORMALIZE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
777 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
778 if (enhanced) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
779 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
780 m_glfcns.glEnable (GL_BLEND); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
781 m_glfcns.glEnable (GL_MULTISAMPLE); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
782 bool has_multisample = false; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
783 if (! m_glfcns.glGetError ()) |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
784 { |
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
785 GLint iMultiSample, iNumSamples; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
786 m_glfcns.glGetIntegerv (GL_SAMPLE_BUFFERS, &iMultiSample); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
787 m_glfcns.glGetIntegerv (GL_SAMPLES, &iNumSamples); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
788 if (iMultiSample == GL_TRUE && iNumSamples > 0) |
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
789 has_multisample = true; |
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
790 } |
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
791 |
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
792 if (! has_multisample) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
793 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
794 // MultiSample not implemented. Use old-style anti-aliasing |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
795 m_glfcns.glDisable (GL_MULTISAMPLE); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
796 // Disabling GL_MULTISAMPLE will raise a gl error if it is not |
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
797 // implemented. Thus, call glGetError to reset the error state. |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
798 m_glfcns.glGetError (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
799 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
800 m_glfcns.glEnable (GL_LINE_SMOOTH); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
801 m_glfcns.glHint (GL_LINE_SMOOTH_HINT, GL_NICEST); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
802 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
803 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
804 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
805 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
806 m_glfcns.glDisable (GL_BLEND); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
807 m_glfcns.glDisable (GL_LINE_SMOOTH); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
808 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
809 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
810 // Clear background |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
811 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
812 if (c.numel () >= 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
813 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
814 m_glfcns.glClearColor (c(0), c(1), c(2), 1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
815 m_glfcns.glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
816 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
817 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
818 GLenum gl_error = m_glfcns.glGetError (); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
819 if (gl_error) |
23042
c2ed86feba05
gl-render.cc: Show OpenGL error also as string
Andreas Weber <andy.weber.aw@gmail.com>
parents:
23012
diff
changeset
|
820 warning ("opengl_renderer: Error '%s' (%d) occurred in init_gl_context", |
c2ed86feba05
gl-render.cc: Show OpenGL error also as string
Andreas Weber <andy.weber.aw@gmail.com>
parents:
23012
diff
changeset
|
821 gluErrorString (gl_error), gl_error); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
822 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
823 #else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
824 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
825 octave_unused_parameter (enhanced); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
826 octave_unused_parameter (c); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
827 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
828 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
829 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
830 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
831 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
832 |
21689
9467549bd5ff
* gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents:
21684
diff
changeset
|
833 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
834 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
835 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
836 void |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
837 opengl_renderer::render_grid (const double linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
838 const std::string& gridstyle, |
22347
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
839 const Matrix& gridcolor, const double gridalpha, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
840 const Matrix& ticks, double lim1, double lim2, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
841 double p1, double p1N, double p2, double p2N, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
842 int xyz, bool is_3D) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
843 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
844 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
845 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
846 m_glfcns.glColor4d (gridcolor(0), gridcolor(1), gridcolor(2), gridalpha); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
847 set_linestyle (gridstyle, true, linewidth); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
848 m_glfcns.glBegin (GL_LINES); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
849 for (int i = 0; i < ticks.numel (); i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
850 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
851 double val = ticks(i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
852 if (lim1 <= val && val <= lim2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
853 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
854 if (xyz == X_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
855 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
856 m_glfcns.glVertex3d (val, p1N, p2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
857 m_glfcns.glVertex3d (val, p1, p2); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
858 if (is_3D) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
859 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
860 m_glfcns.glVertex3d (val, p1, p2N); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
861 m_glfcns.glVertex3d (val, p1, p2); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
862 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
863 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
864 else if (xyz == Y_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
865 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
866 m_glfcns.glVertex3d (p1N, val, p2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
867 m_glfcns.glVertex3d (p1, val, p2); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
868 if (is_3D) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
869 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
870 m_glfcns.glVertex3d (p1, val, p2N); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
871 m_glfcns.glVertex3d (p1, val, p2); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
872 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
873 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
874 else if (xyz == Z_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
875 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
876 m_glfcns.glVertex3d (p1N, p2, val); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
877 m_glfcns.glVertex3d (p1, p2, val); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
878 m_glfcns.glVertex3d (p1, p2N, val); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
879 m_glfcns.glVertex3d (p1, p2, val); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
880 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
881 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
882 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
883 m_glfcns.glEnd (); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
884 set_linestyle ("-"); // Disable LineStipple |
22347
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
885 double black[3] = {0, 0, 0}; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
886 m_glfcns.glColor3dv (black); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
887 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
888 #else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
889 |
22500
1d3b71530539
fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents:
22494
diff
changeset
|
890 octave_unused_parameter (linewidth); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
891 octave_unused_parameter (gridstyle); |
22347
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
892 octave_unused_parameter (gridcolor); |
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
893 octave_unused_parameter (gridalpha); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
894 octave_unused_parameter (ticks); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
895 octave_unused_parameter (lim1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
896 octave_unused_parameter (lim2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
897 octave_unused_parameter (p1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
898 octave_unused_parameter (p1N); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
899 octave_unused_parameter (p2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
900 octave_unused_parameter (p2N); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
901 octave_unused_parameter (xyz); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
902 octave_unused_parameter (is_3D); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
903 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
904 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
905 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
906 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
907 panic_impossible (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
908 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
909 #endif |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
910 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
911 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
912 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
913 opengl_renderer::render_tickmarks (const Matrix& ticks, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
914 double lim1, double lim2, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
915 double p1, double p1N, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
916 double p2, double p2N, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
917 double dx, double dy, double dz, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
918 int xyz, bool mirror) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
919 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
920 #if defined (HAVE_OPENGL) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
921 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
922 m_glfcns.glBegin (GL_LINES); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
923 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
924 for (int i = 0; i < ticks.numel (); i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
925 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
926 double val = ticks(i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
927 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
928 if (lim1 <= val && val <= lim2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
929 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
930 if (xyz == X_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
931 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
932 m_glfcns.glVertex3d (val, p1, p2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
933 m_glfcns.glVertex3d (val, p1+dy, p2+dz); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
934 if (mirror) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
935 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
936 m_glfcns.glVertex3d (val, p1N, p2N); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
937 m_glfcns.glVertex3d (val, p1N-dy, p2N-dz); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
938 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
939 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
940 else if (xyz == Y_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
941 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
942 m_glfcns.glVertex3d (p1, val, p2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
943 m_glfcns.glVertex3d (p1+dx, val, p2+dz); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
944 if (mirror) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
945 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
946 m_glfcns.glVertex3d (p1N, val, p2N); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
947 m_glfcns.glVertex3d (p1N-dx, val, p2N-dz); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
948 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
949 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
950 else if (xyz == Z_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
951 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
952 m_glfcns.glVertex3d (p1, p2, val); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
953 m_glfcns.glVertex3d (p1+dx, p2+dy, val); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
954 if (mirror) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
955 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
956 m_glfcns.glVertex3d (p1N, p2N, val); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
957 m_glfcns.glVertex3d (p1N-dx, p2N-dy, val); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
958 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
959 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
960 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
961 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
962 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
963 m_glfcns.glEnd (); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
964 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
965 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
966 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
967 octave_unused_parameter (ticks); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
968 octave_unused_parameter (lim1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
969 octave_unused_parameter (lim2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
970 octave_unused_parameter (p1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
971 octave_unused_parameter (p1N); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
972 octave_unused_parameter (p2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
973 octave_unused_parameter (p2N); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
974 octave_unused_parameter (dx); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
975 octave_unused_parameter (dy); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
976 octave_unused_parameter (dz); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
977 octave_unused_parameter (xyz); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
978 octave_unused_parameter (mirror); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
979 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
980 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
981 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
982 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
983 panic_impossible (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
984 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
985 #endif |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
986 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
987 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
988 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
989 opengl_renderer::render_ticktexts (const Matrix& ticks, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
990 const string_vector& ticklabels, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
991 double lim1, double lim2, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
992 double p1, double p2, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
993 int xyz, int ha, int va, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
994 int& wmax, int& hmax) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
995 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
996 #if defined (HAVE_OPENGL) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
997 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
998 int nticks = ticks.numel (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
999 int nlabels = ticklabels.numel (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1000 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1001 if (nlabels == 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1002 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1003 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1004 for (int i = 0; i < nticks; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1005 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1006 double val = ticks(i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1007 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1008 if (lim1 <= val && val <= lim2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1009 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1010 Matrix b; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1011 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1012 std::string label (ticklabels(i % nlabels)); |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1013 label.erase (0, label.find_first_not_of (' ')); |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1014 label = label.substr (0, label.find_last_not_of (' ')+1); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1015 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1016 // FIXME: As tick text is transparent, shouldn't it be |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1017 // drawn after axes object, for correct rendering? |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1018 if (xyz == X_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1019 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1020 b = render_text (label, val, p1, p2, ha, va); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1021 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1022 else if (xyz == Y_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1023 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1024 b = render_text (label, p1, val, p2, ha, va); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1025 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1026 else if (xyz == Z_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1027 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1028 b = render_text (label, p1, p2, val, ha, va); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1029 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1030 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1031 wmax = std::max (wmax, static_cast<int> (b(2))); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1032 hmax = std::max (hmax, static_cast<int> (b(3))); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1033 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1034 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1035 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1036 #else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1037 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1038 octave_unused_parameter (ticks); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1039 octave_unused_parameter (ticklabels); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1040 octave_unused_parameter (lim1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1041 octave_unused_parameter (lim2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1042 octave_unused_parameter (p1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1043 octave_unused_parameter (p2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1044 octave_unused_parameter (xyz); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1045 octave_unused_parameter (ha); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1046 octave_unused_parameter (va); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1047 octave_unused_parameter (wmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1048 octave_unused_parameter (hmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1049 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1050 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1051 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1052 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1053 panic_impossible (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1054 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1055 #endif |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1056 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1057 |
25863
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1058 void |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1059 opengl_renderer::draw_zoom_rect (int x1, int y1, int x2, int y2) |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1060 { |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1061 #if defined (HAVE_OPENGL) |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1062 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1063 m_glfcns.glVertex2d (x1, y1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1064 m_glfcns.glVertex2d (x2, y1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1065 m_glfcns.glVertex2d (x2, y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1066 m_glfcns.glVertex2d (x1, y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1067 m_glfcns.glVertex2d (x1, y1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1068 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1069 #else |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1070 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1071 octave_unused_parameter (x1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1072 octave_unused_parameter (x2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1073 octave_unused_parameter (y1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1074 octave_unused_parameter (y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1075 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1076 // This shouldn't happen because construction of opengl_renderer |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1077 // objects is supposed to be impossible if OpenGL is not available. |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1078 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1079 panic_impossible (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1080 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1081 #endif |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1082 } |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1083 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1084 void |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1085 opengl_renderer::draw_zoom_box (int width, int height, |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1086 int x1, int y1, int x2, int y2, |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1087 const Matrix& overlaycolor, |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1088 double overlayalpha, |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1089 const Matrix& bordercolor, |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1090 double borderalpha, double borderwidth) |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1091 { |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1092 #if defined (HAVE_OPENGL) |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1093 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1094 m_glfcns.glMatrixMode (GL_MODELVIEW); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1095 m_glfcns.glPushMatrix (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1096 m_glfcns.glLoadIdentity (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1097 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1098 m_glfcns.glMatrixMode (GL_PROJECTION); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1099 m_glfcns.glPushMatrix (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1100 m_glfcns.glLoadIdentity (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1101 m_glfcns.glOrtho (0, width, height, 0, 1, -1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1102 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1103 m_glfcns.glPushAttrib (GL_DEPTH_BUFFER_BIT | GL_CURRENT_BIT); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1104 m_glfcns.glDisable (GL_DEPTH_TEST); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1105 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1106 m_glfcns.glBegin (GL_POLYGON); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1107 m_glfcns.glColor4f (overlaycolor(0), overlaycolor(1), overlaycolor(2), |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1108 overlayalpha); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1109 draw_zoom_rect (x1, y1, x2, y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1110 m_glfcns.glEnd (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1111 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1112 m_glfcns.glLineWidth (borderwidth); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1113 m_glfcns.glBegin (GL_LINE_STRIP); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1114 m_glfcns.glColor4f (bordercolor(0), bordercolor(1), bordercolor(2), |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1115 borderalpha); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1116 draw_zoom_rect (x1, y1, x2, y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1117 m_glfcns.glEnd (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1118 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1119 m_glfcns.glPopAttrib (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1120 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1121 m_glfcns.glMatrixMode (GL_MODELVIEW); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1122 m_glfcns.glPopMatrix (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1123 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1124 m_glfcns.glMatrixMode (GL_PROJECTION); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1125 m_glfcns.glPopMatrix (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1126 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1127 #else |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1128 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1129 octave_unused_parameter (width); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1130 octave_unused_parameter (height); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1131 octave_unused_parameter (x1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1132 octave_unused_parameter (x2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1133 octave_unused_parameter (y1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1134 octave_unused_parameter (y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1135 octave_unused_parameter (overlaycolor); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1136 octave_unused_parameter (overlayalpha); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1137 octave_unused_parameter (bordercolor); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1138 octave_unused_parameter (borderalpha); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1139 octave_unused_parameter (borderwidth); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1140 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1141 // This shouldn't happen because construction of opengl_renderer |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1142 // objects is supposed to be impossible if OpenGL is not available. |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1143 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1144 panic_impossible (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1145 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1146 #endif |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1147 } |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1148 |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1149 uint8NDArray |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1150 opengl_renderer::get_pixels (int width, int height) |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1151 { |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1152 #if defined (HAVE_OPENGL) |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1153 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1154 m_glfcns.glPixelStorei (GL_PACK_ALIGNMENT, 1); |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1155 uint8NDArray pix(dim_vector (3, width, height), 0); |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25980
diff
changeset
|
1156 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1157 m_glfcns.glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25980
diff
changeset
|
1158 pix.fortran_vec ()); |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1159 |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1160 // Permute and flip data |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1161 Array<octave_idx_type> perm (dim_vector (3, 1)); |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1162 perm(0) = 2; |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1163 perm(1) = 1; |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1164 perm(2) = 0; |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1165 |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1166 Array<idx_vector> idx (dim_vector (3, 1)); |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1167 idx(0) = idx_vector::make_range (height - 1, -1, height); |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1168 idx(1) = idx_vector::colon; |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1169 idx(2) = idx_vector::colon; |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1170 |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1171 return pix.permute (perm).index (idx); |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1172 |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1173 #else |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1174 |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1175 // This shouldn't happen because construction of opengl_renderer |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1176 // objects is supposed to be impossible if OpenGL is not available. |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1177 |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1178 octave_unused_parameter (width); |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1179 octave_unused_parameter (height); |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1180 |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1181 panic_impossible (); |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1182 |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1183 #endif |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1184 } |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1185 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1186 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1187 opengl_renderer::finish (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1188 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1189 #if defined (HAVE_OPENGL) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1190 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1191 m_glfcns.glFinish (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1192 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1193 #else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1194 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1195 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1196 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1197 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1198 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1199 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1200 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1201 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1202 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1203 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1204 opengl_renderer::setup_opengl_transformation (const axes::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1205 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1206 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1207 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1208 // setup OpenGL transformation |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1209 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1210 Matrix x_zlim = props.get_transform_zlim (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1211 |
25826
2c42ed37cfc2
Increase OpenGL clipping limits in ortho view (bug #54551).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25820
diff
changeset
|
1212 xZ1 = std::max (-1e6, x_zlim(0)-(x_zlim(1)-x_zlim(0))*100.0); |
2c42ed37cfc2
Increase OpenGL clipping limits in ortho view (bug #54551).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25820
diff
changeset
|
1213 xZ2 = std::min (1e6, x_zlim(1)+(x_zlim(1)-x_zlim(0))*100.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1214 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1215 Matrix x_mat1 = props.get_opengl_matrix_1 (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1216 Matrix x_mat2 = props.get_opengl_matrix_2 (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1217 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1218 m_glfcns.glMatrixMode (GL_MODELVIEW); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1219 m_glfcns.glLoadIdentity (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1220 m_glfcns.glScaled (1, 1, -1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1221 m_glfcns.glMultMatrixd (x_mat1.data ()); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1222 m_glfcns.glMatrixMode (GL_PROJECTION); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1223 m_glfcns.glLoadIdentity (); |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25871
diff
changeset
|
1224 |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
1225 Matrix vp = get_viewport_scaled (); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
1226 m_glfcns.glOrtho (0, vp(2), vp(3), 0, xZ1, xZ2); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1227 m_glfcns.glMultMatrixd (x_mat2.data ()); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1228 m_glfcns.glMatrixMode (GL_MODELVIEW); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1229 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1230 m_glfcns.glClear (GL_DEPTH_BUFFER_BIT); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1231 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1232 // store axes transformation data |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1233 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1234 xform = props.get_transform (); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1235 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1236 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1237 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1238 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1239 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1240 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1241 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1242 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1243 panic_impossible (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1244 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1245 #endif |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1246 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1247 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1248 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1249 opengl_renderer::draw_axes_planes (const axes::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1250 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1251 #if defined (HAVE_OPENGL) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1252 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1253 Matrix axe_color = props.get_color_rgb (); |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
1254 if (axe_color.isempty () || ! props.is_visible ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1255 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1256 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1257 double xPlane = props.get_xPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1258 double yPlane = props.get_yPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1259 double zPlane = props.get_zPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1260 double xPlaneN = props.get_xPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1261 double yPlaneN = props.get_yPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1262 double zPlaneN = props.get_zPlaneN (); |
26020
912e1daa03d2
maint: Use 2D, 3D in variable names in graphics code rather than 2d,3d.
Rik <rik@octave.org>
parents:
25999
diff
changeset
|
1263 bool is2D = props.get_is2D (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1264 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1265 // Axes planes |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1266 set_color (axe_color); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
1267 set_polygon_offset (true, 9.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1268 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1269 m_glfcns.glBegin (GL_QUADS); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1270 |
26020
912e1daa03d2
maint: Use 2D, 3D in variable names in graphics code rather than 2d,3d.
Rik <rik@octave.org>
parents:
25999
diff
changeset
|
1271 if (! is2D) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1272 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1273 // X plane |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1274 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1275 m_glfcns.glVertex3d (xPlane, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1276 m_glfcns.glVertex3d (xPlane, yPlane, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1277 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1278 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1279 // Y plane |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1280 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1281 m_glfcns.glVertex3d (xPlane, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1282 m_glfcns.glVertex3d (xPlane, yPlane, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1283 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1284 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1285 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1286 // Z plane |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1287 m_glfcns.glVertex3d (xPlaneN, yPlaneN, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1288 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1289 m_glfcns.glVertex3d (xPlane, yPlane, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1290 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1291 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1292 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1293 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1294 set_polygon_offset (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1295 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1296 #else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1297 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1298 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1299 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1300 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1301 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1302 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1303 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1304 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1305 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1306 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1307 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1308 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1309 opengl_renderer::draw_axes_boxes (const axes::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1310 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1311 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1312 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1313 if (! props.is_visible ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1314 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1315 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1316 bool xySym = props.get_xySym (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1317 bool layer2Dtop = props.get_layer2Dtop (); |
26020
912e1daa03d2
maint: Use 2D, 3D in variable names in graphics code rather than 2d,3d.
Rik <rik@octave.org>
parents:
25999
diff
changeset
|
1318 bool is2D = props.get_is2D (); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1319 bool isXOrigin = props.xaxislocation_is ("origin") |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1320 && ! props.yscale_is ("log"); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1321 bool isYOrigin = props.yaxislocation_is ("origin") |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1322 && ! props.xscale_is ("log"); |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1323 bool boxFull = (props.get_boxstyle () == "full"); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1324 double linewidth = props.get_linewidth (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1325 double xPlane = props.get_xPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1326 double yPlane = props.get_yPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1327 double zPlane = props.get_zPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1328 double xPlaneN = props.get_xPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1329 double yPlaneN = props.get_yPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1330 double zPlaneN = props.get_zPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1331 double xpTick = props.get_xpTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1332 double ypTick = props.get_ypTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1333 double zpTick = props.get_zpTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1334 double xpTickN = props.get_xpTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1335 double ypTickN = props.get_ypTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1336 double zpTickN = props.get_zpTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1337 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1338 bool plotyy = (props.has_property ("__plotyy_axes__")); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1339 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1340 // Axes box |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1341 |
24807
8585b3f9c28c
Use "butt" linecap to workaround split lines in printout (bug #53229).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24725
diff
changeset
|
1342 set_linecap ("square"); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1343 set_linestyle ("-", true, linewidth); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1344 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1345 m_glfcns.glBegin (GL_LINES); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1346 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1347 if (layer2Dtop) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1348 std::swap (zpTick, zpTickN); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1349 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1350 // X box |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1351 Matrix color = props.get_xcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1352 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1353 if (! color.isempty ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1354 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1355 set_color (color); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1356 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1357 if (! isXOrigin || props.is_box() || ! is2D) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1358 { |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1359 m_glfcns.glVertex3d (xPlaneN, ypTick, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1360 m_glfcns.glVertex3d (xPlane, ypTick, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1361 } |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1362 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1363 if (props.is_box ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1364 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1365 m_glfcns.glVertex3d (xPlaneN, ypTickN, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1366 m_glfcns.glVertex3d (xPlane, ypTickN, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1367 if (! is2D) |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1368 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1369 m_glfcns.glVertex3d (xPlaneN, ypTickN, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1370 m_glfcns.glVertex3d (xPlane, ypTickN, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1371 if (boxFull) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1372 { |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1373 m_glfcns.glVertex3d (xPlaneN, ypTick, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1374 m_glfcns.glVertex3d (xPlane, ypTick, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1375 } |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1376 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1377 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1378 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1379 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1380 // Y box |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1381 color = props.get_ycolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1382 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1383 if (! color.isempty ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1384 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1385 set_color (color); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1386 if (! isYOrigin || props.is_box() || ! is2D) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1387 { |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1388 m_glfcns.glVertex3d (xpTick, yPlaneN, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1389 m_glfcns.glVertex3d (xpTick, yPlane, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1390 } |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1391 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1392 if (props.is_box () && ! plotyy) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1393 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1394 m_glfcns.glVertex3d (xpTickN, yPlaneN, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1395 m_glfcns.glVertex3d (xpTickN, yPlane, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1396 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1397 if (! is2D) |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1398 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1399 m_glfcns.glVertex3d (xpTickN, yPlaneN, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1400 m_glfcns.glVertex3d (xpTickN, yPlane, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1401 if (boxFull) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1402 { |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1403 m_glfcns.glVertex3d (xpTick, yPlaneN, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1404 m_glfcns.glVertex3d (xpTick, yPlane, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1405 } |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1406 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1407 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1408 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1409 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1410 // Z box |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1411 color = props.get_zcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1412 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1413 if (! color.isempty () && ! is2D) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1414 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1415 set_color (color); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1416 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1417 if (xySym) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1418 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1419 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1420 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1421 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1422 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1423 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1424 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1425 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1426 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1427 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1428 if (props.is_box ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1429 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1430 m_glfcns.glVertex3d (xPlane, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1431 m_glfcns.glVertex3d (xPlane, yPlane, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1432 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1433 if (xySym) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1434 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1435 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1436 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1437 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1438 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1439 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1440 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1441 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1442 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1443 |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1444 if (boxFull) |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1445 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1446 m_glfcns.glVertex3d (xPlaneN, yPlaneN, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1447 m_glfcns.glVertex3d (xPlaneN, yPlaneN, zPlane); |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1448 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1449 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1450 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1451 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1452 m_glfcns.glEnd (); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1453 |
25260
601cc3a063f5
Fix OpenGL line-stipple bug manifested as Nouveau driver crash (bug #53644)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1454 set_linestyle ("-"); // Disable LineStipple |
601cc3a063f5
Fix OpenGL line-stipple bug manifested as Nouveau driver crash (bug #53644)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1455 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1456 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1457 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1458 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1459 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1460 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1461 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1462 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1463 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1464 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1465 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1466 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1467 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1468 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1469 opengl_renderer::draw_axes_x_grid (const axes::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1470 { |
22740
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1471 #if defined (HAVE_OPENGL) |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1472 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1473 int xstate = props.get_xstate (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1474 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
1475 if (xstate != AXE_DEPTH_DIR |
24634
ab2321d4ba03
maint: strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1476 && (props.is_visible () |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
1477 || (selecting && props.pickableparts_is ("all")))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1478 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1479 int zstate = props.get_zstate (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1480 bool x2Dtop = props.get_x2Dtop (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1481 bool layer2Dtop = props.get_layer2Dtop (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1482 bool xyzSym = props.get_xyzSym (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1483 bool nearhoriz = props.get_nearhoriz (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1484 double xticklen = props.get_xticklen (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1485 double xtickoffset = props.get_xtickoffset (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1486 double fy = props.get_fy (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1487 double fz = props.get_fz (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1488 double x_min = props.get_x_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1489 double x_max = props.get_x_max (); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1490 double y_min = props.get_y_min (); |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1491 double y_max = props.get_y_max (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1492 double yPlane = props.get_yPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1493 double yPlaneN = props.get_yPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1494 double ypTick = props.get_ypTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1495 double ypTickN = props.get_ypTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1496 double zPlane = props.get_zPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1497 double zPlaneN = props.get_zPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1498 double zpTick = props.get_zpTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1499 double zpTickN = props.get_zpTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1500 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1501 // X ticks and grid properties |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1502 Matrix xticks = xform.xscale (props.get_xtick ().matrix_value ()); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1503 Matrix xmticks = xform.xscale (props.get_xminortickvalues ().matrix_value ()); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1504 bool do_xminortick = props.is_xminortick () && ! xticks.isempty (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1505 string_vector xticklabels = props.get_xticklabel ().string_vector_value (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1506 int wmax = 0; |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1507 int hmax = 0; |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1508 bool tick_along_z = nearhoriz || math::isinf (fy); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1509 double linewidth = props.get_linewidth (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1510 std::string gridstyle = props.get_gridlinestyle (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1511 std::string minorgridstyle = props.get_minorgridlinestyle (); |
22347
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1512 Matrix gridcolor = props.get_gridcolor_rgb (); |
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1513 Matrix minorgridcolor = props.get_minorgridcolor_rgb (); |
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1514 double gridalpha = props.get_gridalpha (); |
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1515 double minorgridalpha = props.get_minorgridalpha (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1516 bool do_xgrid = (props.is_xgrid () && (gridstyle != "none")); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1517 bool do_xminorgrid = (props.is_xminorgrid () |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1518 && (minorgridstyle != "none") |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1519 && ! xticks.isempty ()); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1520 bool is_origin = props.xaxislocation_is ("origin") && props.get_is2D () |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1521 && ! props.yscale_is ("log"); |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1522 bool is_origin_low = is_origin && (y_min + y_max) < 0; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1523 bool mirror = props.is_box () && xstate != AXE_ANY_DIR; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1524 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1525 // X grid |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1526 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1527 // possibly use axis color for gridcolor & minorgridcolor |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1528 if (props.gridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1529 if (props.xcolormode_is ("manual") && ! props.xcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1530 gridcolor = props.get_xcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1531 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1532 if (props.minorgridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1533 if (props.xcolormode_is ("manual") && ! props.xcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1534 minorgridcolor = props.get_xcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1535 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1536 if (gridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1537 do_xgrid = false; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1538 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1539 if (minorgridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1540 do_xminorgrid = false; |
22528
5a1167e15c0e
Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22500
diff
changeset
|
1541 |
22348
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1542 // set styles when drawing only minor grid |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1543 if (do_xminorgrid && ! do_xgrid) |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1544 { |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1545 gridstyle = minorgridstyle; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1546 gridcolor = minorgridcolor; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1547 gridalpha = minorgridalpha; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1548 do_xgrid = true; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1549 } |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1550 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1551 // minor grid lines |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1552 if (do_xminorgrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1553 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1554 minorgridstyle, minorgridcolor, minorgridalpha, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1555 xmticks, x_min, x_max, |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1556 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1557 0, (zstate != AXE_DEPTH_DIR)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1558 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1559 // grid lines |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1560 if (do_xgrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1561 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1562 gridstyle, gridcolor, gridalpha, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1563 xticks, x_min, x_max, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1564 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1565 0, (zstate != AXE_DEPTH_DIR)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1566 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1567 // Skip drawing axis, ticks, and ticklabels when color is "none" |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1568 if (props.xcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1569 return; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1570 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1571 set_color (props.get_xcolor_rgb ()); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1572 |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1573 // axis line |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1574 double y_axis_pos = 0.; |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1575 if (is_origin) |
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1576 { |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1577 y_axis_pos = math::max (math::min (0., y_max), y_min); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1578 m_glfcns.glBegin (GL_LINES); |
26430
a665b4823da9
gl-render.cc (draw_axes_x_grid): Fix copy & paste error (bug #55390).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26417
diff
changeset
|
1579 set_color (props.get_xcolor_rgb ()); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1580 m_glfcns.glVertex3d (x_min, y_axis_pos, zpTick); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1581 m_glfcns.glVertex3d (x_max, y_axis_pos, zpTick); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1582 m_glfcns.glEnd (); |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1583 } |
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1584 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1585 // minor tick marks |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1586 if (do_xminortick) |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1587 { |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1588 if (tick_along_z) |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1589 render_tickmarks (xmticks, x_min, x_max, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1590 is_origin ? y_axis_pos : ypTick, ypTick, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1591 zpTick, zpTickN, 0., 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1592 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1593 math::signum (zpTick-zpTickN)*fz*xticklen/2, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1594 0, ! is_origin && mirror); |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1595 else |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1596 render_tickmarks (xmticks, x_min, x_max, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1597 is_origin ? y_axis_pos : ypTick, ypTickN, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1598 zpTick, zpTick, 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1599 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1600 math::signum (ypTick-ypTickN)*fy*xticklen/2, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1601 0., 0, ! is_origin && mirror); |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1602 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1603 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1604 // tick marks |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1605 if (tick_along_z) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1606 render_tickmarks (xticks, x_min, x_max, |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1607 is_origin ? y_axis_pos : ypTick, ypTick, |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1608 zpTick, zpTickN, 0., 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1609 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1610 math::signum (zpTick-zpTickN)*fz*xticklen, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1611 0, ! is_origin && mirror); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1612 else |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1613 render_tickmarks (xticks, x_min, x_max, |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1614 is_origin ? y_axis_pos : ypTick, ypTickN, |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1615 zpTick, zpTick, 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1616 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1617 math::signum (ypTick-ypTickN)*fy*xticklen, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1618 0., 0, ! is_origin && mirror); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1619 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1620 // tick texts |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1621 if (xticklabels.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1622 { |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1623 int halign = (xstate == AXE_HORZ_DIR |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1624 ? 1 |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1625 : (xyzSym || is_origin_low ? 0 : 2)); |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1626 int valign = (xstate == AXE_VERT_DIR |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1627 ? 1 |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1628 : (x2Dtop || is_origin_low ? 0 : 2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1629 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1630 if (tick_along_z) |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1631 render_ticktexts (xticks, xticklabels, x_min, x_max, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1632 is_origin ? y_axis_pos : ypTick, |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1633 zpTick + |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1634 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1635 math::signum (zpTick-zpTickN)*fz*xtickoffset, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1636 0, halign, valign, wmax, hmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1637 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1638 render_ticktexts (xticks, xticklabels, x_min, x_max, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1639 (is_origin ? y_axis_pos : ypTick) + |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1640 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1641 math::signum (ypTick-ypTickN)*fy*xtickoffset, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1642 zpTick, 0, halign, valign, wmax, hmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1643 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1644 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1645 gh_manager::get_object (props.get_xlabel ()).set ("visible", "on"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1646 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1647 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1648 gh_manager::get_object (props.get_xlabel ()).set ("visible", "off"); |
22740
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1649 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1650 #else |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1651 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1652 octave_unused_parameter (props); |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1653 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1654 // This shouldn't happen because construction of opengl_renderer |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1655 // objects is supposed to be impossible if OpenGL is not available. |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1656 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1657 panic_impossible (); |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1658 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1659 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1660 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1661 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1662 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1663 opengl_renderer::draw_axes_y_grid (const axes::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1664 { |
22740
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1665 #if defined (HAVE_OPENGL) |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1666 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1667 int ystate = props.get_ystate (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1668 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
1669 if (ystate != AXE_DEPTH_DIR && props.is_visible () |
24634
ab2321d4ba03
maint: strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1670 && (props.is_visible () |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
1671 || (selecting && props.pickableparts_is ("all")))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1672 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1673 int zstate = props.get_zstate (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1674 bool y2Dright = props.get_y2Dright (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1675 bool layer2Dtop = props.get_layer2Dtop (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1676 bool xyzSym = props.get_xyzSym (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1677 bool nearhoriz = props.get_nearhoriz (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1678 double yticklen = props.get_yticklen (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1679 double ytickoffset = props.get_ytickoffset (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1680 double fx = props.get_fx (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1681 double fz = props.get_fz (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1682 double xPlane = props.get_xPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1683 double xPlaneN = props.get_xPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1684 double xpTick = props.get_xpTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1685 double xpTickN = props.get_xpTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1686 double y_min = props.get_y_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1687 double y_max = props.get_y_max (); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1688 double x_min = props.get_x_min (); |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1689 double x_max = props.get_x_max (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1690 double zPlane = props.get_zPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1691 double zPlaneN = props.get_zPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1692 double zpTick = props.get_zpTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1693 double zpTickN = props.get_zpTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1694 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1695 // Y ticks and grid properties |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1696 Matrix yticks = xform.yscale (props.get_ytick ().matrix_value ()); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1697 Matrix ymticks = xform.yscale (props.get_yminortickvalues ().matrix_value ()); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1698 bool do_yminortick = props.is_yminortick () && ! yticks.isempty (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1699 string_vector yticklabels = props.get_yticklabel ().string_vector_value (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1700 int wmax = 0; |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1701 int hmax = 0; |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1702 bool tick_along_z = nearhoriz || math::isinf (fx); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1703 double linewidth = props.get_linewidth (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1704 std::string gridstyle = props.get_gridlinestyle (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1705 std::string minorgridstyle = props.get_minorgridlinestyle (); |
22347
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1706 Matrix gridcolor = props.get_gridcolor_rgb (); |
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1707 Matrix minorgridcolor = props.get_minorgridcolor_rgb (); |
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1708 double gridalpha = props.get_gridalpha (); |
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1709 double minorgridalpha = props.get_minorgridalpha (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1710 bool do_ygrid = (props.is_ygrid () && (gridstyle != "none")); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1711 bool do_yminorgrid = (props.is_yminorgrid () |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1712 && (minorgridstyle != "none") |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1713 && ! yticks.isempty ()); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1714 bool is_origin = props.yaxislocation_is ("origin") && props.get_is2D () |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1715 && ! props.xscale_is ("log"); |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1716 bool is_origin_low = is_origin && (x_min + x_max) < 0; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1717 bool mirror = props.is_box () && ystate != AXE_ANY_DIR |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
1718 && (! props.has_property ("__plotyy_axes__")); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1719 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1720 // Y grid |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1721 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1722 // possibly use axis color for gridcolor & minorgridcolor |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1723 if (props.gridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1724 if (props.ycolormode_is ("manual") && ! props.ycolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1725 gridcolor = props.get_ycolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1726 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1727 if (props.minorgridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1728 if (props.ycolormode_is ("manual") && ! props.ycolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1729 minorgridcolor = props.get_ycolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1730 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1731 if (gridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1732 do_ygrid = false; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1733 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1734 if (minorgridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1735 do_yminorgrid = false; |
22528
5a1167e15c0e
Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22500
diff
changeset
|
1736 |
22348
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1737 // set styles when drawing only minor grid |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1738 if (do_yminorgrid && ! do_ygrid) |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1739 { |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1740 gridstyle = minorgridstyle; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1741 gridcolor = minorgridcolor; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1742 gridalpha = minorgridalpha; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1743 do_ygrid = true; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1744 } |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1745 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1746 // minor grid lines |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1747 if (do_yminorgrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1748 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1749 minorgridstyle, minorgridcolor, minorgridalpha, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1750 ymticks, y_min, y_max, |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1751 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1752 1, (zstate != AXE_DEPTH_DIR)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1753 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1754 // grid lines |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1755 if (do_ygrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1756 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1757 gridstyle, gridcolor, gridalpha, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1758 yticks, y_min, y_max, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1759 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1760 1, (zstate != AXE_DEPTH_DIR)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1761 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1762 // Skip drawing axis, ticks, and ticklabels when color is "none" |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1763 if (props.ycolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1764 return; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1765 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1766 set_color (props.get_ycolor_rgb ()); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1767 |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1768 // axis line |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1769 double x_axis_pos = 0.; |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1770 if (is_origin) |
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1771 { |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1772 x_axis_pos = math::max (math::min (0., x_max), x_min); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1773 m_glfcns.glBegin (GL_LINES); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1774 set_color (props.get_ycolor_rgb ()); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1775 m_glfcns.glVertex3d (x_axis_pos, y_min, zpTick); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1776 m_glfcns.glVertex3d (x_axis_pos, y_max, zpTick); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1777 m_glfcns.glEnd (); |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1778 } |
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1779 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1780 // minor tick marks |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1781 if (do_yminortick) |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1782 { |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1783 if (tick_along_z) |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1784 render_tickmarks (ymticks, y_min, y_max, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1785 is_origin ? x_axis_pos : xpTick, xpTick, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1786 zpTick, zpTickN, 0., 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1787 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1788 math::signum (zpTick-zpTickN)*fz*yticklen/2, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1789 1, ! is_origin && mirror); |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1790 else |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1791 render_tickmarks (ymticks, y_min, y_max, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1792 is_origin ? x_axis_pos : xpTick, xpTickN, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1793 zpTick, zpTick, |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1794 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1795 math::signum (xpTick-xpTickN)*fx*yticklen/2, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1796 0., 0., 1, ! is_origin && mirror); |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1797 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1798 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1799 // tick marks |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1800 if (tick_along_z) |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1801 render_tickmarks (yticks, y_min, y_max, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1802 is_origin ? x_axis_pos : xpTick, xpTick, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1803 zpTick, zpTickN, 0., 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1804 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1805 math::signum (zpTick-zpTickN)*fz*yticklen, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1806 1, ! is_origin && mirror); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1807 else |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1808 render_tickmarks (yticks, y_min, y_max, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1809 is_origin ? x_axis_pos : xpTick, xpTickN, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1810 zpTick, zpTick, |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1811 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1812 math::signum (xPlaneN-xPlane)*fx*yticklen, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1813 0., 0., 1, ! is_origin && mirror); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1814 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1815 // tick texts |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1816 if (yticklabels.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1817 { |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1818 int halign = (ystate == AXE_HORZ_DIR |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1819 ? 1 |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1820 : (! xyzSym || y2Dright || is_origin_low ? 0 : 2)); |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1821 int valign = (ystate == AXE_VERT_DIR |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1822 ? 1 |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1823 : (is_origin_low ? 0 : 2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1824 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1825 if (tick_along_z) |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1826 render_ticktexts (yticks, yticklabels, y_min, y_max, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1827 is_origin ? x_axis_pos : xpTick, |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1828 zpTick + |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1829 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1830 math::signum (zpTick-zpTickN)*fz*ytickoffset, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1831 1, halign, valign, wmax, hmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1832 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1833 render_ticktexts (yticks, yticklabels, y_min, y_max, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1834 (is_origin ? x_axis_pos : xpTick) + |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1835 (is_origin_low ? -1. : 1.) * |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1836 math::signum (xpTick-xpTickN)*fx*ytickoffset, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1837 zpTick, 1, halign, valign, wmax, hmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1838 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1839 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1840 gh_manager::get_object (props.get_ylabel ()).set ("visible", "on"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1841 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1842 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1843 gh_manager::get_object (props.get_ylabel ()).set ("visible", "off"); |
22740
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1844 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1845 #else |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1846 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1847 octave_unused_parameter (props); |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1848 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1849 // This shouldn't happen because construction of opengl_renderer |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1850 // objects is supposed to be impossible if OpenGL is not available. |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1851 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1852 panic_impossible (); |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1853 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1854 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1855 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1856 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1857 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1858 opengl_renderer::draw_axes_z_grid (const axes::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1859 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1860 int zstate = props.get_zstate (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1861 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
1862 if (zstate != AXE_DEPTH_DIR && props.is_visible () |
24634
ab2321d4ba03
maint: strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1863 && (props.is_visible () |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
1864 || (selecting && props.pickableparts_is ("all")))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1865 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1866 bool xySym = props.get_xySym (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1867 bool zSign = props.get_zSign (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1868 double zticklen = props.get_zticklen (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1869 double ztickoffset = props.get_ztickoffset (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1870 double fx = props.get_fx (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1871 double fy = props.get_fy (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1872 double xPlane = props.get_xPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1873 double xPlaneN = props.get_xPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1874 double yPlane = props.get_yPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1875 double yPlaneN = props.get_yPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1876 double z_min = props.get_z_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1877 double z_max = props.get_z_max (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1878 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1879 // Z ticks and grid properties |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1880 Matrix zticks = xform.zscale (props.get_ztick ().matrix_value ()); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1881 Matrix zmticks = xform.zscale (props.get_zminortickvalues ().matrix_value ()); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1882 bool do_zminortick = props.is_zminortick () && ! zticks.isempty (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1883 string_vector zticklabels = props.get_zticklabel ().string_vector_value (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1884 int wmax = 0; |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1885 int hmax = 0; |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1886 double linewidth = props.get_linewidth (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1887 std::string gridstyle = props.get_gridlinestyle (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1888 std::string minorgridstyle = props.get_minorgridlinestyle (); |
22347
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1889 Matrix gridcolor = props.get_gridcolor_rgb (); |
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1890 Matrix minorgridcolor = props.get_minorgridcolor_rgb (); |
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1891 double gridalpha = props.get_gridalpha (); |
2b1612cf38e4
gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22331
diff
changeset
|
1892 double minorgridalpha = props.get_minorgridalpha (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1893 bool do_zgrid = (props.is_zgrid () && (gridstyle != "none")); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1894 bool do_zminorgrid = (props.is_zminorgrid () |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1895 && (minorgridstyle != "none") |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1896 && ! zticks.isempty ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1897 bool mirror = props.is_box () && zstate != AXE_ANY_DIR; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1898 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1899 // Z grid |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1900 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1901 // possibly use axis color for gridcolor & minorgridcolor |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1902 if (props.gridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1903 if (props.zcolormode_is ("manual") && ! props.zcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1904 gridcolor = props.get_zcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1905 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1906 if (props.minorgridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1907 if (props.zcolormode_is ("manual") && ! props.zcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1908 minorgridcolor = props.get_zcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1909 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1910 if (gridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1911 do_zgrid = false; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1912 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1913 if (minorgridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1914 do_zminorgrid = false; |
22528
5a1167e15c0e
Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22500
diff
changeset
|
1915 |
22348
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1916 // set styles when drawing only minor grid |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1917 if (do_zminorgrid && ! do_zgrid) |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1918 { |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1919 gridstyle = minorgridstyle; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1920 gridcolor = minorgridcolor; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1921 gridalpha = minorgridalpha; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1922 do_zgrid = true; |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1923 } |
9deb86bb5632
gl-render.cc: Draw minor grid lines at major ticks if major grid is off (bug #48528)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22347
diff
changeset
|
1924 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1925 // minor grid lines |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1926 if (do_zminorgrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1927 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1928 minorgridstyle, minorgridcolor, minorgridalpha, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1929 zmticks, z_min, z_max, |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1930 xPlane, xPlaneN, yPlane, yPlaneN, 2, true); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1931 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1932 // grid lines |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1933 if (do_zgrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1934 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1935 gridstyle, gridcolor, gridalpha, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1936 zticks, z_min, z_max, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1937 xPlane, xPlaneN, yPlane, yPlaneN, 2, true); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1938 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1939 // Skip drawing axis, ticks, and ticklabels when color is "none" |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1940 if (props.zcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1941 return; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1942 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1943 set_color (props.get_zcolor_rgb ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1944 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1945 // minor tick marks |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1946 if (do_zminortick) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1947 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1948 if (xySym) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1949 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1950 if (math::isinf (fy)) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1951 render_tickmarks (zmticks, z_min, z_max, xPlaneN, xPlane, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1952 yPlane, yPlane, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1953 math::signum (xPlaneN-xPlane)*fx*zticklen/2, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1954 0., 0., 2, mirror); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1955 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1956 render_tickmarks (zmticks, z_min, z_max, xPlaneN, xPlaneN, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1957 yPlane, yPlane, 0., |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1958 math::signum (yPlane-yPlaneN)*fy*zticklen/2, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1959 0., 2, false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1960 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1961 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1962 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1963 if (math::isinf (fx)) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1964 render_tickmarks (zmticks, z_min, z_max, xPlane, xPlane, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1965 yPlaneN, yPlane, 0., |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1966 math::signum (yPlaneN-yPlane)*fy*zticklen/2, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1967 0., 2, mirror); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1968 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1969 render_tickmarks (zmticks, z_min, z_max, xPlane, xPlane, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1970 yPlaneN, yPlaneN, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1971 math::signum (xPlane-xPlaneN)*fx*zticklen/2, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1972 0., 0., 2, false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1973 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1974 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1975 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1976 // tick marks |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1977 if (xySym) |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1978 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1979 if (math::isinf (fy)) |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1980 render_tickmarks (zticks, z_min, z_max, xPlaneN, xPlane, |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1981 yPlane, yPlane, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1982 math::signum (xPlaneN-xPlane)*fx*zticklen, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1983 0., 0., 2, mirror); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1984 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1985 render_tickmarks (zticks, z_min, z_max, xPlaneN, xPlaneN, |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1986 yPlane, yPlane, 0., |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1987 math::signum (yPlane-yPlaneN)*fy*zticklen, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1988 0., 2, false); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1989 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1990 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1991 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1992 if (math::isinf (fx)) |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1993 render_tickmarks (zticks, z_min, z_max, xPlaneN, xPlane, |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1994 yPlaneN, yPlane, 0., |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1995 math::signum (yPlaneN-yPlane)*fy*zticklen, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1996 0., 2, mirror); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1997 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1998 render_tickmarks (zticks, z_min, z_max, xPlane, xPlane, |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1999 yPlaneN, yPlane, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2000 math::signum (xPlane-xPlaneN)*fx*zticklen, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2001 0., 0., 2, false); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2002 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2003 |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2004 // tick texts |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2005 if (zticklabels.numel () > 0) |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2006 { |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2007 int halign = 2; |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2008 int valign = (zstate == AXE_VERT_DIR ? 1 : (zSign ? 3 : 2)); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2009 |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2010 if (xySym) |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2011 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2012 if (math::isinf (fy)) |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2013 render_ticktexts (zticks, zticklabels, z_min, z_max, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2014 xPlaneN + math::signum (xPlaneN-xPlane)*fx*ztickoffset, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2015 yPlane, 2, halign, valign, wmax, hmax); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2016 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2017 render_ticktexts (zticks, zticklabels, z_min, z_max, xPlaneN, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2018 yPlane + math::signum (yPlane-yPlaneN)*fy*ztickoffset, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2019 2, halign, valign, wmax, hmax); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2020 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2021 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2022 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2023 if (math::isinf (fx)) |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2024 render_ticktexts (zticks, zticklabels, z_min, z_max, xPlane, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2025 yPlaneN + math::signum (yPlaneN-yPlane)*fy*ztickoffset, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2026 2, halign, valign, wmax, hmax); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2027 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2028 render_ticktexts (zticks, zticklabels, z_min, z_max, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2029 xPlane + math::signum (xPlane-xPlaneN)*fx*ztickoffset, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2030 yPlaneN, 2, halign, valign, wmax, hmax); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2031 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2032 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2033 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2034 gh_manager::get_object (props.get_zlabel ()).set ("visible", "on"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2035 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2036 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2037 gh_manager::get_object (props.get_zlabel ()).set ("visible", "off"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2038 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2039 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2040 void |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2041 opengl_renderer::draw_axes_grids (const axes::properties& props) |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2042 { |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2043 #if defined (HAVE_OPENGL) |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2044 // Disable line smoothing for axes |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2045 GLboolean antialias; |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2046 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2047 m_glfcns.glGetBooleanv (GL_LINE_SMOOTH, &antialias); |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2048 |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2049 if (antialias == GL_TRUE) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2050 m_glfcns.glDisable (GL_LINE_SMOOTH); |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2051 |
24807
8585b3f9c28c
Use "butt" linecap to workaround split lines in printout (bug #53229).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24725
diff
changeset
|
2052 set_linecap ("butt"); |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2053 set_linewidth (props.get_linewidth ()); |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2054 set_font (props); |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2055 set_interpreter (props.get_ticklabelinterpreter ()); |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2056 |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2057 draw_axes_x_grid (props); |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2058 draw_axes_y_grid (props); |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2059 draw_axes_z_grid (props); |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2060 |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2061 if (antialias == GL_TRUE) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2062 m_glfcns.glEnable (GL_LINE_SMOOTH); |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2063 #else |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2064 |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2065 octave_unused_parameter (props); |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2066 |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2067 // This shouldn't happen because construction of opengl_renderer |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2068 // objects is supposed to be impossible if OpenGL is not available. |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2069 |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2070 panic_impossible (); |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2071 |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2072 #endif |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2073 } |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2074 |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2075 void |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
2076 opengl_renderer::draw_all_lights (const base_properties& props, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
2077 std::list<graphics_object>& obj_list) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2078 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2079 #if defined (HAVE_OPENGL) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2080 Matrix children = props.get_all_children (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2081 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2082 for (octave_idx_type i = children.numel () - 1; i >= 0; i--) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2083 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2084 graphics_object go = gh_manager::get_object (children(i)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2085 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2086 base_properties p = go.get_properties (); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2087 |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2088 if (p.is_visible () |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2089 || (selecting && p.pickableparts_is ("all"))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2090 { |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2091 if (go.isa ("light") && ! selecting) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2092 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2093 if (m_current_light-GL_LIGHT0 < m_max_lights) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2094 { |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2095 set_clipping (p.is_clipping ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2096 draw (go); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2097 m_current_light++; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2098 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2099 } |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2100 else if (go.isa ("hggroup") |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2101 && ! (selecting && p.pickableparts_is ("none"))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2102 draw_all_lights (go.get_properties (), obj_list); |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2103 else if (! (selecting && p.pickableparts_is ("none"))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2104 obj_list.push_back (go); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2105 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2106 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2107 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2108 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2109 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2110 octave_unused_parameter (obj_list); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2111 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2112 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2113 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2114 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2115 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2116 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2117 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2118 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2119 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2120 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2121 opengl_renderer::draw_axes_children (const axes::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2122 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2123 #if defined (HAVE_OPENGL) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2124 // list for non-light child objects |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2125 std::list<graphics_object> obj_list; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2126 std::list<graphics_object>::iterator it; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2127 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2128 // 1st pass: draw light objects |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2129 |
22349
2aac9ec7df29
Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22348
diff
changeset
|
2130 // FIXME: max_lights only needs to be set once. |
2aac9ec7df29
Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22348
diff
changeset
|
2131 // It would be better if this could be in the constructor for gl_renderer |
2aac9ec7df29
Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22348
diff
changeset
|
2132 // but this seems to lead to calls of OpenGL functions before the context |
2aac9ec7df29
Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22348
diff
changeset
|
2133 // is actually initialized. See bug #48669. |
2aac9ec7df29
Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22348
diff
changeset
|
2134 // Check actual maximum number of lights possible |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2135 init_maxlights (); |
22349
2aac9ec7df29
Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22348
diff
changeset
|
2136 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2137 // Start with the last element of the array of child objects to |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2138 // display them in the order they were added to the array. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2139 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2140 if (props.get_num_lights () > m_max_lights) |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2141 warning_with_id ("Octave:max-lights-exceeded", |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2142 "light: Maximum number of lights (%d) in these axes is " |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2143 "exceeded.", m_max_lights); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2144 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2145 m_current_light = GL_LIGHT0; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2146 draw_all_lights (props, obj_list); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2147 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2148 // disable other OpenGL lights |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2149 for (unsigned int i = props.get_num_lights (); i < m_max_lights; i++) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2150 m_glfcns.glDisable (GL_LIGHT0 + i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2151 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2152 // save camera position and set ambient light color before drawing |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2153 // other objects |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2154 view_vector = props.get_cameraposition ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2155 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2156 float cb[4] = { 1.0, 1.0, 1.0, 1.0 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2157 ColumnVector ambient_color = props.get_ambientlightcolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2158 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2159 cb[i] = ambient_color(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2160 m_glfcns.glLightfv (GL_LIGHT0, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2161 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2162 // 2nd pass: draw other objects (with units set to "data") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2163 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2164 it = obj_list.begin (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2165 while (it != obj_list.end ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2166 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2167 graphics_object go = (*it); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2168 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2169 // FIXME: check whether object has "units" property and it is set |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2170 // to "data" |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2171 if (! go.isa ("text") || go.get ("units").string_value () == "data") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2172 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2173 set_clipping (go.get_properties ().is_clipping ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2174 draw (go); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2175 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2176 it = obj_list.erase (it); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2177 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2178 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2179 it++; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2180 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2181 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2182 // 3rd pass: draw remaining objects |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2183 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2184 m_glfcns.glDisable (GL_DEPTH_TEST); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2185 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2186 for (it = obj_list.begin (); it != obj_list.end (); it++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2187 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2188 graphics_object go = (*it); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2189 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2190 set_clipping (go.get_properties ().is_clipping ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2191 draw (go); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2192 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2193 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2194 set_clipping (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2195 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2196 // FIXME: finalize rendering (transparency processing) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2197 // FIXME: draw zoom box, if needed |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2198 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2199 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2200 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2201 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2202 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2203 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2204 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2205 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2206 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2207 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2208 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2209 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2210 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2211 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2212 opengl_renderer::draw_axes (const axes::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2213 { |
22258
553490ffc203
Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22192
diff
changeset
|
2214 #if defined (HAVE_OPENGL) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2215 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2216 // Legends are not drawn when "visible" is "off". |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2217 if (! props.is_visible () && props.get_tag () == "legend") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2218 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2219 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2220 // Don't draw the axes and its children if we are in selection and |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2221 // pickable parts is "none". |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2222 if (selecting && props.pickableparts_is ("none")) |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2223 return; |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2224 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2225 static double floatmax = std::numeric_limits<float>::max (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2226 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2227 double x_min = props.get_x_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2228 double x_max = props.get_x_max (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2229 double y_min = props.get_y_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2230 double y_max = props.get_y_max (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2231 double z_min = props.get_z_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2232 double z_max = props.get_z_max (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2233 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2234 if (x_max > floatmax || y_max > floatmax || z_max > floatmax |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2235 || x_min < -floatmax || y_min < -floatmax || z_min < -floatmax) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2236 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2237 warning ("opengl_renderer: data values greater than float capacity. (1) Scale data, or (2) Use gnuplot"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2238 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2239 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2240 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2241 setup_opengl_transformation (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2242 |
23863
56b7352fa456
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23859
diff
changeset
|
2243 // For 2D axes with only 2D primitives, draw from back to front without |
23859
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23807
diff
changeset
|
2244 // depth sorting |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23807
diff
changeset
|
2245 bool is2D = props.get_is2D (true); |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2246 if (is2D) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2247 m_glfcns.glDisable (GL_DEPTH_TEST); |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2248 else |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2249 m_glfcns.glEnable (GL_DEPTH_TEST); |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2250 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2251 draw_axes_planes (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2252 |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2253 if (! is2D || props.layer_is ("bottom")) |
24178
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2254 { |
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2255 draw_axes_grids (props); |
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2256 if (props.get_tag () != "legend" || props.get_box () != "off") |
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2257 draw_axes_boxes (props); |
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2258 } |
22357
8f23b5b23235
Avoid grid overlaying axes box (bug #48842)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22349
diff
changeset
|
2259 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2260 set_clipbox (x_min, x_max, y_min, y_max, z_min, z_max); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2261 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2262 draw_axes_children (props); |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2263 |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2264 if (is2D && props.layer_is ("top")) |
24178
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2265 { |
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2266 draw_axes_grids (props); |
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2267 if (props.get_tag () != "legend" || props.get_box () != "off") |
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2268 draw_axes_boxes (props); |
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2269 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2270 |
22258
553490ffc203
Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22192
diff
changeset
|
2271 #else |
553490ffc203
Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22192
diff
changeset
|
2272 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2273 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2274 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2275 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2276 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2277 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2278 panic_impossible (); |
22258
553490ffc203
Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22192
diff
changeset
|
2279 |
553490ffc203
Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22192
diff
changeset
|
2280 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2281 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2282 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2283 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2284 opengl_renderer::draw_line (const line::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2285 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2286 #if defined (HAVE_OPENGL) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2287 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2288 bool draw_all = selecting && props.pickableparts_is ("all"); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2289 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2290 Matrix x = xform.xscale (props.get_xdata ().matrix_value ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2291 Matrix y = xform.yscale (props.get_ydata ().matrix_value ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2292 Matrix z = xform.zscale (props.get_zdata ().matrix_value ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2293 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2294 bool has_z = (z.numel () > 0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2295 int n = static_cast<int> (std::min (std::min (x.numel (), y.numel ()), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2296 (has_z ? z.numel () |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2297 : std::numeric_limits<int>::max ()))); |
25896
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
2298 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40); |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
2299 uint8_t clip_ok = 0x40; |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
2300 |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
2301 std::vector<uint8_t> clip (n); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2302 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2303 if (has_z) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2304 for (int i = 0; i < n; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2305 clip[i] = (clip_code (x(i), y(i), z(i)) & clip_mask); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2306 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2307 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2308 double z_mid = (zmin+zmax)/2; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2309 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2310 for (int i = 0; i < n; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2311 clip[i] = (clip_code (x(i), y(i), z_mid) & clip_mask); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2312 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2313 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2314 if (! props.linestyle_is ("none") && ! props.color_is ("none")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2315 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2316 set_color (props.get_color_rgb ()); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2317 set_linestyle (props.get_linestyle (), false, props.get_linewidth ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2318 set_linewidth (props.get_linewidth ()); |
22838
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
2319 set_linecap ("butt"); |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
2320 set_linejoin (props.get_linejoin ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2321 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2322 if (has_z) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2323 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2324 bool flag = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2325 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2326 for (int i = 1; i < n; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2327 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2328 if ((clip[i-1] & clip[i]) == clip_ok) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2329 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2330 if (! flag) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2331 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2332 flag = true; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2333 m_glfcns.glBegin (GL_LINE_STRIP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2334 m_glfcns.glVertex3d (x(i-1), y(i-1), z(i-1)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2335 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2336 m_glfcns.glVertex3d (x(i), y(i), z(i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2337 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2338 else if (flag) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2339 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2340 flag = false; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2341 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2342 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2343 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2344 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2345 if (flag) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2346 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2347 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2348 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2349 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2350 bool flag = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2351 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2352 for (int i = 1; i < n; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2353 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2354 if ((clip[i-1] & clip[i]) == clip_ok) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2355 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2356 if (! flag) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2357 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2358 flag = true; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2359 m_glfcns.glBegin (GL_LINE_STRIP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2360 m_glfcns.glVertex2d (x(i-1), y(i-1)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2361 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2362 m_glfcns.glVertex2d (x(i), y(i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2363 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2364 else if (flag) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2365 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2366 flag = false; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2367 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2368 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2369 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2370 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2371 if (flag) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2372 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2373 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2374 |
22358
dc73bbd66363
Make sure all lines associated with axes respect axes linewidth property.
Rik <rik@octave.org>
parents:
22357
diff
changeset
|
2375 set_linewidth (0.5f); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2376 set_linestyle ("-"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2377 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2378 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2379 set_clipping (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2380 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2381 if (! props.marker_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2382 && ! (props.markeredgecolor_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2383 && props.markerfacecolor_is ("none"))) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2384 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2385 Matrix lc, fc; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2386 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2387 if (draw_all) |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2388 lc = Matrix (1, 3, 0.0); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2389 else if (props.markeredgecolor_is ("auto")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2390 lc = props.get_color_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2391 else if (! props.markeredgecolor_is ("none")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2392 lc = props.get_markeredgecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2393 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2394 if (draw_all) |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2395 fc = Matrix (1, 3, 0.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2396 if (props.markerfacecolor_is ("auto")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2397 fc = props.get_color_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2398 else if (! props.markerfacecolor_is ("none")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2399 fc = props.get_markerfacecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2400 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2401 init_marker (props.get_marker (), props.get_markersize (), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2402 props.get_linewidth ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2403 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2404 for (int i = 0; i < n; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2405 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2406 if (clip[i] == clip_ok) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2407 draw_marker (x(i), y(i), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2408 has_z ? z(i) : 0.0, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2409 lc, fc); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2410 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2411 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2412 end_marker (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2413 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2414 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2415 set_clipping (props.is_clipping ()); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2416 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2417 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2418 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2419 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2420 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2421 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2422 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2423 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2424 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2425 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2426 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2427 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2428 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2429 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2430 opengl_renderer::draw_surface (const surface::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2431 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2432 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2433 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2434 bool draw_all = selecting && props.pickableparts_is ("all"); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2435 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2436 const Matrix x = xform.xscale (props.get_xdata ().matrix_value ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2437 const Matrix y = xform.yscale (props.get_ydata ().matrix_value ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2438 const Matrix z = xform.zscale (props.get_zdata ().matrix_value ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2439 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2440 int zr = z.rows (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2441 int zc = z.columns (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2442 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2443 NDArray c; |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2444 const NDArray vn = props.get_vertexnormals ().array_value (); |
25871
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2445 dim_vector vn_dims = vn.dims (); |
26465
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2446 bool has_vertex_normals = ((vn_dims(0) == zr) && |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2447 (vn_dims(1) == zc) && |
25871
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2448 (vn_dims(2) == 3)); |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2449 const NDArray fn = props.get_facenormals ().array_value (); |
25871
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2450 dim_vector fn_dims = fn.dims (); |
26465
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2451 bool has_face_normals = ((fn_dims(0) == zr - 1) && |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2452 (fn_dims(1) == zc - 1) && |
25871
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2453 (fn_dims(2) == 3)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2454 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2455 // FIXME: handle transparency |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2456 Matrix a; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2457 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2458 int fc_mode = (props.facecolor_is_rgb () ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2459 (props.facecolor_is ("flat") ? 1 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2460 (props.facecolor_is ("interp") ? 2 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2461 (props.facecolor_is ("texturemap") ? 3 : -1)))); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2462 int fl_mode = (props.facelighting_is ("none") ? 0 : |
25871
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2463 (props.facelighting_is ("flat") ? |
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2464 (has_face_normals ? 1 : 0) : |
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2465 (has_vertex_normals ? 2 : 0))); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2466 int fa_mode = (props.facealpha_is_double () ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2467 (props.facealpha_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2468 int ec_mode = (props.edgecolor_is_rgb () ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2469 (props.edgecolor_is ("flat") ? 1 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2470 (props.edgecolor_is ("interp") ? 2 : -1))); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2471 int el_mode = (props.edgelighting_is ("none") ? 0 : |
25871
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2472 (props.edgelighting_is ("flat") ? |
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2473 (has_face_normals ? 1 : 0) : |
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2474 (has_vertex_normals ? 2 : 0))); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2475 int ea_mode = (props.edgealpha_is_double () ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2476 (props.edgealpha_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2477 int bfl_mode = (props.backfacelighting_is ("lit") ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2478 (props.backfacelighting_is ("reverselit") ? 1 : 2)); |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2479 bool do_lighting = props.get_do_lighting (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2480 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2481 Matrix fcolor = (fc_mode == TEXTURE ? Matrix (1, 3, 1.0) |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
2482 : props.get_facecolor_rgb ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2483 Matrix ecolor = props.get_edgecolor_rgb (); |
24154
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
2484 double fa = 1.0; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2485 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2486 float as = props.get_ambientstrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2487 float ds = props.get_diffusestrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2488 float ss = props.get_specularstrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2489 float se = props.get_specularexponent () * 5; // to fit Matlab |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2490 float scr = props.get_specularcolorreflectance (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2491 float cb[4] = { 0.0, 0.0, 0.0, 1.0 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2492 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2493 opengl_texture tex (m_glfcns); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2494 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2495 int i1, i2, j1, j2; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2496 bool x_mat = (x.rows () == z.rows ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2497 bool y_mat = (y.columns () == z.columns ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2498 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2499 i1 = i2 = j1 = j2 = 0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2500 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2501 if ((fc_mode > 0 && fc_mode < 3) || ec_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2502 c = props.get_color_data ().array_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2503 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2504 boolMatrix clip (z.dims (), false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2505 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2506 for (int i = 0; i < zr; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2507 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2508 if (x_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2509 i1 = i; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2510 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2511 for (int j = 0; j < zc; j++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2512 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2513 if (y_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2514 j1 = j; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2515 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2516 clip(i,j) = is_nan_or_inf (x(i1,j), y(i,j1), z(i,j)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2517 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2518 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2519 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2520 if (fa_mode > 0 || ea_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2521 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2522 // FIXME: implement alphadata conversion |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2523 //a = props.get_alpha_data (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2524 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2525 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2526 if (fl_mode > 0 || el_mode > 0) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2527 m_glfcns.glMaterialf (LIGHT_MODE, GL_SHININESS, se); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2528 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2529 // FIXME: good candidate for caching, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2530 // transferring pixel data to OpenGL is time consuming. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2531 if (fc_mode == TEXTURE) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2532 tex = opengl_texture::create (m_glfcns, props.get_color_data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2533 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2534 if (draw_all || ! props.facecolor_is ("none")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2535 { |
24154
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
2536 if (fa_mode == 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2537 { |
24154
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
2538 fa = props.get_facealpha_double (); |
26468
bdf03ab385c2
Use facealpha for surface objects with uniform facecolor and lighting (bug #55384).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26465
diff
changeset
|
2539 cb[3] = fa; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2540 if (fc_mode == UNIFORM || fc_mode == TEXTURE) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2541 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2542 m_glfcns.glColor4d (fcolor(0), fcolor(1), fcolor(2), fa); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2543 if (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2544 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2545 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2546 cb[i] = as * fcolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2547 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2548 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2549 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2550 cb[i] = ds * fcolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2551 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2552 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2553 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2554 cb[i] = ss * (scr + (1-scr) * fcolor(i)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2555 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2556 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2557 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2558 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2559 if ((fl_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2560 m_glfcns.glEnable (GL_LIGHTING); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2561 m_glfcns.glShadeModel ((fc_mode == INTERP || fl_mode == GOURAUD) |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
2562 ? GL_SMOOTH : GL_FLAT); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
2563 set_polygon_offset (true, 1.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2564 if (fc_mode == TEXTURE) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2565 m_glfcns.glEnable (GL_TEXTURE_2D); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2566 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2567 for (int i = 1; i < zc; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2568 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2569 if (y_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2570 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2571 i1 = i-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2572 i2 = i; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2573 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2574 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2575 for (int j = 1; j < zr; j++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2576 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2577 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2578 if (clip(j-1, i-1) || clip(j, i-1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2579 || clip(j-1, i) || clip(j, i)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2580 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2581 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2582 if (fc_mode == FLAT) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2583 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2584 // "flat" only needs color at lower-left vertex |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2585 if (! math::isfinite (c(j-1,i-1))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2586 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2587 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2588 else if (fc_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2589 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2590 // "interp" needs valid color at all 4 vertices |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2591 if (! (math::isfinite (c(j-1, i-1)) && math::isfinite (c(j, i-1)) |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2592 && math::isfinite (c(j-1, i)) && math::isfinite (c(j, i)))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2593 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2594 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2595 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2596 if (x_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2597 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2598 j1 = j-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2599 j2 = j; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2600 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2601 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2602 m_glfcns.glBegin (GL_QUADS); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2603 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2604 // Vertex 1 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2605 if (fc_mode == TEXTURE) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2606 tex.tex_coord (double (i-1) / (zc-1), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2607 double (j-1) / (zr-1)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2608 else if (fc_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2609 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2610 // FIXME: is there a smarter way to do this? |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2611 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2612 cb[k] = c(j-1, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2613 m_glfcns.glColor4fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2614 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2615 if (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2616 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2617 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2618 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2619 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2620 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2621 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2622 cb[k] = ds * c(j-1, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2623 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2624 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2625 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2626 cb[k] = ss * (scr + (1-scr) * c(j-1, i-1, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2627 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2628 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2629 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2630 if (fl_mode > 0) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2631 set_normal (bfl_mode, (fl_mode == GOURAUD ? vn : fn), |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2632 j-1, i-1); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2633 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2634 m_glfcns.glVertex3d (x(j1,i-1), y(j-1,i1), z(j-1,i-1)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2635 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2636 // Vertex 2 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2637 if (fc_mode == TEXTURE) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2638 tex.tex_coord (double (i) / (zc-1), double (j-1) / (zr-1)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2639 else if (fc_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2640 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2641 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2642 cb[k] = c(j-1, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2643 m_glfcns.glColor4fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2644 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2645 if (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2646 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2647 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2648 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2649 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2650 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2651 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2652 cb[k] = ds * c(j-1, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2653 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2654 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2655 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2656 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2657 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2658 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2659 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2660 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2661 if (fl_mode == GOURAUD) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2662 set_normal (bfl_mode, vn, j-1, i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2663 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2664 m_glfcns.glVertex3d (x(j1,i), y(j-1,i2), z(j-1,i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2665 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2666 // Vertex 3 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2667 if (fc_mode == TEXTURE) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2668 tex.tex_coord (double (i) / (zc-1), double (j) / (zr-1)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2669 else if (fc_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2670 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2671 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2672 cb[k] = c(j, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2673 m_glfcns.glColor4fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2674 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2675 if (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2676 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2677 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2678 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2679 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2680 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2681 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2682 cb[k] = ds * c(j, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2683 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2684 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2685 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2686 cb[k] = ss * (scr + (1-scr) * c(j, i, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2687 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2688 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2689 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2690 if (fl_mode == GOURAUD) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2691 set_normal (bfl_mode, vn, j, i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2692 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2693 m_glfcns.glVertex3d (x(j2,i), y(j,i2), z(j,i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2694 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2695 // Vertex 4 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2696 if (fc_mode == TEXTURE) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2697 tex.tex_coord (double (i-1) / (zc-1), double (j) / (zr-1)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2698 else if (fc_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2699 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2700 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2701 cb[k] = c(j, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2702 m_glfcns.glColor4fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2703 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2704 if (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2705 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2706 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2707 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2708 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2709 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2710 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2711 cb[k] = ds * c(j, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2712 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2713 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2714 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2715 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2716 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2717 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2718 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2719 if (fl_mode == GOURAUD) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2720 set_normal (bfl_mode, vn, j, i-1); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2721 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2722 m_glfcns.glVertex3d (x(j2,i-1), y(j,i1), z(j,i-1)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2723 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2724 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2725 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2726 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2727 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2728 set_polygon_offset (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2729 if (fc_mode == TEXTURE) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2730 m_glfcns.glDisable (GL_TEXTURE_2D); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2731 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2732 if ((fl_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2733 m_glfcns.glDisable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2734 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2735 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2736 { |
24154
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
2737 // FIXME: implement flat, interp and texturemap transparency |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2738 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2739 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2740 |
22391
c5da5e5e9846
Fix inconsistent on-screen/printout patch and surface edges (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22369
diff
changeset
|
2741 if (! props.edgecolor_is ("none") && ! props.linestyle_is ("none")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2742 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2743 if (props.get_edgealpha_double () == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2744 { |
26468
bdf03ab385c2
Use facealpha for surface objects with uniform facecolor and lighting (bug #55384).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26465
diff
changeset
|
2745 cb[3] = 1.0; // edgealpha isn't implemented yet |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2746 if (ec_mode == UNIFORM) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2747 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2748 m_glfcns.glColor3dv (ecolor.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2749 if (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2750 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2751 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2752 cb[i] = as * ecolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2753 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2754 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2755 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2756 cb[i] = ds * ecolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2757 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2758 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2759 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2760 cb[i] = ss * (scr + (1-scr) * ecolor(i)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2761 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2762 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2763 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2764 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2765 if ((el_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2766 m_glfcns.glEnable (GL_LIGHTING); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2767 m_glfcns.glShadeModel ((ec_mode == INTERP || el_mode == GOURAUD) |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
2768 ? GL_SMOOTH : GL_FLAT); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2769 |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2770 set_linestyle (props.get_linestyle (), false, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2771 props.get_linewidth ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2772 set_linewidth (props.get_linewidth ()); |
22838
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
2773 set_linecap ("butt"); |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
2774 set_linejoin ("miter"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2775 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2776 // Mesh along Y-axis |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2777 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2778 if (props.meshstyle_is ("both") || props.meshstyle_is ("column")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2779 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2780 for (int i = 0; i < zc; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2781 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2782 if (y_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2783 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2784 i1 = i-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2785 i2 = i; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2786 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2787 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2788 for (int j = 1; j < zr; j++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2789 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2790 if (clip(j-1,i) || clip(j,i)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2791 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2792 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2793 if (ec_mode == FLAT) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2794 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2795 // "flat" only needs color at lower-left vertex |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2796 if (! math::isfinite (c(j-1,i))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2797 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2798 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2799 else if (ec_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2800 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2801 // "interp" needs valid color at both vertices |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2802 if (! (math::isfinite (c(j-1, i)) && math::isfinite (c(j, i)))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2803 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2804 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2805 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2806 if (x_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2807 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2808 j1 = j-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2809 j2 = j; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2810 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2811 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2812 m_glfcns.glBegin (GL_LINES); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2813 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2814 // Vertex 1 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2815 if (ec_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2816 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2817 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2818 cb[k] = c(j-1, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2819 m_glfcns.glColor3fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2820 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2821 if (el_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2822 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2823 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2824 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2825 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2826 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2827 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2828 cb[k] = ds * c(j-1, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2829 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2830 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2831 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2832 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2833 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2834 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2835 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2836 if (el_mode > 0) |
26465
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2837 { |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2838 if (el_mode == GOURAUD) |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2839 set_normal (bfl_mode, vn, j-1, i); |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2840 else |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2841 set_normal (bfl_mode, fn, j-1, std::min (i, zc-2)); |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2842 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2843 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2844 m_glfcns.glVertex3d (x(j1,i), y(j-1,i2), z(j-1,i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2845 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2846 // Vertex 2 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2847 if (ec_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2848 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2849 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2850 cb[k] = c(j, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2851 m_glfcns.glColor3fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2852 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2853 if (el_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2854 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2855 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2856 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2857 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2858 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2859 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2860 cb[k] = ds * c(j, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2861 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2862 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2863 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2864 cb[k] = ss * (scr + (1-scr) * c(j, i, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2865 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2866 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2867 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2868 if (el_mode == GOURAUD) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2869 set_normal (bfl_mode, vn, j, i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2870 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2871 m_glfcns.glVertex3d (x(j2,i), y(j,i2), z(j,i)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2872 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2873 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2874 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2875 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2876 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2877 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2878 // Mesh along X-axis |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2879 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2880 if (props.meshstyle_is ("both") || props.meshstyle_is ("row")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2881 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2882 for (int j = 0; j < zr; j++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2883 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2884 if (x_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2885 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2886 j1 = j-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2887 j2 = j; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2888 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2889 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2890 for (int i = 1; i < zc; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2891 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2892 if (clip(j,i-1) || clip(j,i)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2893 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2894 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2895 if (ec_mode == FLAT) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2896 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2897 // "flat" only needs color at lower-left vertex |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2898 if (! math::isfinite (c(j,i-1))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2899 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2900 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2901 else if (ec_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2902 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2903 // "interp" needs valid color at both vertices |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2904 if (! (math::isfinite (c(j, i-1)) && math::isfinite (c(j, i)))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2905 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2906 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2907 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2908 if (y_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2909 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2910 i1 = i-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2911 i2 = i; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2912 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2913 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2914 m_glfcns.glBegin (GL_LINES); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2915 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2916 // Vertex 1 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2917 if (ec_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2918 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2919 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2920 cb[k] = c(j, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2921 m_glfcns.glColor3fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2922 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2923 if (el_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2924 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2925 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2926 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2927 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2928 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2929 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2930 cb[k] = ds * c(j, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2931 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2932 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2933 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2934 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2935 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2936 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2937 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2938 if (el_mode > 0) |
26465
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2939 { |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2940 if (el_mode == GOURAUD) |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2941 set_normal (bfl_mode, vn, j, i-1); |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2942 else |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2943 set_normal (bfl_mode, fn, std::min (j, zr-2), i-1); |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2944 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2945 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2946 m_glfcns.glVertex3d (x(j2,i-1), y(j,i1), z(j,i-1)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2947 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2948 // Vertex 2 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2949 if (ec_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2950 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2951 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2952 cb[k] = c(j, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2953 m_glfcns.glColor3fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2954 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2955 if (el_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2956 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2957 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2958 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2959 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2960 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2961 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2962 cb[k] = ds * c(j, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2963 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2964 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2965 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2966 cb[k] = ss * (scr + (1-scr) * c(j, i, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2967 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2968 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2969 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2970 if (el_mode == GOURAUD) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2971 set_normal (bfl_mode, vn, j, i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2972 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2973 m_glfcns.glVertex3d (x(j2,i), y(j,i2), z(j,i)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2974 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2975 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2976 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2977 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2978 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2979 |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2980 set_linestyle ("-"); // Disable LineStipple |
22358
dc73bbd66363
Make sure all lines associated with axes respect axes linewidth property.
Rik <rik@octave.org>
parents:
22357
diff
changeset
|
2981 set_linewidth (0.5f); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2982 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2983 if ((el_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2984 m_glfcns.glDisable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2985 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2986 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2987 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2988 // FIXME: implement transparency |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2989 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2990 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2991 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2992 if (! props.marker_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2993 && ! (props.markeredgecolor_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2994 && props.markerfacecolor_is ("none"))) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2995 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2996 // FIXME: check how transparency should be handled in markers |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2997 // FIXME: check what to do with marker facecolor set to auto |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2998 // and facecolor set to none. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2999 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3000 bool do_edge = draw_all || ! props.markeredgecolor_is ("none"); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3001 bool do_face = draw_all || ! props.markerfacecolor_is ("none"); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3002 |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3003 Matrix mecolor = (draw_all ? Matrix (1, 3, 0.0) : |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3004 props.get_markeredgecolor_rgb ()); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3005 Matrix mfcolor = (draw_all ? Matrix (1, 3, 0.0) : |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3006 props.get_markerfacecolor_rgb ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3007 Matrix cc (1, 3, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3008 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3009 if (mecolor.isempty () && props.markeredgecolor_is ("auto")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3010 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3011 mecolor = props.get_edgecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3012 do_edge = ! props.edgecolor_is ("none"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3013 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3014 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3015 if (mfcolor.isempty () && props.markerfacecolor_is ("auto")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3016 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3017 mfcolor = props.get_facecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3018 do_face = ! props.facecolor_is ("none"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3019 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3020 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3021 if ((mecolor.isempty () || mfcolor.isempty ()) && c.isempty ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3022 c = props.get_color_data ().array_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3023 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3024 init_marker (props.get_marker (), props.get_markersize (), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3025 props.get_linewidth ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3026 |
25896
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3027 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40); |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3028 uint8_t clip_ok = 0x40; |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3029 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3030 for (int i = 0; i < zc; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3031 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3032 if (y_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3033 i1 = i; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3034 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3035 for (int j = 0; j < zr; j++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3036 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3037 if (x_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3038 j1 = j; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3039 |
25896
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3040 if ((clip_code (x(j1,i), y(j,i1), z(j,i)) & clip_mask) |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3041 != clip_ok) |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3042 continue; |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3043 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3044 if ((do_edge && mecolor.isempty ()) |
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3045 || (do_face && mfcolor.isempty ())) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3046 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
3047 if (! math::isfinite (c(j,i))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3048 continue; // Skip NaNs in color data |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3049 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3050 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3051 cc(k) = c(j,i,k); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3052 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3053 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3054 Matrix lc = (do_edge ? (mecolor.isempty () ? cc : mecolor) |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
3055 : Matrix ()); |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3056 Matrix fc = (do_face ? (mfcolor.isempty () ? cc : mfcolor) |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
3057 : Matrix ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3058 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3059 draw_marker (x(j1,i), y(j,i1), z(j,i), lc, fc); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3060 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3061 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3062 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3063 end_marker (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3064 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3065 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3066 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3067 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3068 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3069 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3070 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3071 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3072 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3073 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3074 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3075 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3076 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3077 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3078 // FIXME: global optimization (rendering, data structures...), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3079 // there is probably a smarter/faster/less-memory-consuming way to do this. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3080 void |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23396
diff
changeset
|
3081 opengl_renderer::draw_patch (const patch::properties& props) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3082 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3083 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3084 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3085 // Do not render if the patch has incoherent data |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3086 std::string msg; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3087 if (props.has_bad_data (msg)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3088 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3089 warning ("opengl_renderer: %s. Not rendering.", msg.c_str ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3090 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3091 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3092 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3093 bool draw_all = selecting && props.pickableparts_is ("all"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3094 const Matrix f = props.get_faces ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3095 const Matrix v = xform.scale (props.get_vertices ().matrix_value ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3096 Matrix c; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3097 Matrix a; |
24154
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
3098 double fa = 1.0; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3099 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3100 int nv = v.rows (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3101 int nf = f.rows (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3102 int fcmax = f.columns (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3103 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3104 bool has_z = (v.columns () > 2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3105 bool has_facecolor = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3106 bool has_facealpha = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3107 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3108 int fc_mode = ((props.facecolor_is ("none") |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3109 || props.facecolor_is_rgb () || draw_all) ? 0 : |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3110 (props.facecolor_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3111 int fl_mode = (props.facelighting_is ("none") ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3112 (props.facelighting_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3113 int fa_mode = (props.facealpha_is_double () ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3114 (props.facealpha_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3115 int ec_mode = ((props.edgecolor_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3116 || props.edgecolor_is_rgb ()) ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3117 (props.edgecolor_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3118 int el_mode = (props.edgelighting_is ("none") ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3119 (props.edgelighting_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3120 int ea_mode = (props.edgealpha_is_double () ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3121 (props.edgealpha_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3122 int bfl_mode = (props.backfacelighting_is ("lit") ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3123 (props.backfacelighting_is ("reverselit") ? 1 : 2)); |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
3124 bool do_lighting = props.get_do_lighting (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3125 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3126 Matrix fcolor = props.get_facecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3127 Matrix ecolor = props.get_edgecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3128 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3129 float as = props.get_ambientstrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3130 float ds = props.get_diffusestrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3131 float ss = props.get_specularstrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3132 float se = props.get_specularexponent () * 5; // to fit Matlab |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3133 float scr = props.get_specularcolorreflectance (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3134 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3135 const Matrix vn = props.get_vertexnormals ().matrix_value (); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3136 bool has_vertex_normals = (vn.rows () == nv); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3137 const Matrix fn = props.get_facenormals ().matrix_value (); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3138 bool has_face_normals = (fn.rows () == nf); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3139 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3140 boolMatrix clip (1, nv, false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3141 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3142 if (has_z) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3143 for (int i = 0; i < nv; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3144 clip(i) = is_nan_or_inf (v(i,0), v(i,1), v(i,2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3145 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3146 for (int i = 0; i < nv; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3147 clip(i) = is_nan_or_inf (v(i,0), v(i,1), 0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3148 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3149 boolMatrix clip_f (1, nf, false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3150 Array<int> count_f (dim_vector (nf, 1), 0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3151 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3152 for (int i = 0; i < nf; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3153 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3154 bool fclip = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3155 int count = 0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3156 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
3157 for (int j = 0; j < fcmax && ! math::isnan (f(i,j)); j++, count++) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3158 fclip = (fclip || clip(int (f(i,j) - 1))); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3159 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3160 clip_f(i) = fclip; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3161 count_f(i) = count; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3162 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3163 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3164 if (draw_all || fc_mode > 0 || ec_mode > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3165 { |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3166 if (draw_all) |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3167 c = Matrix (1, 3, 0.0); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3168 else |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3169 c = props.get_color_data ().matrix_value (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3170 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3171 if (c.rows () == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3172 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3173 // Single color specifications, we can simplify a little bit |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3174 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3175 if (draw_all || fc_mode > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3176 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3177 fcolor = c; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3178 fc_mode = UNIFORM; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3179 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3180 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3181 if (draw_all || ec_mode > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3182 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3183 ecolor = c; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3184 ec_mode = UNIFORM; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3185 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3186 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3187 c = Matrix (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3188 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3189 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3190 has_facecolor = ((c.numel () > 0) && (c.rows () == f.rows ())); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3191 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3192 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3193 if (fa_mode > 0 || ea_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3194 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3195 // FIXME: retrieve alpha data from patch object |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3196 //a = props.get_alpha_data (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3197 has_facealpha = ((a.numel () > 0) && (a.rows () == f.rows ())); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3198 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3199 |
24154
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
3200 if (fa_mode == 0) |
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
3201 fa = props.get_facealpha_double (); |
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
3202 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3203 octave_idx_type fr = f.rows (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3204 std::vector<vertex_data> vdata (f.numel ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3205 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3206 for (int i = 0; i < nf; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3207 for (int j = 0; j < count_f(i); j++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3208 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3209 int idx = int (f(i,j) - 1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3210 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3211 Matrix vv (1, 3, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3212 Matrix cc; |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3213 Matrix vnn (1, 3, 0.0); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3214 Matrix fnn (1, 3, 0.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3215 double aa = 1.0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3216 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3217 vv(0) = v(idx,0); vv(1) = v(idx,1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3218 if (has_z) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3219 vv(2) = v(idx,2); |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3220 if (((fl_mode == FLAT) || (el_mode == FLAT)) && has_face_normals) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3221 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3222 double dir = 1.0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3223 if (bfl_mode > 0) |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3224 dir = ((fn(i,0) * view_vector(0) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3225 + fn(i,1) * view_vector(1) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3226 + fn(i,2) * view_vector(2) < 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3227 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0); |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3228 fnn(0) = dir * fn(i,0); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3229 fnn(1) = dir * fn(i,1); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3230 fnn(2) = dir * fn(i,2); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3231 } |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3232 if (((fl_mode == GOURAUD) || (el_mode == GOURAUD)) && |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3233 has_vertex_normals) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3234 { |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3235 double dir = 1.0; |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3236 if (bfl_mode > 0) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3237 dir = ((vn(idx,0) * view_vector(0) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3238 + vn(idx,1) * view_vector(1) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3239 + vn(idx,2) * view_vector(2) < 0) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3240 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3241 vnn(0) = dir * vn(idx,0); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3242 vnn(1) = dir * vn(idx,1); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3243 vnn(2) = dir * vn(idx,2); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3244 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3245 if (c.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3246 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3247 cc.resize (1, 3); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3248 if (has_facecolor) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3249 cc(0) = c(i,0), cc(1) = c(i,1), cc(2) = c(i,2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3250 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3251 cc(0) = c(idx,0), cc(1) = c(idx,1), cc(2) = c(idx,2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3252 } |
24154
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
3253 if (fa_mode == 0) |
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
3254 aa = fa; |
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
3255 else if (a.numel () > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3256 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3257 if (has_facealpha) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3258 aa = a(i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3259 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3260 aa = a(idx); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3261 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3262 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3263 vdata[i+j*fr] = vertex_data (vv, cc, vnn, fnn, aa, as, ds, ss, se, scr); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3264 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3265 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3266 if (fl_mode > 0 || el_mode > 0) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3267 m_glfcns.glMaterialf (LIGHT_MODE, GL_SHININESS, se); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3268 |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3269 std::list<std::list<octave_idx_type>>::const_iterator it1; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3270 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3271 if (draw_all || ! props.facecolor_is ("none")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3272 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3273 // FIXME: adapt to double-radio property |
24154
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
3274 if (fa_mode == 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3275 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3276 if (fc_mode == UNIFORM) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3277 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3278 m_glfcns.glColor4d (fcolor(0), fcolor(1), fcolor(2), fa); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3279 if (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3280 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3281 float cb[4] = { 0, 0, 0, 1 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3282 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3283 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3284 cb[i] = as * fcolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3285 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3286 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3287 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3288 cb[i] = ds * fcolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3289 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3290 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3291 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3292 cb[i] = ss * (scr + (1-scr) * fcolor(i)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3293 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3294 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3295 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3296 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3297 if ((fl_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3298 m_glfcns.glEnable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3299 |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3300 // NOTE: Push filled part of patch backwards to avoid Z-fighting |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3301 // with tesselator outline. A value of 1.0 seems to work fine. |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3302 // Value can't be too large or the patch will be pushed below the |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3303 // axes planes at +2.5. |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3304 patch_tesselator tess (this, fc_mode, fl_mode, 1.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3305 |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3306 it1 = props.coplanar_last_idx.begin (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3307 std::list<octave_idx_type>::const_iterator it2; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3308 octave_idx_type i_start, i_end; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3309 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3310 for (int i = 0; i < nf; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3311 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3312 if (clip_f(i)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3313 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3314 |
25419
7361fd8aed86
Fix segmentation fault with last change (bug #47677).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3315 bool is_non_planar = false; |
7361fd8aed86
Fix segmentation fault with last change (bug #47677).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3316 if (props.coplanar_last_idx.size () > 0 && (*it1).size () > 1) |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3317 { |
25419
7361fd8aed86
Fix segmentation fault with last change (bug #47677).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3318 is_non_planar = true; |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3319 it2 = (*it1).end (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3320 it2--; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3321 } |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3322 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3323 // loop over planar subsets of face |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3324 do |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3325 { |
25419
7361fd8aed86
Fix segmentation fault with last change (bug #47677).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3326 if (is_non_planar) |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3327 { |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3328 i_end = *it2; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3329 if (it2 == (*it1).begin ()) |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3330 i_start = 0; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3331 else |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3332 { |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3333 it2--; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3334 i_start = *it2 - 1; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3335 } |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3336 } |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3337 else |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3338 { |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3339 i_end = count_f(i) - 1; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3340 i_start = 0; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3341 } |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3342 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3343 tess.begin_polygon (true); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3344 tess.begin_contour (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3345 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3346 // Add vertices in reverse order for Matlab compatibility |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3347 for (int j = i_end; j > i_start; j--) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3348 { |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3349 vertex_data::vertex_data_rep *vv = |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3350 vdata[i+j*fr].get_rep (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3351 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3352 tess.add_vertex (vv->coords.fortran_vec (), vv); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3353 } |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3354 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3355 if (count_f(i) > 0) |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3356 { |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3357 vertex_data::vertex_data_rep *vv = vdata[i].get_rep (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3358 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3359 if (fc_mode == FLAT) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3360 { |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3361 // For "flat" shading, use color of 1st vertex. |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3362 Matrix col = vv->color; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3363 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3364 if (col.numel () == 3) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3365 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3366 m_glfcns.glColor4d (col(0), col(1), col(2), fa); |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3367 if (fl_mode > 0) |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3368 { |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3369 float cb[4] = { 0, 0, 0, 1 }; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3370 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3371 for (int k = 0; k < 3; k++) |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3372 cb[k] = (vv->ambient * col(k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3373 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3374 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3375 for (int k = 0; k < 3; k++) |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3376 cb[k] = (vv->diffuse * col(k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3377 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3378 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3379 for (int k = 0; k < 3; k++) |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3380 cb[k] = vv->specular * |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3381 (vv->specular_color_refl |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3382 + (1-vv->specular_color_refl) * |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3383 col(k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3384 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3385 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3386 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3387 } |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3388 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3389 tess.add_vertex (vv->coords.fortran_vec (), vv); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3390 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3391 |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3392 tess.end_contour (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3393 tess.end_polygon (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3394 } while (i_start > 0); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3395 |
25419
7361fd8aed86
Fix segmentation fault with last change (bug #47677).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3396 if (is_non_planar) |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3397 it1++; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3398 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3399 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3400 if ((fl_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3401 m_glfcns.glDisable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3402 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3403 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3404 { |
24154
78ff6ba5cbb1
Add basic support of "facealpha" for surfaces and patches in OpenGL (bug #39535)
Markus Mützel <markus.muetzel@gmx.de>
parents:
23863
diff
changeset
|
3405 // FIXME: implement flat and interp transparency |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3406 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3407 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3408 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3409 if (draw_all |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3410 || (! props.edgecolor_is ("none") && ! props.linestyle_is ("none"))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3411 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3412 // FIXME: adapt to double-radio property |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3413 if (props.get_edgealpha_double () == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3414 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3415 if (ec_mode == UNIFORM) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3416 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3417 m_glfcns.glColor3dv (ecolor.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3418 if (el_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3419 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3420 float cb[4] = { 0, 0, 0, 1 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3421 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3422 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3423 cb[i] = (as * ecolor(i)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3424 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3425 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3426 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3427 cb[i] = ds * ecolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3428 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3429 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3430 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3431 cb[i] = ss * (scr + (1-scr) * ecolor(i)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3432 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3433 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3434 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3435 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3436 if ((el_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3437 m_glfcns.glEnable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3438 |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
3439 double linewidth = props.get_linewidth (); |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
3440 set_linestyle (props.get_linestyle (), false, linewidth); |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
3441 set_linewidth (linewidth); |
22838
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
3442 set_linecap ("butt"); |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
3443 set_linejoin ("miter"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3444 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3445 // NOTE: patch contour cannot be offset. Offset must occur with the |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3446 // filled portion of the patch above. The tesselator uses |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3447 // GLU_TESS_BOUNDARY_ONLY to get the outline of the patch and OpenGL |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3448 // automatically sets the glType to GL_LINE_LOOP. This primitive is |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3449 // not supported by glPolygonOffset which is used to do Z offsets. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3450 patch_tesselator tess (this, ec_mode, el_mode); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3451 |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3452 it1 = props.coplanar_last_idx.begin (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3453 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3454 for (int i = 0; i < nf; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3455 { |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3456 bool is_non_planar = false; |
25419
7361fd8aed86
Fix segmentation fault with last change (bug #47677).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3457 if (props.coplanar_last_idx.size () > 0 && (*it1).size () > 1) |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3458 is_non_planar = true; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3459 if (clip_f(i) || is_non_planar) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3460 { |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3461 // This is an unclosed contour or a non-planar face. |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3462 // Draw it as a line. |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3463 bool flag = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3464 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3465 m_glfcns.glShadeModel ((ec_mode == INTERP || el_mode == GOURAUD) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3466 ? GL_SMOOTH : GL_FLAT); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3467 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3468 // Add vertices in reverse order for Matlab compatibility |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3469 for (int j = count_f(i)-1; j >= 0; j--) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3470 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3471 if (! clip(int (f(i,j) - 1))) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3472 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3473 vertex_data::vertex_data_rep *vv |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3474 = vdata[i+j*fr].get_rep (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3475 const Matrix m = vv->coords; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3476 if (! flag) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3477 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3478 flag = true; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3479 m_glfcns.glBegin (GL_LINE_STRIP); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3480 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3481 if (ec_mode != UNIFORM) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3482 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3483 Matrix col = vv->color; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3484 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3485 if (col.numel () == 3) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3486 m_glfcns.glColor3dv (col.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3487 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3488 m_glfcns.glVertex3d (m(0), m(1), m(2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3489 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3490 else if (flag) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3491 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3492 flag = false; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3493 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3494 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3495 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3496 // Do loop body with vertex N to "close" GL_LINE_STRIP |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3497 // from vertex 0 to vertex N. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3498 int j = count_f(i)-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3499 if (flag && ! clip(int (f(i,j) - 1))) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3500 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3501 vertex_data::vertex_data_rep *vv |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3502 = vdata[i+j*fr].get_rep (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3503 const Matrix m = vv->coords; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3504 if (ec_mode != UNIFORM) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3505 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3506 Matrix col = vv->color; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3507 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3508 if (col.numel () == 3) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3509 m_glfcns.glColor3dv (col.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3510 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3511 m_glfcns.glVertex3d (m(0), m(1), m(2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3512 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3513 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3514 if (flag) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3515 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3516 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3517 else // Normal edge contour drawn with tesselator |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3518 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3519 tess.begin_polygon (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3520 tess.begin_contour (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3521 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3522 for (int j = count_f(i)-1; j >= 0; j--) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3523 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3524 vertex_data::vertex_data_rep *vv |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3525 = vdata[i+j*fr].get_rep (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3526 tess.add_vertex (vv->coords.fortran_vec (), vv); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3527 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3528 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3529 tess.end_contour (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3530 tess.end_polygon (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3531 } |
25419
7361fd8aed86
Fix segmentation fault with last change (bug #47677).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3532 if (is_non_planar) |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3533 it1++; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3534 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3535 |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
3536 set_linestyle ("-"); // Disable LineStipple |
22358
dc73bbd66363
Make sure all lines associated with axes respect axes linewidth property.
Rik <rik@octave.org>
parents:
22357
diff
changeset
|
3537 set_linewidth (0.5f); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3538 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3539 if ((el_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3540 m_glfcns.glDisable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3541 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3542 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3543 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3544 // FIXME: implement transparency |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3545 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3546 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3547 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3548 if (! props.marker_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3549 && ! (props.markeredgecolor_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3550 && props.markerfacecolor_is ("none"))) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3551 { |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3552 bool do_edge = draw_all || ! props.markeredgecolor_is ("none"); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3553 bool do_face = draw_all || ! props.markerfacecolor_is ("none"); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3554 |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3555 Matrix mecolor = (draw_all ? Matrix (1, 3, 0.0) : |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3556 props.get_markeredgecolor_rgb ()); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3557 Matrix mfcolor = (draw_all ? Matrix (1, 3, 0.0) : |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3558 props.get_markerfacecolor_rgb ()); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3559 |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3560 bool has_markerfacecolor = draw_all || false; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3561 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3562 if ((mecolor.isempty () && ! props.markeredgecolor_is ("none")) |
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3563 || (mfcolor.isempty () && ! props.markerfacecolor_is ("none"))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3564 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3565 Matrix mc = props.get_color_data ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3566 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3567 if (mc.rows () == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3568 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3569 // Single color specifications, we can simplify a little bit |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3570 if (mfcolor.isempty () && ! props.markerfacecolor_is ("none")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3571 mfcolor = mc; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3572 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3573 if (mecolor.isempty () && ! props.markeredgecolor_is ("none")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3574 mecolor = mc; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3575 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3576 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3577 { |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3578 if (c.isempty ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3579 c = props.get_color_data ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3580 has_markerfacecolor = ((c.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3581 && (c.rows () == f.rows ())); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3582 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3583 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3584 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3585 init_marker (props.get_marker (), props.get_markersize (), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3586 props.get_linewidth ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3587 |
25896
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3588 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40); |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3589 uint8_t clip_ok = 0x40; |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3590 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3591 for (int i = 0; i < nf; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3592 for (int j = 0; j < count_f(i); j++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3593 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3594 int idx = int (f(i,j) - 1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3595 |
25896
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3596 if ((clip_code (v(idx,0), v(idx,1), (has_z ? v(idx,2) : 0)) |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3597 & clip_mask) != clip_ok) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3598 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3599 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3600 Matrix cc; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3601 if (c.numel () > 0) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3602 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3603 cc.resize (1, 3); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3604 if (has_markerfacecolor) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3605 cc(0) = c(i,0), cc(1) = c(i,1), cc(2) = c(i,2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3606 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3607 cc(0) = c(idx,0), cc(1) = c(idx,1), cc(2) = c(idx,2); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3608 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3609 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3610 Matrix lc = (do_edge ? (mecolor.isempty () ? cc : mecolor) |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
3611 : Matrix ()); |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3612 Matrix fc = (do_face ? (mfcolor.isempty () ? cc : mfcolor) |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
3613 : Matrix ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3614 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3615 draw_marker (v(idx,0), v(idx,1), (has_z ? v(idx,2) : 0), lc, fc); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3616 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3617 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3618 end_marker (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3619 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3620 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3621 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3622 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3623 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3624 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3625 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3626 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3627 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3628 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3629 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3630 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3631 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3632 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3633 void |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23396
diff
changeset
|
3634 opengl_renderer::draw_light (const light::properties& props) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3635 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3636 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3637 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3638 // enable light source |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3639 m_glfcns.glEnable (m_current_light); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3640 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3641 // light position |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3642 float pos[4] = { 0, 0, 0, 0 }; // X,Y,Z,infinite/local |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3643 Matrix lpos = props.get_position ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3644 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3645 pos[i] = lpos(i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3646 if (props.style_is ("local")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3647 pos[3] = 1; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3648 m_glfcns.glLightfv (m_current_light, GL_POSITION, pos); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3649 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3650 // light color |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3651 float col[4] = { 1, 1, 1, 1 }; // R,G,B,ALPHA (the latter has no meaning) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3652 Matrix lcolor = props.get_color ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3653 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3654 col[i] = lcolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3655 m_glfcns.glLightfv (m_current_light, GL_DIFFUSE, col); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3656 m_glfcns.glLightfv (m_current_light, GL_SPECULAR, col); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3657 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3658 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3659 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3660 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3661 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3662 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3663 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3664 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3665 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3666 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3667 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3668 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3669 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3670 void |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23396
diff
changeset
|
3671 opengl_renderer::draw_hggroup (const hggroup::properties& props) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3672 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3673 draw (props.get_children ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3674 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3675 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3676 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3677 opengl_renderer::draw_text (const text::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3678 { |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3679 #if defined (HAVE_OPENGL) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3680 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
3681 if (props.get_string ().isempty () || props.color_is ("none")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3682 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3683 |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3684 Matrix pos = xform.scale (props.get_data_position ()); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3685 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3686 // Handle clipping manually when drawing text background |
25951 | 3687 if (! props.is_clipping () |
25952 | 3688 || (clip_code (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0) == 0x40)) |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3689 { |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3690 set_clipping (false); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3691 draw_text_background (props); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3692 set_clipping (props.is_clipping ()); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3693 } |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3694 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3695 set_font (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3696 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3697 const Matrix bbox = props.get_extent_matrix (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3698 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3699 bool blend = m_glfcns.glIsEnabled (GL_BLEND); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3700 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3701 m_glfcns.glEnable (GL_BLEND); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3702 m_glfcns.glEnable (GL_ALPHA_TEST); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3703 m_glfcns.glRasterPos3d (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3704 m_glfcns.glBitmap (0, 0, 0, 0, bbox(0), bbox(1), nullptr); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3705 m_glfcns.glDrawPixels (bbox(2), bbox(3), GL_RGBA, GL_UNSIGNED_BYTE, |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3706 props.get_pixels ().data ()); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3707 m_glfcns.glDisable (GL_ALPHA_TEST); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3708 if (! blend) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3709 m_glfcns.glDisable (GL_BLEND); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3710 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3711 #else |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3712 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3713 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3714 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3715 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3716 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3717 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3718 panic_impossible (); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3719 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3720 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3721 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3722 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3723 void |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3724 opengl_renderer::draw_text_background (const text::properties& props, |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3725 bool do_rotate) |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3726 { |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3727 #if defined (HAVE_OPENGL) |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3728 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3729 Matrix bgcol = props.get_backgroundcolor_rgb (); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3730 Matrix ecol = props.get_edgecolor_rgb (); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3731 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3732 if (bgcol.isempty () && ecol.isempty ()) |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3733 return; |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3734 |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3735 Matrix pos = props.get_data_position (); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3736 ColumnVector pixpos = get_transform ().transform (pos(0), pos(1), |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3737 pos(2), true); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3738 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3739 // Save current transform matrices and set orthogonal window coordinates |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3740 m_glfcns.glMatrixMode (GL_PROJECTION); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3741 m_glfcns.glPushMatrix (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3742 m_glfcns.glLoadIdentity (); |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25871
diff
changeset
|
3743 |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3744 Matrix vp = get_viewport_scaled (); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3745 m_glfcns.glOrtho (0, vp(2), vp(3), 0, xZ1, xZ2); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3746 m_glfcns.glMatrixMode (GL_MODELVIEW); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3747 m_glfcns.glPushMatrix (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3748 m_glfcns.glLoadIdentity (); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3749 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3750 // Translate coordinates so that the text anchor is (0,0) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3751 m_glfcns.glTranslated (pixpos(0), pixpos(1), -pixpos(2)); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3752 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3753 // FIXME: Only multiples of 90° are handled by the text renderer. |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3754 // Handle others here. |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3755 double rotation = props.get_rotation (); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3756 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3757 if (do_rotate && rotation != 0.0 && rotation != 90.0 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3758 && rotation != 180.0 && rotation != 270.0) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3759 m_glfcns.glRotated (-rotation, 0.0, 0.0, 1.0); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3760 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3761 double m = props.get_margin (); |
26188
6652de1fe896
Hack margin of text objects to be measured in points, not pixels.
Rik <rik@octave.org>
parents:
26112
diff
changeset
|
3762 // FIXME: Margin property should be measured in points, not pixels. |
6652de1fe896
Hack margin of text objects to be measured in points, not pixels.
Rik <rik@octave.org>
parents:
26112
diff
changeset
|
3763 // On most screens the conversion factor is 4/3. |
6652de1fe896
Hack margin of text objects to be measured in points, not pixels.
Rik <rik@octave.org>
parents:
26112
diff
changeset
|
3764 // For HiDPI this will not work. |
6652de1fe896
Hack margin of text objects to be measured in points, not pixels.
Rik <rik@octave.org>
parents:
26112
diff
changeset
|
3765 m *= 4.0/3.0; |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3766 const Matrix bbox = props.get_extent_matrix (); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3767 double x0 = bbox (0) / m_devpixratio - m; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3768 double x1 = x0 + bbox(2) / m_devpixratio + 2 * m; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3769 double y0 = -(bbox (1) / m_devpixratio - m); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3770 double y1 = y0 - (bbox(3) / m_devpixratio + 2 * m); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3771 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3772 if (! bgcol.isempty ()) |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3773 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3774 m_glfcns.glColor3f (bgcol(0), bgcol(1), bgcol(2)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3775 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3776 bool depth_test = m_glfcns.glIsEnabled (GL_DEPTH_TEST); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3777 if (depth_test) |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3778 set_polygon_offset (true, 4.0); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3779 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3780 m_glfcns.glBegin (GL_QUADS); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3781 m_glfcns.glVertex2d (x0, y0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3782 m_glfcns.glVertex2d (x1, y0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3783 m_glfcns.glVertex2d (x1, y1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3784 m_glfcns.glVertex2d (x0, y1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3785 m_glfcns.glEnd (); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3786 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3787 if (depth_test) |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3788 set_polygon_offset (false); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3789 } |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3790 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3791 if (! ecol.isempty ()) |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3792 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3793 m_glfcns.glColor3f (ecol(0), ecol(1), ecol(2)); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3794 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3795 set_linestyle (props.get_linestyle (), false, props.get_linewidth ()); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3796 set_linewidth (props.get_linewidth ()); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3797 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3798 m_glfcns.glBegin (GL_LINE_STRIP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3799 m_glfcns.glVertex2d (x0, y0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3800 m_glfcns.glVertex2d (x1, y0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3801 m_glfcns.glVertex2d (x1, y1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3802 m_glfcns.glVertex2d (x0, y1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3803 m_glfcns.glVertex2d (x0, y0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3804 m_glfcns.glEnd (); |
25260
601cc3a063f5
Fix OpenGL line-stipple bug manifested as Nouveau driver crash (bug #53644)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
3805 |
601cc3a063f5
Fix OpenGL line-stipple bug manifested as Nouveau driver crash (bug #53644)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
3806 set_linestyle ("-"); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3807 } |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3808 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3809 // Restore previous coordinate system |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3810 m_glfcns.glPopMatrix(); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3811 m_glfcns.glMatrixMode (GL_PROJECTION); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3812 m_glfcns.glPopMatrix(); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3813 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3814 #else |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3815 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3816 octave_unused_parameter (props); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3817 octave_unused_parameter (do_rotate); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3818 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3819 // This shouldn't happen because construction of opengl_renderer |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3820 // objects is supposed to be impossible if OpenGL is not available. |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3821 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3822 panic_impossible (); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3823 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3824 #endif |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3825 } |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3826 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3827 void |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3828 opengl_renderer::draw_image (const image::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3829 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3830 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3831 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3832 octave_value cdata = props.get_color_data (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3833 dim_vector dv (cdata.dims ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3834 int h = dv(0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3835 int w = dv(1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3836 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3837 Matrix x = props.get_xdata ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3838 Matrix y = props.get_ydata ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3839 |
22369
17c9cc85842e
Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents:
22363
diff
changeset
|
3840 // Someone wants us to draw an empty image? No way. |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3841 if (x.isempty () || y.isempty ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3842 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3843 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3844 // Sort x/ydata and mark flipped dimensions |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3845 bool xflip = false; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3846 if (x(0) > x(1)) |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3847 { |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3848 std::swap (x(0), x(1)); |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3849 xflip = true; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3850 } |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3851 else if (w > 1 && x(1) == x(0)) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3852 x(1) = x(1) + (w-1); |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3853 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3854 bool yflip = false; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3855 if (y(0) > y(1)) |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3856 { |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3857 std::swap (y(0), y(1)); |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3858 yflip = true; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3859 } |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3860 else if (h > 1 && y(1) == y(0)) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3861 y(1) = y(1) + (h-1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3862 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3863 const ColumnVector p0 = xform.transform (x(0), y(0), 0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3864 const ColumnVector p1 = xform.transform (x(1), y(1), 0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3865 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
3866 if (math::isnan (p0(0)) || math::isnan (p0(1)) |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
3867 || math::isnan (p1(0)) || math::isnan (p1(1))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3868 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3869 warning ("opengl_renderer: image X,Y data too large to draw"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3870 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3871 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3872 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3873 // image pixel size in screen pixel units |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3874 float pix_dx, pix_dy; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3875 // image pixel size in normalized units |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3876 float nor_dx, nor_dy; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3877 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3878 if (w > 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3879 { |
22369
17c9cc85842e
Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents:
22363
diff
changeset
|
3880 pix_dx = (p1(0) - p0(0)) / (w-1); |
17c9cc85842e
Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents:
22363
diff
changeset
|
3881 nor_dx = (x(1) - x(0)) / (w-1); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3882 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3883 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3884 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3885 const ColumnVector p1w = xform.transform (x(1) + 1, y(1), 0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3886 pix_dx = p1w(0) - p0(0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3887 nor_dx = 1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3888 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3889 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3890 if (h > 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3891 { |
22369
17c9cc85842e
Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents:
22363
diff
changeset
|
3892 pix_dy = (p1(1) - p0(1)) / (h-1); |
17c9cc85842e
Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents:
22363
diff
changeset
|
3893 nor_dy = (y(1) - y(0)) / (h-1); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3894 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3895 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3896 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3897 const ColumnVector p1h = xform.transform (x(1), y(1) + 1, 0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3898 pix_dy = p1h(1) - p0(1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3899 nor_dy = 1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3900 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3901 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3902 // OpenGL won't draw any of the image if its origin is outside the |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3903 // viewport/clipping plane so we must do the clipping ourselves. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3904 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3905 int j0, j1, jj, i0, i1, ii; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3906 j0 = 0, j1 = w; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3907 i0 = 0, i1 = h; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3908 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3909 float im_xmin = x(0) - nor_dx/2; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3910 float im_xmax = x(1) + nor_dx/2; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3911 float im_ymin = y(0) - nor_dy/2; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3912 float im_ymax = y(1) + nor_dy/2; |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3913 |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3914 // Clip to axes or viewport |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3915 bool do_clip = props.is_clipping (); |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3916 Matrix vp = get_viewport_scaled (); |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3917 |
26025
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3918 ColumnVector vp_lim_min = |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3919 xform.untransform (std::numeric_limits <float>::epsilon (), |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3920 std::numeric_limits <float>::epsilon ()); |
26025
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3921 ColumnVector vp_lim_max = xform.untransform (vp(2), vp(3)); |
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3922 |
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3923 if (vp_lim_min(0) > vp_lim_max(0)) |
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3924 std::swap (vp_lim_min(0), vp_lim_max(0)); |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
3925 |
26025
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3926 if (vp_lim_min(1) > vp_lim_max(1)) |
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3927 std::swap (vp_lim_min(1), vp_lim_max(1)); |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
3928 |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3929 float clip_xmin = |
26025
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3930 (do_clip ? (vp_lim_min(0) > xmin ? vp_lim_min(0) : xmin) : vp_lim_min(0)); |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3931 float clip_ymin = |
26025
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3932 (do_clip ? (vp_lim_min(1) > ymin ? vp_lim_min(1) : ymin) : vp_lim_min(1)); |
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3933 |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3934 float clip_xmax = |
26025
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3935 (do_clip ? (vp_lim_max(0) < xmax ? vp_lim_max(0) : xmax) : vp_lim_max(0)); |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3936 float clip_ymax = |
26025
1c6dd836bca9
Fix regression introduced by cset f5e08983d07c (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26020
diff
changeset
|
3937 (do_clip ? (vp_lim_max(1) < ymax ? vp_lim_max(1) : ymax) : vp_lim_max(1)); |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3938 |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3939 if (im_xmin < clip_xmin) |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3940 j0 += (clip_xmin - im_xmin)/nor_dx + 1; |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3941 if (im_xmax > clip_xmax) |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3942 j1 -= (im_xmax - clip_xmax)/nor_dx; |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3943 |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3944 if (im_ymin < clip_ymin) |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3945 i0 += (clip_ymin - im_ymin)/nor_dy + 1; |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3946 if (im_ymax > clip_ymax) |
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3947 i1 -= (im_ymax - clip_ymax)/nor_dy; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3948 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3949 if (i0 >= i1 || j0 >= j1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3950 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3951 |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25871
diff
changeset
|
3952 m_glfcns.glPixelZoom (m_devpixratio * pix_dx, |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25871
diff
changeset
|
3953 - m_devpixratio * pix_dy); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3954 m_glfcns.glRasterPos3d (im_xmin + nor_dx*j0, im_ymin + nor_dy*i0, 0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3955 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3956 // by default this is 4 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3957 m_glfcns.glPixelStorei (GL_UNPACK_ALIGNMENT, 1); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3958 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3959 // Expect RGB data |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3960 if (dv.ndims () == 3 && dv(2) == 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3961 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3962 if (cdata.is_double_type ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3963 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3964 const NDArray xcdata = cdata.array_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3965 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3966 OCTAVE_LOCAL_BUFFER (GLfloat, a, 3*(j1-j0)*(i1-i0)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3967 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3968 for (int i = i0; i < i1; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3969 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3970 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3971 { |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3972 if (! yflip) |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3973 ii = i; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3974 else |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3975 ii = h - i - 1; |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3976 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3977 if (! xflip) |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3978 jj = j; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3979 else |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3980 jj = w - j - 1; |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
3981 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3982 a[idx] = xcdata(ii,jj,0); |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3983 a[idx+1] = xcdata(ii,jj,1); |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
3984 a[idx+2] = xcdata(ii,jj,2); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3985 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3986 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3987 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3988 draw_pixels (j1-j0, i1-i0, a); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3989 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3990 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3991 else if (cdata.is_single_type ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3992 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3993 const FloatNDArray xcdata = cdata.float_array_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3994 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3995 OCTAVE_LOCAL_BUFFER (GLfloat, a, 3*(j1-j0)*(i1-i0)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3996 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3997 for (int i = i0; i < i1; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3998 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3999 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4000 { |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4001 if (! yflip) |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4002 ii = i; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4003 else |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4004 ii = h - i - 1; |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
4005 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4006 if (! xflip) |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4007 jj = j; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4008 else |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4009 jj = w - j - 1; |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
4010 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4011 a[idx] = xcdata(ii,jj,0); |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4012 a[idx+1] = xcdata(ii,jj,1); |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4013 a[idx+2] = xcdata(ii,jj,2); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4014 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4015 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4016 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4017 draw_pixels (j1-j0, i1-i0, a); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4018 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4019 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4020 else if (cdata.is_uint8_type ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4021 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4022 const uint8NDArray xcdata = cdata.uint8_array_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4023 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4024 OCTAVE_LOCAL_BUFFER (GLubyte, a, 3*(j1-j0)*(i1-i0)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4025 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4026 for (int i = i0; i < i1; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4027 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4028 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4029 { |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4030 if (! yflip) |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4031 ii = i; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4032 else |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4033 ii = h - i - 1; |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
4034 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4035 if (! xflip) |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4036 jj = j; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4037 else |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4038 jj = w - j - 1; |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
4039 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4040 a[idx] = xcdata(ii,jj,0); |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4041 a[idx+1] = xcdata(ii,jj,1); |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4042 a[idx+2] = xcdata(ii,jj,2); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4043 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4044 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4045 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4046 draw_pixels (j1-j0, i1-i0, a); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4047 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4048 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4049 else if (cdata.is_uint16_type ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4050 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4051 const uint16NDArray xcdata = cdata.uint16_array_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4052 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4053 OCTAVE_LOCAL_BUFFER (GLushort, a, 3*(j1-j0)*(i1-i0)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4054 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4055 for (int i = i0; i < i1; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4056 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4057 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4058 { |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4059 if (! yflip) |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4060 ii = i; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4061 else |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4062 ii = h - i - 1; |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
4063 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4064 if (! xflip) |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4065 jj = j; |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4066 else |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4067 jj = w - j - 1; |
25999
f5e08983d07c
Clip images in figure limits if necessary (bug #49490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25998
diff
changeset
|
4068 |
25980
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4069 a[idx] = xcdata(ii,jj,0); |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4070 a[idx+1] = xcdata(ii,jj,1); |
221c039aa415
Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25952
diff
changeset
|
4071 a[idx+2] = xcdata(ii,jj,2); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4072 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4073 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4074 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4075 draw_pixels (j1-j0, i1-i0, a); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4076 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4077 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4078 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4079 warning ("opengl_renderer: invalid image data type (expected double, single, uint8, or uint16)"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4080 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4081 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4082 warning ("opengl_renderer: invalid image size (expected MxNx3 or MxN)"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4083 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4084 m_glfcns.glPixelZoom (1, 1); |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
4085 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4086 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4087 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4088 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4089 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4090 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4091 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4092 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4093 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4094 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4095 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4096 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4097 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4098 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4099 opengl_renderer::set_viewport (int w, int h) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4100 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4101 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4102 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4103 m_glfcns.glViewport (0, 0, w, h); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4104 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4105 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4106 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4107 octave_unused_parameter (w); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4108 octave_unused_parameter (h); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4109 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4110 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4111 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4112 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4113 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4114 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4115 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4116 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4117 |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4118 Matrix |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4119 opengl_renderer::get_viewport_scaled (void) const |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4120 { |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4121 Matrix retval (1, 4, 0.0); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4122 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4123 #if defined (HAVE_OPENGL) |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4124 #if defined (HAVE_FRAMEWORK_OPENGL) |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4125 GLint vp[4]; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4126 #else |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4127 int vp[4]; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4128 #endif |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4129 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4130 m_glfcns.glGetIntegerv (GL_VIEWPORT, vp); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4131 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4132 for (int i = 0; i < 4; i++) |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4133 retval(i) = static_cast<double> (vp[i]) / m_devpixratio; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4134 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4135 #else |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4136 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4137 // This shouldn't happen because construction of opengl_renderer |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4138 // objects is supposed to be impossible if OpenGL is not available. |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4139 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4140 panic_impossible (); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4141 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4142 #endif |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4143 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4144 return retval; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4145 } |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4146 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4147 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4148 opengl_renderer::draw_pixels (int width, int height, const float *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4149 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4150 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4151 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4152 m_glfcns.glDrawPixels (width, height, GL_RGB, GL_FLOAT, data); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4153 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4154 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4155 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4156 octave_unused_parameter (width); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4157 octave_unused_parameter (height); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4158 octave_unused_parameter (data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4159 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4160 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4161 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4162 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4163 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4164 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4165 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4166 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4167 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4168 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4169 opengl_renderer::draw_pixels (int width, int height, const uint8_t *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4170 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4171 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4172 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4173 m_glfcns.glDrawPixels (width, height, GL_RGB, GL_UNSIGNED_BYTE, data); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4174 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4175 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4176 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4177 octave_unused_parameter (width); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4178 octave_unused_parameter (height); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4179 octave_unused_parameter (data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4180 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4181 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4182 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4183 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4184 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4185 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4186 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4187 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4188 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4189 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4190 opengl_renderer::draw_pixels (int width, int height, const uint16_t *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4191 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4192 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4193 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4194 m_glfcns.glDrawPixels (width, height, GL_RGB, GL_UNSIGNED_SHORT, data); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4195 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4196 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4197 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4198 octave_unused_parameter (width); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4199 octave_unused_parameter (height); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4200 octave_unused_parameter (data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4201 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4202 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4203 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4204 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4205 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4206 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4207 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4208 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4209 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4210 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4211 opengl_renderer::set_color (const Matrix& c) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4212 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4213 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4214 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4215 m_glfcns.glColor3dv (c.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4216 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
4217 if (! c.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
4218 txt_renderer.set_color (c); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4219 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4220 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4221 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4222 octave_unused_parameter (c); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4223 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4224 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4225 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4226 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4227 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4228 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4229 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4230 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4231 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4232 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4233 opengl_renderer::set_font (const base_properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4234 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4235 txt_renderer.set_font (props.get ("fontname").string_value (), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4236 props.get ("fontweight").string_value (), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4237 props.get ("fontangle").string_value (), |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25871
diff
changeset
|
4238 props.get ("__fontsize_points__").double_value () |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25871
diff
changeset
|
4239 * m_devpixratio); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4240 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4241 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4242 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4243 opengl_renderer::set_polygon_offset (bool on, float offset) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4244 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4245 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4246 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4247 if (on) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4248 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4249 m_glfcns.glEnable (GL_POLYGON_OFFSET_FILL); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4250 m_glfcns.glEnable (GL_POLYGON_OFFSET_LINE); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4251 m_glfcns.glPolygonOffset (offset, offset); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4252 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4253 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4254 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4255 m_glfcns.glDisable (GL_POLYGON_OFFSET_FILL); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4256 m_glfcns.glDisable (GL_POLYGON_OFFSET_LINE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4257 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4258 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4259 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4260 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4261 octave_unused_parameter (on); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4262 octave_unused_parameter (offset); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4263 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4264 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4265 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4266 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4267 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4268 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4269 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4270 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4271 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4272 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4273 opengl_renderer::set_linewidth (float w) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4274 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4275 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4276 |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25871
diff
changeset
|
4277 m_glfcns.glLineWidth (w * m_devpixratio); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4278 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4279 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4280 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4281 octave_unused_parameter (w); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4282 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4283 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4284 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4285 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4286 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4287 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4288 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4289 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4290 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4291 void |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
4292 opengl_renderer::set_linestyle (const std::string& s, bool use_stipple, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
4293 double linewidth) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4294 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4295 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4296 |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4297 int factor = math::round (linewidth * m_devpixratio); |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4298 if (factor < 1) |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4299 factor = 1; |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4300 |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4301 uint16_t pattern = 0xFFFF; |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4302 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4303 bool solid = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4304 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4305 if (s == "-") |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4306 solid = true; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4307 else if (s == ":") |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4308 pattern = 0x5555; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4309 else if (s == "--") |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4310 pattern = 0x0F0F; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4311 else if (s == "-.") |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4312 pattern = 0x6F6F; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4313 else |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4314 pattern = 0x0000; |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4315 |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4316 m_glfcns.glLineStipple (factor, pattern); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4317 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4318 if (solid && ! use_stipple) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4319 m_glfcns.glDisable (GL_LINE_STIPPLE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4320 else |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4321 m_glfcns.glEnable (GL_LINE_STIPPLE); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4322 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4323 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4324 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4325 octave_unused_parameter (s); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4326 octave_unused_parameter (use_stipple); |
22500
1d3b71530539
fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents:
22494
diff
changeset
|
4327 octave_unused_parameter (linewidth); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4328 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4329 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4330 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4331 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4332 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4333 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4334 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4335 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4336 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4337 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4338 opengl_renderer::set_clipbox (double x1, double x2, double y1, double y2, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4339 double z1, double z2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4340 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4341 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4342 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4343 double dx = (x2-x1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4344 double dy = (y2-y1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4345 double dz = (z2-z1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4346 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4347 x1 -= 0.001*dx; x2 += 0.001*dx; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4348 y1 -= 0.001*dy; y2 += 0.001*dy; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4349 z1 -= 0.001*dz; z2 += 0.001*dz; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4350 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4351 ColumnVector p (4, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4352 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4353 p(0) = -1; p(3) = x2; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4354 m_glfcns.glClipPlane (GL_CLIP_PLANE0, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4355 p(0) = 1; p(3) = -x1; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4356 m_glfcns.glClipPlane (GL_CLIP_PLANE1, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4357 p(0) = 0; p(1) = -1; p(3) = y2; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4358 m_glfcns.glClipPlane (GL_CLIP_PLANE2, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4359 p(1) = 1; p(3) = -y1; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4360 m_glfcns.glClipPlane (GL_CLIP_PLANE3, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4361 p(1) = 0; p(2) = -1; p(3) = z2; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4362 m_glfcns.glClipPlane (GL_CLIP_PLANE4, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4363 p(2) = 1; p(3) = -z1; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4364 m_glfcns.glClipPlane (GL_CLIP_PLANE5, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4365 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4366 xmin = x1; xmax = x2; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4367 ymin = y1; ymax = y2; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4368 zmin = z1; zmax = z2; |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4369 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4370 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4371 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4372 octave_unused_parameter (x1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4373 octave_unused_parameter (x2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4374 octave_unused_parameter (y1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4375 octave_unused_parameter (y2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4376 octave_unused_parameter (z1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4377 octave_unused_parameter (z2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4378 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4379 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4380 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4381 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4382 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4383 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4384 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4385 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4386 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4387 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4388 opengl_renderer::set_clipping (bool enable) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4389 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4390 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4391 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4392 bool has_clipping = (m_glfcns.glIsEnabled (GL_CLIP_PLANE0) == GL_TRUE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4393 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4394 if (enable != has_clipping) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4395 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4396 if (enable) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4397 for (int i = 0; i < 6; i++) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4398 m_glfcns.glEnable (GL_CLIP_PLANE0+i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4399 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4400 for (int i = 0; i < 6; i++) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4401 m_glfcns.glDisable (GL_CLIP_PLANE0+i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4402 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4403 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4404 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4405 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4406 octave_unused_parameter (enable); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4407 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4408 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4409 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4410 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4411 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4412 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4413 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4414 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4415 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4416 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4417 opengl_renderer::init_marker (const std::string& m, double size, float width) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4418 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4419 #if defined (HAVE_OPENGL) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4420 m_glfcns.glMatrixMode (GL_PROJECTION); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4421 m_glfcns.glPushMatrix (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4422 m_glfcns.glLoadIdentity (); |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25871
diff
changeset
|
4423 |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4424 Matrix vp = get_viewport_scaled (); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4425 m_glfcns.glOrtho (0, vp(2), vp(3), 0, xZ1, xZ2); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4426 m_glfcns.glMatrixMode (GL_MODELVIEW); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4427 m_glfcns.glPushMatrix (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4428 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4429 set_clipping (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4430 set_linewidth (width); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4431 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4432 marker_id = make_marker_list (m, size, false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4433 filled_marker_id = make_marker_list (m, size, true); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4434 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4435 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4436 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4437 octave_unused_parameter (m); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4438 octave_unused_parameter (size); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4439 octave_unused_parameter (width); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4440 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4441 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4442 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4443 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4444 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4445 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4446 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4447 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4448 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4449 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4450 opengl_renderer::end_marker (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4451 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4452 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4453 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4454 m_glfcns.glDeleteLists (marker_id, 1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4455 m_glfcns.glDeleteLists (filled_marker_id, 1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4456 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4457 m_glfcns.glMatrixMode (GL_MODELVIEW); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4458 m_glfcns.glPopMatrix (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4459 m_glfcns.glMatrixMode (GL_PROJECTION); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4460 m_glfcns.glPopMatrix (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4461 set_linewidth (0.5f); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4462 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4463 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4464 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4465 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4466 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4467 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4468 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4469 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4470 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4471 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4472 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4473 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4474 opengl_renderer::draw_marker (double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4475 const Matrix& lc, const Matrix& fc) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4476 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4477 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4478 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4479 ColumnVector tmp = xform.transform (x, y, z, false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4480 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4481 m_glfcns.glLoadIdentity (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4482 m_glfcns.glTranslated (tmp(0), tmp(1), -tmp(2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4483 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4484 if (filled_marker_id > 0 && fc.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4485 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4486 m_glfcns.glColor3dv (fc.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4487 set_polygon_offset (true, -1.0); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4488 m_glfcns.glCallList (filled_marker_id); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4489 if (lc.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4490 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4491 m_glfcns.glColor3dv (lc.data ()); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4492 m_glfcns.glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4493 m_glfcns.glEdgeFlag (GL_TRUE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4494 set_polygon_offset (true, -2.0); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4495 m_glfcns.glCallList (filled_marker_id); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4496 m_glfcns.glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4497 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4498 set_polygon_offset (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4499 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4500 else if (marker_id > 0 && lc.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4501 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4502 m_glfcns.glColor3dv (lc.data ()); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4503 m_glfcns.glCallList (marker_id); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4504 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4505 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4506 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4507 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4508 octave_unused_parameter (x); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4509 octave_unused_parameter (y); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4510 octave_unused_parameter (z); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4511 octave_unused_parameter (lc); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4512 octave_unused_parameter (fc); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4513 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4514 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4515 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4516 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4517 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4518 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4519 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4520 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4521 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4522 void |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4523 opengl_renderer::init_maxlights (void) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4524 { |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4525 #if defined (HAVE_OPENGL) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4526 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4527 // Check actual maximum number of lights possible |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4528 if (m_max_lights == 0) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4529 { |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4530 for (m_max_lights = 0; m_max_lights < GL_MAX_LIGHTS; m_max_lights++) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4531 { |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4532 m_glfcns.glDisable (GL_LIGHT0 + m_max_lights); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4533 if (m_glfcns.glGetError ()) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4534 break; |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4535 } |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4536 } |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4537 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4538 #else |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4539 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4540 // This shouldn't happen because construction of opengl_renderer |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4541 // objects is supposed to be impossible if OpenGL is not available. |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4542 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4543 panic_impossible (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4544 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4545 #endif |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4546 } |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4547 |
26417
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4548 std::string |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4549 opengl_renderer::get_string (unsigned int id) const |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4550 { |
25864
baeb93e9febc
allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents:
25863
diff
changeset
|
4551 #if defined (HAVE_OPENGL) |
baeb93e9febc
allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents:
25863
diff
changeset
|
4552 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4553 // This is kind of ugly, but glGetString returns a pointer to GLubyte |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4554 // and there is no std::string constructor that matches. Is there a |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4555 // better way? |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4556 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4557 std::ostringstream buf; |
25864
baeb93e9febc
allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents:
25863
diff
changeset
|
4558 |
26417
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4559 buf << m_glfcns.glGetString (static_cast<GLenum> (id)); |
25864
baeb93e9febc
allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents:
25863
diff
changeset
|
4560 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4561 return std::string (buf.str ()); |
26417
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4562 |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4563 #else |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4564 |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4565 octave_unused_parameter (id); |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4566 |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4567 // This shouldn't happen because construction of opengl_renderer |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4568 // objects is supposed to be impossible if OpenGL is not available. |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4569 |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4570 panic_impossible (); |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4571 return std::string (); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4572 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4573 #endif |
26417
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4574 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4575 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4576 void |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4577 opengl_renderer::set_normal (int bfl_mode, const NDArray& n, int j, int i) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4578 { |
21797
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4579 #if defined (HAVE_OPENGL) |
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4580 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4581 double x = n(j,i,0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4582 double y = n(j,i,1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4583 double z = n(j,i,2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4584 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4585 double d = sqrt (x*x + y*y + z*z); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4586 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4587 double dir = 1.0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4588 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4589 if (bfl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4590 dir = ((x * view_vector(0) + y * view_vector(1) + z * view_vector(2) < 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4591 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4592 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4593 m_glfcns.glNormal3d (dir*x/d, dir*y/d, dir*z/d); |
21797
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4594 |
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4595 #else |
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4596 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4597 octave_unused_parameter (bfl_mode); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4598 octave_unused_parameter (n); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4599 octave_unused_parameter (j); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4600 octave_unused_parameter (i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4601 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4602 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4603 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4604 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4605 panic_impossible (); |
21797
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4606 |
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4607 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4608 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4609 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4610 unsigned int |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4611 opengl_renderer::make_marker_list (const std::string& marker, double size, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4612 bool filled) const |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4613 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4614 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4615 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4616 char c = marker[0]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4617 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4618 if (filled && (c == '+' || c == 'x' || c == '*' || c == '.')) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4619 return 0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4620 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4621 unsigned int ID = m_glfcns.glGenLists (1); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4622 double sz = size * toolkit.get_screen_resolution () / 72.0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4623 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4624 // constants for the * marker |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4625 const double sqrt2d4 = 0.35355339059327; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4626 double tt = sz*sqrt2d4; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4627 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4628 m_glfcns.glNewList (ID, GL_COMPILE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4629 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4630 switch (marker[0]) |
7851
002b1d8460d2
added some more markers
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7846
diff
changeset
|
4631 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4632 case '+': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4633 m_glfcns.glBegin (GL_LINES); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4634 m_glfcns.glVertex2d (-sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4635 m_glfcns.glVertex2d (sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4636 m_glfcns.glVertex2d (0, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4637 m_glfcns.glVertex2d (0, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4638 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4639 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4640 case 'x': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4641 m_glfcns.glBegin (GL_LINES); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4642 m_glfcns.glVertex2d (-sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4643 m_glfcns.glVertex2d (sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4644 m_glfcns.glVertex2d (-sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4645 m_glfcns.glVertex2d (sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4646 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4647 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4648 case '*': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4649 m_glfcns.glBegin (GL_LINES); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4650 m_glfcns.glVertex2d (-sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4651 m_glfcns.glVertex2d (sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4652 m_glfcns.glVertex2d (0, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4653 m_glfcns.glVertex2d (0, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4654 m_glfcns.glVertex2d (-tt, -tt); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4655 m_glfcns.glVertex2d (+tt, +tt); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4656 m_glfcns.glVertex2d (-tt, +tt); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4657 m_glfcns.glVertex2d (+tt, -tt); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4658 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4659 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4660 case '.': |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4661 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4662 // The dot marker is special and is drawn at 1/3rd the specified size |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4663 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4664 // Ensure that something is drawn even at very small markersizes |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4665 if (sz > 0 && sz < 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4666 sz = 3; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4667 |
25688
b2917b7858ba
maint: Use Octave convention for spacing of C++ cast statements.
Rik <rik@octave.org>
parents:
25438
diff
changeset
|
4668 int div = static_cast<int> (M_PI * sz / 12); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4669 if (! (div % 2)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4670 div += 1; // ensure odd number for left/right symmetry |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4671 div = std::max (div, 3); // ensure at least a few vertices are drawn |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4672 double ang_step = M_PI / div; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4673 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4674 m_glfcns.glBegin (GL_POLYGON); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4675 for (double ang = 0; ang < 2*M_PI; ang += ang_step) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4676 m_glfcns.glVertex2d (sz/6*cos (ang), sz/6*sin (ang)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4677 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4678 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4679 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4680 case 's': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4681 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4682 m_glfcns.glVertex2d (-sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4683 m_glfcns.glVertex2d (-sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4684 m_glfcns.glVertex2d (sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4685 m_glfcns.glVertex2d (sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4686 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4687 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4688 case 'o': |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4689 { |
25688
b2917b7858ba
maint: Use Octave convention for spacing of C++ cast statements.
Rik <rik@octave.org>
parents:
25438
diff
changeset
|
4690 int div = static_cast<int> (M_PI * sz / 4); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4691 if (! (div % 2)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4692 div += 1; // ensure odd number for left/right symmetry |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4693 div = std::max (div, 5); // ensure at least a few vertices are drawn |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4694 double ang_step = M_PI / div; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4695 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4696 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4697 for (double ang = 0; ang < 2*M_PI; ang += ang_step) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4698 m_glfcns.glVertex2d (sz/2*cos (ang), sz/2*sin (ang)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4699 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4700 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4701 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4702 case 'd': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4703 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4704 m_glfcns.glVertex2d (0, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4705 m_glfcns.glVertex2d (sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4706 m_glfcns.glVertex2d (0, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4707 m_glfcns.glVertex2d (-sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4708 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4709 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4710 case 'v': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4711 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4712 m_glfcns.glVertex2d (0, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4713 m_glfcns.glVertex2d (sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4714 m_glfcns.glVertex2d (-sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4715 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4716 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4717 case '^': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4718 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4719 m_glfcns.glVertex2d (0, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4720 m_glfcns.glVertex2d (-sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4721 m_glfcns.glVertex2d (sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4722 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4723 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4724 case '>': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4725 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4726 m_glfcns.glVertex2d (sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4727 m_glfcns.glVertex2d (-sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4728 m_glfcns.glVertex2d (-sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4729 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4730 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4731 case '<': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4732 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4733 m_glfcns.glVertex2d (-sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4734 m_glfcns.glVertex2d (sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4735 m_glfcns.glVertex2d (sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4736 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4737 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4738 case 'p': |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4739 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4740 double ang, r, dr; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4741 dr = 1.0 - sin (M_PI/10)/sin (3*M_PI/10)*1.02; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4742 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4743 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4744 for (int i = 0; i < 2*5; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4745 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4746 ang = (-0.5 + double (i+1) / 5) * M_PI; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4747 r = 1.0 - (dr * fmod (double (i+1), 2.0)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4748 m_glfcns.glVertex2d (sz/2*r*cos (ang), sz/2*r*sin (ang)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4749 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4750 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4751 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4752 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4753 case 'h': |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4754 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4755 double ang, r, dr; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4756 dr = 1.0 - 0.5/sin (M_PI/3)*1.02; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4757 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4758 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4759 for (int i = 0; i < 2*6; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4760 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4761 ang = (0.5 + double (i+1) / 6.0) * M_PI; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4762 r = 1.0 - (dr * fmod (double (i+1), 2.0)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4763 m_glfcns.glVertex2d (sz/2*r*cos (ang), sz/2*r*sin (ang)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4764 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4765 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4766 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4767 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4768 default: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4769 warning ("opengl_renderer: unsupported marker '%s'", marker.c_str ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4770 break; |
7851
002b1d8460d2
added some more markers
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7846
diff
changeset
|
4771 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4772 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4773 m_glfcns.glEndList (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4774 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4775 return ID; |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4776 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4777 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4778 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4779 octave_unused_parameter (marker); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4780 octave_unused_parameter (size); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4781 octave_unused_parameter (filled); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4782 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4783 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4784 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4785 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4786 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4787 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4788 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4789 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4790 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4791 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4792 opengl_renderer::text_to_pixels (const std::string& txt, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4793 uint8NDArray& pixels, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4794 Matrix& bbox, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4795 int halign, int valign, double rotation) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4796 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4797 txt_renderer.text_to_pixels (txt, pixels, bbox, halign, valign, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4798 rotation, interpreter); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4799 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4800 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4801 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4802 opengl_renderer::text_to_strlist (const std::string& txt, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4803 std::list<text_renderer::string>& lst, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4804 Matrix& bbox, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4805 int halign, int valign, double rotation) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4806 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4807 txt_renderer.text_to_strlist (txt, lst, bbox, halign, valign, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4808 rotation, interpreter); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4809 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4810 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4811 Matrix |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4812 opengl_renderer::render_text (const std::string& txt, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4813 double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4814 int halign, int valign, double rotation) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4815 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4816 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4817 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4818 Matrix bbox (1, 4, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4819 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4820 if (txt.empty ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4821 return bbox; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4822 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4823 if (txt_renderer.ok ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4824 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4825 uint8NDArray pixels; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4826 text_to_pixels (txt, pixels, bbox, halign, valign, rotation); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4827 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4828 bool blend = m_glfcns.glIsEnabled (GL_BLEND); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4829 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4830 m_glfcns.glEnable (GL_BLEND); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4831 m_glfcns.glEnable (GL_ALPHA_TEST); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4832 m_glfcns.glRasterPos3d (x, y, z); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4833 m_glfcns.glBitmap(0, 0, 0, 0, bbox(0), bbox(1), nullptr); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4834 m_glfcns.glDrawPixels (bbox(2), bbox(3), |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4835 GL_RGBA, GL_UNSIGNED_BYTE, pixels.data ()); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4836 m_glfcns.glDisable (GL_ALPHA_TEST); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4837 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4838 if (! blend) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4839 m_glfcns.glDisable (GL_BLEND); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4840 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4841 |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
4842 return bbox; |
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
4843 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4844 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4845 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4846 octave_unused_parameter (txt); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4847 octave_unused_parameter (x); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4848 octave_unused_parameter (y); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4849 octave_unused_parameter (z); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4850 octave_unused_parameter (halign); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4851 octave_unused_parameter (valign); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4852 octave_unused_parameter (rotation); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4853 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4854 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4855 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4856 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4857 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4858 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4859 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4860 } |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
4861 } |