annotate libinterp/corefcn/gl-render.cc @ 24722:af6c1ed60581

avoid splitting namespace blocks unnecessarily * fcn-info.cc, ft-text-renderer.cc, gl-render.cc, gl2ps-print.cc, oct-stream.cc, symtab.cc, pt-cbinop.cc, pt-eval.cc, pt-idx.cc: Don't split namespace blocks unnecessarily. Omitting static functions from namespace blocks was done because of a misunderstanding.
author John W. Eaton <jwe@octave.org>
date Sat, 10 Feb 2018 07:58:25 -0500
parents ab2321d4ba03
children edef866fba7b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
1 /*
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 2008-2017 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
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
27 #include <iostream>
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
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
43 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
44
22326
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
45 namespace octave
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
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:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
99 texture_rep (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
100 : id (), w (), h (), tw (), th (), tx (), ty (),
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
104 texture_rep (GLuint id_arg, int w_arg, int h_arg, int tw_arg, int th_arg)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
105 : id (id_arg), w (w_arg), h (h_arg), tw (tw_arg), th (th_arg),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
106 tx (double(w)/tw), ty (double(h)/th), valid (true),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
107 count (1) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
108
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
109 ~texture_rep (void)
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 if (valid)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
112 glDeleteTextures (1, &id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
113 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
114
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
115 void bind (int mode) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
116 { if (valid) glBindTexture (mode, id); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
117
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
118 void tex_coord (double q, double r) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
119 { if (valid) glTexCoord2d (q*tx, r*ty); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
120
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
121 GLuint id;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
122 int w, h;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
123 int tw, th;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
124 double tx, ty;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
125 bool valid;
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
126 refcount<int> count;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
127 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
128
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
129 texture_rep *rep;
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 private:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
132 opengl_texture (texture_rep *_rep) : rep (_rep) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
133
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
134 public:
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
135 opengl_texture (void) : rep (new texture_rep ()) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
136
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
137 opengl_texture (const opengl_texture& tx)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
138 : rep (tx.rep)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
139 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
140 rep->count++;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
141 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
142
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
143 ~opengl_texture (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
144 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
145 if (--rep->count == 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
146 delete rep;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
147 }
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
148
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
149 opengl_texture& operator = (const opengl_texture& tx)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
150 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
151 if (--rep->count == 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
152 delete rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
153
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
154 rep = tx.rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
155 rep->count++;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
156
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
157 return *this;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
158 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
159
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
160 static opengl_texture create (const octave_value& data);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
161
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
162 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
163 { rep->bind (mode); }
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
164
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
165 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
166 { rep->tex_coord (q, r); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
167
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
168 bool is_valid (void) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
169 { return rep->valid; }
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
170 };
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
171
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
172 opengl_texture
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
173 opengl_texture::create (const octave_value& data)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
174 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
175 opengl_texture retval;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
176
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
177 dim_vector dv (data.dims ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
178
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
179 // Expect RGB data
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
180 if (dv.ndims () == 3 && dv(2) == 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
181 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
182 // 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
183 // 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
184 int h, w, tw, th;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
185 h = dv(0), w = dv(1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
186 GLuint id;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
187 bool ok = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
188
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
189 tw = next_power_of_2 (w);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
190 th = next_power_of_2 (h);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
191
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
192 glGenTextures (1, &id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
193 glBindTexture (GL_TEXTURE_2D, id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
194
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
195 if (data.is_double_type ())
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 const NDArray xdata = data.array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
198
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
199 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
200
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
201 for (int i = 0; i < h; i++)
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 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
204 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
205 a[idx] = xdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
206 a[idx+1] = xdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
207 a[idx+2] = xdata(i,j,2);
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 }
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 glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB, GL_FLOAT, a);
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 else if (data.is_uint8_type ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
214 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
215 const uint8NDArray xdata = data.uint8_array_value ();
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 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
218
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
219 for (int i = 0; i < h; i++)
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 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
222 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
223 a[idx] = xdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
224 a[idx+1] = xdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
225 a[idx+2] = xdata(i,j,2);
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 }
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 glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
230 GL_RGB, GL_UNSIGNED_BYTE, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
231 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
232 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
233 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
234 ok = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
235 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
236 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
237
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
238 if (ok)
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 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
241 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
242
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
243 if (glGetError () != GL_NO_ERROR)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
244 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
245 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
246 retval = opengl_texture (new texture_rep (id, w, h, tw, th));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
247 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
248 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
249 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
250 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
251
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
252 return retval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
253 }
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
254
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
255 class
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
256 opengl_tesselator
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
257 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
258 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
259 #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
260 typedef GLvoid (CALLBACK *fcn) (...);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
261 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
262 typedef void (CALLBACK *fcn) (void);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
263 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
264
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
265 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
266
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23696
diff changeset
267 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
268
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
269 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
270
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
271 opengl_tesselator (const opengl_tesselator&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
272
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
273 opengl_tesselator operator = (const opengl_tesselator&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
274
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
275 virtual ~opengl_tesselator (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
276 { if (glu_tess) gluDeleteTess (glu_tess); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
277
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
278 void begin_polygon (bool filled = true)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
279 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
280 gluTessProperty (glu_tess, GLU_TESS_BOUNDARY_ONLY,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
281 (filled ? GL_FALSE : GL_TRUE));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
282 fill = filled;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
283 gluTessBeginPolygon (glu_tess, this);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
284 }
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 end_polygon (void) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
287 { gluTessEndPolygon (glu_tess); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
288
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
289 void begin_contour (void) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
290 { gluTessBeginContour (glu_tess); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
291
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
292 void end_contour (void) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
293 { gluTessEndContour (glu_tess); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
294
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
295 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
296 { gluTessVertex (glu_tess, loc, data); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
297
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
298 protected:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
299 virtual void begin (GLenum /*type*/) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
300
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
301 virtual void end (void) { }
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 virtual void vertex (void * /*data*/) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
304
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
305 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
306 GLfloat [4] /*w*/, void ** /*out_data*/) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
307
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
308 virtual void edge_flag (GLboolean /*flag*/) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
309
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
310 virtual void error (GLenum err)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
311 { ::error ("OpenGL tesselation error (%d)", err); }
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 init (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
314 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
315 glu_tess = gluNewTess ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
316
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
317 gluTessCallback (glu_tess, GLU_TESS_BEGIN_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
318 reinterpret_cast<fcn> (tess_begin));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
319 gluTessCallback (glu_tess, GLU_TESS_END_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
320 reinterpret_cast<fcn> (tess_end));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
321 gluTessCallback (glu_tess, GLU_TESS_VERTEX_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
322 reinterpret_cast<fcn> (tess_vertex));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
323 gluTessCallback (glu_tess, GLU_TESS_COMBINE_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
324 reinterpret_cast<fcn> (tess_combine));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
325 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
326 reinterpret_cast<fcn> (tess_edge_flag));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
327 gluTessCallback (glu_tess, GLU_TESS_ERROR_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
328 reinterpret_cast<fcn> (tess_error));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
329 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
330
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
331 bool is_filled (void) const { return fill; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
332
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
333 private:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
334 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
335 { reinterpret_cast<opengl_tesselator *> (t)->begin (type); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
336
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
337 static void CALLBACK tess_end (void *t)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
338 { reinterpret_cast<opengl_tesselator *> (t)->end (); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
339
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
340 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
341 { reinterpret_cast<opengl_tesselator *> (t)->vertex (v); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
342
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
343 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
344 void **out, void *t)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
345 { 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
346
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
347 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
348 { 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
349
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
350 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
351 { reinterpret_cast<opengl_tesselator *> (t)->error (err); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
352
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
353 private:
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 GLUtesselator *glu_tess;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
356 bool fill;
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
359 class
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
360 vertex_data
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
361 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
362 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
363 class vertex_data_rep
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
364 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
365 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
366 Matrix coords;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
367 Matrix color;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
368 Matrix normal;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
369 double alpha;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
370 float ambient;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
371 float diffuse;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
372 float specular;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
373 float specular_exp;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
374 float specular_color_refl;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
375
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
376 // reference counter
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
377 refcount<int> count;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
378
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
379 vertex_data_rep (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
380 : coords (), color (), normal (), alpha (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
381 ambient (), diffuse (), specular (), specular_exp (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
382 specular_color_refl (), count (1) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
383
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
384 vertex_data_rep (const Matrix& c, const Matrix& col, const Matrix& n,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
385 double a, float as, float ds, float ss, float se,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
386 float scr)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
387 : coords (c), color (col), normal (n), alpha (a),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
388 ambient (as), diffuse (ds), specular (ss), specular_exp (se),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
389 specular_color_refl (scr), count (1) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
390 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
391
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
392 private:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
393 vertex_data_rep *rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
394
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23433
diff changeset
395 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
396 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
397 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
398
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
399 return nr;
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
402 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
403 vertex_data (void) : rep (nil_rep ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
404 { rep->count++; }
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 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
407 { rep->count++; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
408
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
409 vertex_data (const Matrix& c, const Matrix& col, const Matrix& n,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
410 double a, float as, float ds, float ss, float se,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
411 float scr)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
412 : rep (new vertex_data_rep (c, col, n, a, as, ds, ss, se, scr))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
413 { }
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 (vertex_data_rep *new_rep)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
416 : rep (new_rep) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
417
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
418 ~vertex_data (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
419 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
420 if (--rep->count == 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
421 delete rep;
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& operator = (const vertex_data& v)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
425 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
426 if (--rep->count == 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
427 delete rep;
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 rep = v.rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
430 rep->count++;
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 return *this;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
433 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
434
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23433
diff changeset
435 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
436 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
437
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
438 class
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
439 opengl_renderer::patch_tesselator : public opengl_tesselator
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
440 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
441 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
442 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
443 : opengl_tesselator (), renderer (r),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
444 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
445 first (true), tmp_vdata ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
446 { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
447
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
448 protected:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
449 void begin (GLenum type)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
450 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
451 //printf ("patch_tesselator::begin (%d)\n", type);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
452 first = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
453
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
454 if (color_mode == INTERP || light_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
455 glShadeModel (GL_SMOOTH);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
456 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
457 glShadeModel (GL_FLAT);
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 if (is_filled ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
460 renderer->set_polygon_offset (true, index);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
461
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
462 glBegin (type);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
463 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
464
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
465 void end (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
466 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
467 //printf ("patch_tesselator::end\n");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
468 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
469 renderer->set_polygon_offset (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
470 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
471
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
472 void vertex (void *data)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
473 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
474 vertex_data::vertex_data_rep *v
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
475 = 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
476 //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
477
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
478 // 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
479 // 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
480
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
481 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
482 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
483 Matrix col = v->color;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
484
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
485 if (col.numel () == 3)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
486 {
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
487 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
488 if (light_mode > 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
489 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
490 float buf[4] = { 0, 0, 0, 1 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
491
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
492 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
493 buf[k] = (v->ambient * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
494 glMaterialfv (LIGHT_MODE, GL_AMBIENT, buf);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
497 buf[k] = (v->diffuse * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
498 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, buf);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
499
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
500 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
501 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
502 (1 - v->specular_color_refl) * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
503 glMaterialfv (LIGHT_MODE, GL_SPECULAR, buf);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
504
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
505 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
506 }
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
509 if (light_mode > 0 && (first || light_mode == GOURAUD))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
510 glNormal3dv (v->normal.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
511
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
512 glVertex3dv (v->coords.data ());
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 first = false;
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
515 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
516
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
517 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
518 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
519 //printf ("patch_tesselator::combine\n");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
520
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
521 vertex_data::vertex_data_rep *v[4];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
522 int vmax = 4;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
523
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
524 for (int i = 0; i < 4; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
525 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
526 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
527
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
528 if (vmax == 4 && ! v[i])
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
529 vmax = i;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
530 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
531
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
532 Matrix vv (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
533 Matrix cc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
534 Matrix nn (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
535 double aa = 0.0;
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 vv(0) = xyz[0];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
538 vv(1) = xyz[1];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
539 vv(2) = xyz[2];
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 if (v[0]->color.numel ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
542 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
543 cc.resize (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
544 for (int ic = 0; ic < 3; ic++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
545 for (int iv = 0; iv < vmax; iv++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
546 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
547 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
548
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
549 if (v[0]->normal.numel () > 0)
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 for (int in = 0; in < 3; in++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
552 for (int iv = 0; iv < vmax; iv++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
553 nn(in) += (w[iv] * v[iv]->normal (in));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
554 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
555
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
556 for (int iv = 0; iv < vmax; iv++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
557 aa += (w[iv] * v[iv]->alpha);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
558
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
559 vertex_data new_v (vv, cc, nn, aa, v[0]->ambient, v[0]->diffuse,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
560 v[0]->specular, v[0]->specular_exp, v[0]->specular_color_refl);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
561 tmp_vdata.push_back (new_v);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
562
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
563 *out_data = new_v.get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
564 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
565
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
566 private:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
567
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
568 // No copying!
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
569
22865
89756f2f085b use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents: 22838
diff changeset
570 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
571
89756f2f085b use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents: 22838
diff changeset
572 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
573
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
574 opengl_renderer *renderer;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
575 int color_mode;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
576 int light_mode;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
577 int index;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
578 bool first;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
579 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
580 };
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
581
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
582 #else
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
583
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
584 class
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
585 opengl_renderer::patch_tesselator
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
586 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
587 // Dummy class.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
588 };
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
589
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
590 #endif
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
591
22258
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
592 #if defined (HAVE_OPENGL)
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
593
24722
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
594 static int
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
595 get_maxlights (void)
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
596 {
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
597 static int max_lights = 0;
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
598
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
599 // Check actual maximum number of lights possible
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
600 if (max_lights == 0)
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
601 {
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
602 for (max_lights = 0; max_lights < GL_MAX_LIGHTS; max_lights++)
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
603 {
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
604 glDisable (GL_LIGHT0 + max_lights);
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
605 if (glGetError ())
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
606 break;
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
607 }
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
608 }
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
609
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
610 return max_lights;
af6c1ed60581 avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24634
diff changeset
611 }
22192
20b225a3ebf8 Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22105
diff changeset
612
20b225a3ebf8 Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22105
diff changeset
613 #endif
20b225a3ebf8 Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22105
diff changeset
614
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
615 opengl_renderer::opengl_renderer (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
616 : toolkit (), xform (), xmin (), xmax (), ymin (), ymax (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
617 zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (),
24634
ab2321d4ba03 maint: strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
618 camera_pos (), camera_dir (), interpreter ("none"), txt_renderer (),
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
619 selecting (false)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
620 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
621 // 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
622 // 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
623 // OpenGL types.
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
624
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
625 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
626
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
627 // 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
628 // FIXME: should we check signed vs. unsigned?
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
629
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
630 static bool ok = (sizeof (int) <= sizeof (GLsizei));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
631
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
632 if (! ok)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
633 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
634
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
635 #else
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
636
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
637 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
638
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
639 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
640 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
641
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
642 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
643 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
644 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
645 if (! go.valid_object ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
646 return;
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 const base_properties& props = go.get_properties ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
649
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
650 if (! toolkit)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
651 toolkit = props.get_toolkit ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
652
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
653 if (go.isa ("figure"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
654 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
655 else if (go.isa ("axes"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
656 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
657 else if (go.isa ("line"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
658 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
659 else if (go.isa ("surface"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
660 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
661 else if (go.isa ("patch"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
662 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
663 else if (go.isa ("light"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
664 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
665 else if (go.isa ("hggroup"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
666 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
667 else if (go.isa ("text"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
668 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
669 else if (go.isa ("image"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
670 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
671 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
672 || go.isa ("uicontextmenu") || go.isa ("uitoolbar")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
673 || go.isa ("uipushtool") || go.isa ("uitoggletool"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
674 ; // SKIP
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
675 else if (go.isa ("uipanel"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
676 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
677 if (toplevel)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
678 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
679 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
680 else if (go.isa ("uibuttongroup"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
681 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
682 if (toplevel)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
683 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
684 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
685 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
686 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
687 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
688 props.graphics_object_name ().c_str ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
689 }
22494
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
690
22500
1d3b71530539 fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents: 22494
diff changeset
691 #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
692
22494
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
693 GLenum gl_error = glGetError ();
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
694 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
695 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
696 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
697
1d3b71530539 fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents: 22494
diff changeset
698 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
699 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
700
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
701 #if defined (HAVE_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
702
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
703 static std::string
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
704 gl_get_string (GLenum id)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
705 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
706 // This is kind of ugly, but glGetString returns a pointer to GLubyte
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
707 // and there is no std::string constructor that matches. Is there a
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
708 // better way?
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
709
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
710 std::ostringstream buf;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
711 buf << glGetString (id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
712 return std::string (buf.str ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
713 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
714
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
715 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
716
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
717 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
718 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
719 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
720 // Initialize OpenGL context
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
721
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
722 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
723
21689
9467549bd5ff * gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents: 21684
diff changeset
724 #if defined (HAVE_OPENGL)
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
725
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
726 props.set___gl_extensions__ (gl_get_string (GL_EXTENSIONS));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
727 props.set___gl_renderer__ (gl_get_string (GL_RENDERER));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
728 props.set___gl_vendor__ (gl_get_string (GL_VENDOR));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
729 props.set___gl_version__ (gl_get_string (GL_VERSION));
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
730
21689
9467549bd5ff * gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents: 21684
diff changeset
731 #endif
21684
1449e3b98941 store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents: 21660
diff changeset
732
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
733 // Draw children
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
734
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
735 draw (props.get_all_children (), false);
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
738 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
739 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
740 const graphics_object& go)
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 graphics_object fig = go.get_ancestor ("figure");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
743 const figure::properties& figProps =
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
744 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
745
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
746 // Initialize OpenGL context
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
747
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
748 init_gl_context (figProps.is_graphicssmoothing (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
749 props.get_backgroundcolor_rgb ());
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 // Draw children
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
752
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
753 draw (props.get_all_children (), false);
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
756 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
757 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
758 const graphics_object& go)
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 graphics_object fig = go.get_ancestor ("figure");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
761 const figure::properties& figProps =
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
762 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
763
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
764 // Initialize OpenGL context
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
765
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
766 init_gl_context (figProps.is_graphicssmoothing (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
767 props.get_backgroundcolor_rgb ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
768
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
769 // Draw children
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
770
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
771 draw (props.get_all_children (), false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
772 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
773
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
774 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
775 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
776 {
21689
9467549bd5ff * gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents: 21684
diff changeset
777 #if defined (HAVE_OPENGL)
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
778
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
779 // Initialize OpenGL context
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
780
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
781 glEnable (GL_DEPTH_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
782 glDepthFunc (GL_LEQUAL);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
783 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
784 glAlphaFunc (GL_GREATER, 0.0f);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
785 glEnable (GL_NORMALIZE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
786
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
787 if (enhanced)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
788 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
789 glEnable (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
790 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
791 bool has_multisample = false;
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
792 if (! glGetError ())
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
793 {
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
794 GLint iMultiSample, iNumSamples;
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
795 glGetIntegerv (GL_SAMPLE_BUFFERS, &iMultiSample);
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
796 glGetIntegerv (GL_SAMPLES, &iNumSamples);
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
797 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
798 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
799 }
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
800
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
801 if (! has_multisample)
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 // MultiSample not implemented. Use old-style anti-aliasing
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
804 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
805 // 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
806 // implemented. Thus, call glGetError to reset the error state.
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
807 glGetError ();
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
808
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
809 glEnable (GL_LINE_SMOOTH);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
810 glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
813 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
814 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
815 glDisable (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
816 glDisable (GL_LINE_SMOOTH);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
817 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
818
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
819 // Clear background
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
820
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
821 if (c.numel () >= 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
822 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
823 glClearColor (c(0), c(1), c(2), 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
824 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
825 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
826
22494
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
827 GLenum gl_error = glGetError ();
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
828 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
829 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
830 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
831
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
832 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
833
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
834 octave_unused_parameter (enhanced);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
835 octave_unused_parameter (c);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
836
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
837 // 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
838 // 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
839
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
840 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
841
21689
9467549bd5ff * gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents: 21684
diff changeset
842 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
843 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
844
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
845 void
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
846 opengl_renderer::render_grid (const double linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
847 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
848 const Matrix& gridcolor, const double gridalpha,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
849 const Matrix& ticks, double lim1, double lim2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
850 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
851 int xyz, bool is_3D)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
852 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
853 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
854
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
855 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
856 set_linestyle (gridstyle, true, linewidth);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
857 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
858 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
859 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
860 double val = ticks(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
861 if (lim1 <= val && val <= lim2)
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 if (xyz == X_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
864 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
865 glVertex3d (val, p1N, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
866 glVertex3d (val, p1, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
867 if (is_3D)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
868 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
869 glVertex3d (val, p1, p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
870 glVertex3d (val, p1, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
871 }
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 else if (xyz == Y_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
874 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
875 glVertex3d (p1N, val, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
876 glVertex3d (p1, val, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
877 if (is_3D)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
878 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
879 glVertex3d (p1, val, p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
880 glVertex3d (p1, val, p2);
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
883 else if (xyz == Z_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
884 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
885 glVertex3d (p1N, p2, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
886 glVertex3d (p1, p2, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
887 glVertex3d (p1, p2N, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
888 glVertex3d (p1, p2, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
889 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
890 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
891 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
892 glEnd ();
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
893 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
894 double black[3] = {0, 0, 0};
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
895 glColor3dv (black);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
896
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
897 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
898
22500
1d3b71530539 fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents: 22494
diff changeset
899 octave_unused_parameter (linewidth);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
900 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
901 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
902 octave_unused_parameter (gridalpha);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
903 octave_unused_parameter (ticks);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
904 octave_unused_parameter (lim1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
905 octave_unused_parameter (lim2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
906 octave_unused_parameter (p1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
907 octave_unused_parameter (p1N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
908 octave_unused_parameter (p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
909 octave_unused_parameter (p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
910 octave_unused_parameter (xyz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
911 octave_unused_parameter (is_3D);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
912
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
913 // 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
914 // 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
915
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
916 panic_impossible ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
917
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
918 #endif
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
921 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
922 opengl_renderer::render_tickmarks (const Matrix& ticks,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
923 double lim1, double lim2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
924 double p1, double p1N,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
925 double p2, double p2N,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
926 double dx, double dy, double dz,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
927 int xyz, bool mirror)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
928 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
929 #if defined (HAVE_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
930
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
931 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
932
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
933 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
934 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
935 double val = ticks(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
936
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
937 if (lim1 <= val && val <= lim2)
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 if (xyz == X_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
940 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
941 glVertex3d (val, p1, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
942 glVertex3d (val, p1+dy, p2+dz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
943 if (mirror)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
944 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
945 glVertex3d (val, p1N, p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
946 glVertex3d (val, p1N-dy, p2N-dz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
947 }
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 else if (xyz == Y_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
950 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
951 glVertex3d (p1, val, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
952 glVertex3d (p1+dx, val, p2+dz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
953 if (mirror)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
954 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
955 glVertex3d (p1N, val, p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
956 glVertex3d (p1N-dx, val, p2N-dz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
957 }
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 else if (xyz == Z_AXIS)
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 glVertex3d (p1, p2, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
962 glVertex3d (p1+dx, p2+dy, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
963 if (mirror)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
964 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
965 glVertex3d (p1N, p2N, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
966 glVertex3d (p1N-dx, p2N-dy, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
967 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
968 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
969 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
970 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
971
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
972 glEnd ();
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
973
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
974 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
975
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
976 octave_unused_parameter (ticks);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
977 octave_unused_parameter (lim1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
978 octave_unused_parameter (lim2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
979 octave_unused_parameter (p1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
980 octave_unused_parameter (p1N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
981 octave_unused_parameter (p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
982 octave_unused_parameter (p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
983 octave_unused_parameter (dx);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
984 octave_unused_parameter (dy);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
985 octave_unused_parameter (dz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
986 octave_unused_parameter (xyz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
987 octave_unused_parameter (mirror);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
988
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
989 // 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
990 // 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
991
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
992 panic_impossible ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
993
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
994 #endif
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
997 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
998 opengl_renderer::render_ticktexts (const Matrix& ticks,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
999 const string_vector& ticklabels,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1000 double lim1, double lim2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1001 double p1, double p2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1002 int xyz, int ha, int va,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1003 int& wmax, int& hmax)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1004 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1005 #if defined (HAVE_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1006
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1007 int nticks = ticks.numel ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1008 int nlabels = ticklabels.numel ();
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 if (nlabels == 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1011 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1012
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1013 for (int i = 0; i < nticks; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1014 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1015 double val = ticks(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1016
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1017 if (lim1 <= val && val <= lim2)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1018 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1019 Matrix b;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1020
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1021 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
1022 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
1023 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
1024
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1025 // 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
1026 // drawn after axes object, for correct rendering?
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1027 if (xyz == X_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1028 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1029 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
1030 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1031 else if (xyz == Y_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1032 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1033 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
1034 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1035 else if (xyz == Z_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1036 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1037 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
1038 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1039
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1040 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
1041 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
1042 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1043 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1044
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1045 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1046
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1047 octave_unused_parameter (ticks);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1048 octave_unused_parameter (ticklabels);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1049 octave_unused_parameter (lim1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1050 octave_unused_parameter (lim2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1051 octave_unused_parameter (p1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1052 octave_unused_parameter (p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1053 octave_unused_parameter (xyz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1054 octave_unused_parameter (ha);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1055 octave_unused_parameter (va);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1056 octave_unused_parameter (wmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1057 octave_unused_parameter (hmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1058
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1059 // 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
1060 // 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
1061
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1062 panic_impossible ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1063
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1064 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1065 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1066
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1067 uint8NDArray
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1068 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
1069 {
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1070 #if defined (HAVE_OPENGL)
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1071
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1072 glPixelStorei (GL_PACK_ALIGNMENT, 1);
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1073 uint8NDArray pix(dim_vector (3, width, height), 0);
23562
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1074 glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE,
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1075 pix.fortran_vec ());
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1076
23562
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1077 // 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
1078 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
1079 perm(0) = 2;
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1080 perm(1) = 1;
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1081 perm(2) = 0;
23562
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1082
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1083 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
1084 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
1085 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
1086 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
1087
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1088 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
1089
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1090 #else
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1091
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1092 // This shouldn't happen because construction of opengl_renderer
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1093 // objects is supposed to be impossible if OpenGL is not available.
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1094
23562
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1095 octave_unused_parameter (width);
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1096 octave_unused_parameter (height);
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1097
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1098 panic_impossible ();
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1099
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1100 #endif
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1101 }
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23479
diff changeset
1102
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1103 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1104 opengl_renderer::finish (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1105 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1106 #if defined (HAVE_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1107
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1108 glFinish ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1109
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1110 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1111
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1112 // 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
1113 // 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
1114
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1115 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1116
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1117 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1118 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1119
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1120 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1121 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
1122 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1123 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1124
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1125 // setup OpenGL transformation
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1126
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1127 Matrix x_zlim = props.get_transform_zlim ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1128
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1129 xZ1 = x_zlim(0)-(x_zlim(1)-x_zlim(0))/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1130 xZ2 = x_zlim(1)+(x_zlim(1)-x_zlim(0))/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1131
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1132 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
1133 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
1134
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1135 #if defined (HAVE_FRAMEWORK_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1136 GLint vw[4];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1137 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1138 int vw[4];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1139 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1140
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1141 glGetIntegerv (GL_VIEWPORT, vw);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1142
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1143 glMatrixMode (GL_MODELVIEW);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1144 glLoadIdentity ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1145 glScaled (1, 1, -1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1146 glMultMatrixd (x_mat1.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1147 glMatrixMode (GL_PROJECTION);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1148 glLoadIdentity ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1149 glOrtho (0, vw[2], vw[3], 0, xZ1, xZ2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1150 glMultMatrixd (x_mat2.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1151 glMatrixMode (GL_MODELVIEW);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1152
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1153 glClear (GL_DEPTH_BUFFER_BIT);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1154
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1155 // store axes transformation data
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1156
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1157 xform = props.get_transform ();
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1158
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1159 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1160
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1161 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1162
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1163 // 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
1164 // 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
1165
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1166 panic_impossible ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1167
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1168 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1169 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1170
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1171 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1172 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
1173 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1174 #if defined (HAVE_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1175
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1176 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
1177 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
1178 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1179
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1180 double xPlane = props.get_xPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1181 double yPlane = props.get_yPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1182 double zPlane = props.get_zPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1183 double xPlaneN = props.get_xPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1184 double yPlaneN = props.get_yPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1185 double zPlaneN = props.get_zPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1186 bool is2d = props.get_is2D ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1187
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1188 // Axes planes
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1189 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
1190 set_polygon_offset (true, 9.0);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1191
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1192 glBegin (GL_QUADS);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1193
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1194 if (! is2d)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1195 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1196 // X plane
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1197 glVertex3d (xPlane, yPlaneN, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1198 glVertex3d (xPlane, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1199 glVertex3d (xPlane, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1200 glVertex3d (xPlane, yPlaneN, zPlane);
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 // Y plane
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1203 glVertex3d (xPlaneN, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1204 glVertex3d (xPlane, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1205 glVertex3d (xPlane, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1206 glVertex3d (xPlaneN, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1207 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1208
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1209 // Z plane
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1210 glVertex3d (xPlaneN, yPlaneN, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1211 glVertex3d (xPlane, yPlaneN, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1212 glVertex3d (xPlane, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1213 glVertex3d (xPlaneN, yPlane, zPlane);
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 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1216
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1217 set_polygon_offset (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1218
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1219 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1220
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1221 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1222
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1223 // 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
1224 // 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
1225
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1226 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1227
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1228 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1229 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1230
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1231 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1232 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
1233 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1234 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1235
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1236 if (! props.is_visible ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1237 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1238
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1239 bool xySym = props.get_xySym ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1240 bool layer2Dtop = props.get_layer2Dtop ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1241 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
1242 bool isXOrigin = props.xaxislocation_is ("origin")
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1243 && ! props.yscale_is ("log");
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1244 bool isYOrigin = props.yaxislocation_is ("origin")
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1245 && ! props.xscale_is ("log");
22363
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1246 bool boxFull = (props.get_boxstyle () == "full");
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1247 double linewidth = props.get_linewidth ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1248 double xPlane = props.get_xPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1249 double yPlane = props.get_yPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1250 double zPlane = props.get_zPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1251 double xPlaneN = props.get_xPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1252 double yPlaneN = props.get_yPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1253 double zPlaneN = props.get_zPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1254 double xpTick = props.get_xpTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1255 double ypTick = props.get_ypTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1256 double zpTick = props.get_zpTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1257 double xpTickN = props.get_xpTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1258 double ypTickN = props.get_ypTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1259 double zpTickN = props.get_zpTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1260
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1261 bool plotyy = (props.has_property ("__plotyy_axes__"));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1262
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1263 // Axes box
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1264
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1265 set_linestyle ("-", true, linewidth);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1266
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1267 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1268
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1269 if (layer2Dtop)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1270 std::swap (zpTick, zpTickN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1271
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1272 // X box
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1273 set_color (props.get_xcolor_rgb ());
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1274
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1275 if (! isXOrigin || props.is_box() || ! is2d)
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1276 {
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1277 glVertex3d (xPlaneN, ypTick, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1278 glVertex3d (xPlane, ypTick, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1279 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1280
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1281 if (props.is_box ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1282 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1283 glVertex3d (xPlaneN, ypTickN, zpTick);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1284 glVertex3d (xPlane, ypTickN, zpTick);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1285 if (! is2d)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1286 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1287 glVertex3d (xPlaneN, ypTickN, zpTickN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1288 glVertex3d (xPlane, ypTickN, zpTickN);
22363
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1289 if (boxFull)
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1290 {
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1291 glVertex3d (xPlaneN, ypTick, zpTickN);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1292 glVertex3d (xPlane, ypTick, zpTickN);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1293 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1294 }
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1297 // Y box
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1298 set_color (props.get_ycolor_rgb ());
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1299 if (! isYOrigin || props.is_box() || ! is2d)
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1300 {
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1301 glVertex3d (xpTick, yPlaneN, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1302 glVertex3d (xpTick, yPlane, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1303 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1304
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1305 if (props.is_box () && ! plotyy)
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 glVertex3d (xpTickN, yPlaneN, zpTick);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1308 glVertex3d (xpTickN, yPlane, zpTick);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1309
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1310 if (! is2d)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1311 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1312 glVertex3d (xpTickN, yPlaneN, zpTickN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1313 glVertex3d (xpTickN, yPlane, zpTickN);
22363
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1314 if (boxFull)
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1315 {
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1316 glVertex3d (xpTick, yPlaneN, zpTickN);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1317 glVertex3d (xpTick, yPlane, zpTickN);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1318 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1319 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1320 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1321
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1322 // Z box
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1323 if (! is2d)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1324 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1325 set_color (props.get_zcolor_rgb ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1326
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1327 if (xySym)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1328 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1329 glVertex3d (xPlaneN, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1330 glVertex3d (xPlaneN, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1331 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1332 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1333 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1334 glVertex3d (xPlane, yPlaneN, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1335 glVertex3d (xPlane, yPlaneN, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1336 }
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 if (props.is_box ())
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 glVertex3d (xPlane, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1341 glVertex3d (xPlane, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1342
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1343 if (xySym)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1344 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1345 glVertex3d (xPlane, yPlaneN, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1346 glVertex3d (xPlane, yPlaneN, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1347 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1348 else
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 glVertex3d (xPlaneN, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1351 glVertex3d (xPlaneN, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1352 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1353
22363
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1354 if (boxFull)
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1355 {
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1356 glVertex3d (xPlaneN, yPlaneN, zPlaneN);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1357 glVertex3d (xPlaneN, yPlaneN, zPlane);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1358 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1359 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1360 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1361
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1362 glEnd ();
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1363
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1364 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1365
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1366 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1367
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1368 // 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
1369 // 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
1370
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1371 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1372
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1373 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1374 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1375
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1376 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1377 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
1378 {
22740
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1379 #if defined (HAVE_OPENGL)
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1380
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1381 int xstate = props.get_xstate ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1382
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1383 if (xstate != AXE_DEPTH_DIR
24634
ab2321d4ba03 maint: strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
1384 && (props.is_visible ()
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1385 || (selecting && props.pickableparts_is ("all"))))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1386 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1387 int zstate = props.get_zstate ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1388 bool x2Dtop = props.get_x2Dtop ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1389 bool layer2Dtop = props.get_layer2Dtop ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1390 bool xyzSym = props.get_xyzSym ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1391 bool nearhoriz = props.get_nearhoriz ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1392 double xticklen = props.get_xticklen ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1393 double xtickoffset = props.get_xtickoffset ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1394 double fy = props.get_fy ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1395 double fz = props.get_fz ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1396 double x_min = props.get_x_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1397 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
1398 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
1399 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
1400 double yPlane = props.get_yPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1401 double yPlaneN = props.get_yPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1402 double ypTick = props.get_ypTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1403 double ypTickN = props.get_ypTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1404 double zPlane = props.get_zPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1405 double zPlaneN = props.get_zPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1406 double zpTick = props.get_zpTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1407 double zpTickN = props.get_zpTickN ();
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 // X grid
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1410
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1411 double linewidth = props.get_linewidth ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1412 std::string gridstyle = props.get_gridlinestyle ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1413 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
1414 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
1415 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
1416 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
1417 double minorgridalpha = props.get_minorgridalpha ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1418 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
1419 bool do_xminorgrid = (props.is_xminorgrid ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1420 && (minorgridstyle != "none"));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1421 bool do_xminortick = props.is_xminortick ();
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1422 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
1423 && ! props.yscale_is ("log");
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1424 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
1425 Matrix xticks = xform.xscale (props.get_xtick ().matrix_value ());
22623
76f1164d2135 Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents: 22622
diff changeset
1426 Matrix xmticks = xform.xscale (props.get_xminortickvalues ().matrix_value ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1427 string_vector xticklabels = props.get_xticklabel ().string_vector_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1428 int wmax = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1429 int hmax = 0;
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1430 bool tick_along_z = nearhoriz || math::isinf (fy);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1431 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
1432
22528
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1433 if (props.xcolormode_is ("manual"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1434 {
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1435 // use axis color for (minor)gridcolor
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1436 if (props.gridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1437 gridcolor = props.get_xcolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1438 if (props.minorgridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1439 minorgridcolor = props.get_xcolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1440 }
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1441
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
1442 // 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
1443 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
1444 {
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
1445 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
1446 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
1447 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
1448 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
1449 }
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
1450
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1451 // minor grid lines
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1452 if (do_xminorgrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1453 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1454 minorgridstyle, minorgridcolor, minorgridalpha,
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1455 xmticks, x_min, x_max,
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1456 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1457 0, (zstate != AXE_DEPTH_DIR));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1458
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1459 // grid lines
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1460 if (do_xgrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1461 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1462 gridstyle, gridcolor, gridalpha,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1463 xticks, x_min, x_max,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1464 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1465 0, (zstate != AXE_DEPTH_DIR));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1466
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1467 set_color (props.get_xcolor_rgb ());
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1468
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1469 // axis line
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1470 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
1471 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
1472 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1473 y_axis_pos = math::max (math::min (0., y_max),
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1474 y_min);
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1475 glBegin (GL_LINES);
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1476 set_color (props.get_ycolor_rgb ());
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1477 glVertex3d (x_min, y_axis_pos, zpTick);
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1478 glVertex3d (x_max, y_axis_pos, zpTick);
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1479 glEnd ();
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1480 }
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1481
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1482 // minor tick marks
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1483 if (do_xminortick)
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1484 {
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1485 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
1486 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
1487 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
1488 zpTick, zpTickN, 0., 0.,
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1489 (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
1490 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
1491 0, ! is_origin && mirror);
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1492 else
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1493 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
1494 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
1495 zpTick, zpTick, 0.,
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1496 (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
1497 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
1498 0., 0, ! is_origin && mirror);
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1499 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1500
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1501 // tick marks
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1502 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
1503 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
1504 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
1505 zpTick, zpTickN, 0., 0.,
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1506 (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
1507 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
1508 0, ! is_origin && mirror);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1509 else
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1510 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
1511 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
1512 zpTick, zpTick, 0.,
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1513 (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
1514 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
1515 0., 0, ! is_origin && mirror);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1516
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1517 // tick texts
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1518 if (xticklabels.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1519 {
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1520 int halign = (xstate == AXE_HORZ_DIR
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1521 ? 1
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1522 : (xyzSym || is_origin_low ? 0 : 2));
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1523 int valign = (xstate == AXE_VERT_DIR
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1524 ? 1
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1525 : (x2Dtop || is_origin_low ? 0 : 2));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1526
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1527 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
1528 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
1529 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
1530 zpTick +
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1531 (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
1532 math::signum (zpTick-zpTickN)*fz*xtickoffset,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1533 0, halign, valign, wmax, hmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1534 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1535 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
1536 (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
1537 (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
1538 math::signum (ypTick-ypTickN)*fy*xtickoffset,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1539 zpTick, 0, halign, valign, wmax, hmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1540 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1541
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1542 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
1543 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1544 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1545 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
1546
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1547 #else
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1548
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1549 octave_unused_parameter (props);
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1550
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1551 // 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
1552 // 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
1553
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1554 panic_impossible ();
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1555
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1556 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1557 }
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 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1560 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
1561 {
22740
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1562 #if defined (HAVE_OPENGL)
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1563
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1564 int ystate = props.get_ystate ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1565
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1566 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
1567 && (props.is_visible ()
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1568 || (selecting && props.pickableparts_is ("all"))))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1569 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1570 int zstate = props.get_zstate ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1571 bool y2Dright = props.get_y2Dright ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1572 bool layer2Dtop = props.get_layer2Dtop ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1573 bool xyzSym = props.get_xyzSym ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1574 bool nearhoriz = props.get_nearhoriz ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1575 double yticklen = props.get_yticklen ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1576 double ytickoffset = props.get_ytickoffset ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1577 double fx = props.get_fx ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1578 double fz = props.get_fz ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1579 double xPlane = props.get_xPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1580 double xPlaneN = props.get_xPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1581 double xpTick = props.get_xpTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1582 double xpTickN = props.get_xpTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1583 double y_min = props.get_y_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1584 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
1585 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
1586 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
1587 double zPlane = props.get_zPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1588 double zPlaneN = props.get_zPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1589 double zpTick = props.get_zpTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1590 double zpTickN = props.get_zpTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1591
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1592 // Y grid
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1593
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1594 double linewidth = props.get_linewidth ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1595 std::string gridstyle = props.get_gridlinestyle ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1596 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
1597 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
1598 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
1599 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
1600 double minorgridalpha = props.get_minorgridalpha ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1601 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
1602 bool do_yminorgrid = (props.is_yminorgrid ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1603 && (minorgridstyle != "none"));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1604 bool do_yminortick = props.is_yminortick ();
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1605 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
1606 && ! props.xscale_is ("log");
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1607 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
1608 Matrix yticks = xform.yscale (props.get_ytick ().matrix_value ());
22623
76f1164d2135 Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents: 22622
diff changeset
1609 Matrix ymticks = xform.yscale (props.get_yminortickvalues ().matrix_value ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1610 string_vector yticklabels = props.get_yticklabel ().string_vector_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1611 int wmax = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1612 int hmax = 0;
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1613 bool tick_along_z = nearhoriz || math::isinf (fx);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1614 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
1615 && (! props.has_property ("__plotyy_axes__"));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1616
22528
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1617 if (props.ycolormode_is ("manual"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1618 {
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1619 // use axis color for (minor)gridcolor
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1620 if (props.gridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1621 gridcolor = props.get_ycolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1622 if (props.minorgridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1623 minorgridcolor = props.get_ycolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1624 }
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1625
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
1626 // 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
1627 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
1628 {
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
1629 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
1630 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
1631 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
1632 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
1633 }
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
1634
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1635 // minor grid lines
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1636 if (do_yminorgrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1637 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1638 minorgridstyle, minorgridcolor, minorgridalpha,
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1639 ymticks, y_min, y_max,
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1640 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1641 1, (zstate != AXE_DEPTH_DIR));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1642
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1643 // grid lines
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1644 if (do_ygrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1645 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1646 gridstyle, gridcolor, gridalpha,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1647 yticks, y_min, y_max,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1648 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1649 1, (zstate != AXE_DEPTH_DIR));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1650
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1651 set_color (props.get_ycolor_rgb ());
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1652
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1653 // axis line
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1654 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
1655 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
1656 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1657 x_axis_pos = math::max (math::min (0., x_max),
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1658 x_min);
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1659 glBegin (GL_LINES);
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1660 set_color (props.get_ycolor_rgb ());
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1661 glVertex3d (x_axis_pos, y_min, zpTick);
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1662 glVertex3d (x_axis_pos, y_max, zpTick);
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1663 glEnd ();
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1664 }
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1665
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1666 // minor tick marks
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1667 if (do_yminortick)
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1668 {
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1669 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
1670 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
1671 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
1672 zpTick, zpTickN, 0., 0.,
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1673 (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
1674 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
1675 1, ! is_origin && mirror);
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1676 else
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1677 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
1678 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
1679 zpTick, zpTick,
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1680 (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
1681 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
1682 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
1683 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1684
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1685 // tick marks
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1686 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
1687 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
1688 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
1689 zpTick, zpTickN, 0., 0.,
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1690 (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
1691 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
1692 1, ! is_origin && mirror);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1693 else
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1694 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
1695 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
1696 zpTick, zpTick,
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1697 (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
1698 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
1699 0., 0., 1, ! is_origin && mirror);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1700
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1701 // tick texts
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1702 if (yticklabels.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1703 {
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1704 int halign = (ystate == AXE_HORZ_DIR
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1705 ? 1
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1706 : (! 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
1707 int valign = (ystate == AXE_VERT_DIR
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1708 ? 1
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
1709 : (is_origin_low ? 0 : 2));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1710
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1711 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
1712 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
1713 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
1714 zpTick +
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1715 (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
1716 math::signum (zpTick-zpTickN)*fz*ytickoffset,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1717 1, halign, valign, wmax, hmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1718 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1719 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
1720 (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
1721 (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
1722 math::signum (xpTick-xpTickN)*fx*ytickoffset,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1723 zpTick, 1, halign, valign, wmax, hmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1724 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1725
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1726 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
1727 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1728 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1729 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
1730
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1731 #else
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1732
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1733 octave_unused_parameter (props);
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1734
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1735 // 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
1736 // 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
1737
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1738 panic_impossible ();
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1739
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1740 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1741 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1742
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1743 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1744 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
1745 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1746 int zstate = props.get_zstate ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1747
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1748 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
1749 && (props.is_visible ()
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1750 || (selecting && props.pickableparts_is ("all"))))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1751 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1752 bool xySym = props.get_xySym ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1753 bool zSign = props.get_zSign ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1754 double zticklen = props.get_zticklen ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1755 double ztickoffset = props.get_ztickoffset ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1756 double fx = props.get_fx ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1757 double fy = props.get_fy ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1758 double xPlane = props.get_xPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1759 double xPlaneN = props.get_xPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1760 double yPlane = props.get_yPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1761 double yPlaneN = props.get_yPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1762 double z_min = props.get_z_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1763 double z_max = props.get_z_max ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1764
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1765 // Z Grid
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1766
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1767 double linewidth = props.get_linewidth ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1768 std::string gridstyle = props.get_gridlinestyle ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1769 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
1770 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
1771 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
1772 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
1773 double minorgridalpha = props.get_minorgridalpha ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1774 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
1775 bool do_zminorgrid = (props.is_zminorgrid ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1776 && (minorgridstyle != "none"));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1777 bool do_zminortick = props.is_zminortick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1778 Matrix zticks = xform.zscale (props.get_ztick ().matrix_value ());
22623
76f1164d2135 Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents: 22622
diff changeset
1779 Matrix zmticks = xform.zscale (props.get_zminortickvalues ().matrix_value ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1780 string_vector zticklabels = props.get_zticklabel ().string_vector_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1781 int wmax = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1782 int hmax = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1783 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
1784
22528
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1785 if (props.zcolormode_is ("manual"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1786 {
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1787 // use axis color for (minor)gridcolor
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1788 if (props.gridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1789 gridcolor = props.get_zcolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1790 if (props.minorgridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1791 minorgridcolor = props.get_zcolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1792 }
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1793
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
1794 // 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
1795 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
1796 {
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
1797 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
1798 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
1799 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
1800 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
1801 }
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
1802
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1803 // minor grid lines
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1804 if (do_zminorgrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1805 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1806 minorgridstyle, minorgridcolor, minorgridalpha,
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1807 zmticks, z_min, z_max,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1808 xPlane, xPlaneN, yPlane, yPlaneN, 2, true);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1809
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1810 // grid lines
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1811 if (do_zgrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1812 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1813 gridstyle, gridcolor, gridalpha,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1814 zticks, z_min, z_max,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1815 xPlane, xPlaneN, yPlane, yPlaneN, 2, true);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1816
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1817 set_color (props.get_zcolor_rgb ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1818
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1819 // minor tick marks
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1820 if (do_zminortick)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1821 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1822 if (xySym)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1823 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1824 if (math::isinf (fy))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1825 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
1826 yPlane, yPlane,
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1827 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
1828 0., 0., 2, mirror);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1829 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1830 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
1831 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
1832 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
1833 0., 2, false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1834 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1835 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1836 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1837 if (math::isinf (fx))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1838 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
1839 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
1840 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
1841 0., 2, mirror);
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 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
1844 yPlaneN, yPlaneN,
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1845 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
1846 0., 0., 2, false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1847 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1848 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1849
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1850 // tick marks
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1851 if (xySym)
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1852 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1853 if (math::isinf (fy))
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1854 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
1855 yPlane, yPlane,
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1856 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
1857 0., 0., 2, mirror);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1858 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1859 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
1860 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
1861 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
1862 0., 2, false);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1863 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1864 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1865 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1866 if (math::isinf (fx))
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1867 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
1868 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
1869 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
1870 0., 2, mirror);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1871 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1872 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
1873 yPlaneN, yPlane,
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1874 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
1875 0., 0., 2, false);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1876 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1877
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1878 // tick texts
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1879 if (zticklabels.numel () > 0)
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1880 {
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1881 int halign = 2;
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1882 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
1883
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1884 if (xySym)
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1885 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1886 if (math::isinf (fy))
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1887 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
1888 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
1889 yPlane, 2, halign, valign, wmax, hmax);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1890 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1891 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
1892 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
1893 2, halign, valign, wmax, hmax);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1894 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1895 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1896 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
1897 if (math::isinf (fx))
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1898 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
1899 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
1900 2, halign, valign, wmax, hmax);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1901 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1902 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
1903 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
1904 yPlaneN, 2, halign, valign, wmax, hmax);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1905 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1906 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1907
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1908 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
1909 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1910 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1911 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
1912 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1913
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1914 void
23546
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1915 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
1916 {
23562
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1917 #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
1918 // 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
1919 GLboolean antialias;
23562
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1920
23546
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1921 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
1922
23546
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1923 if (antialias == GL_TRUE)
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1924 glDisable (GL_LINE_SMOOTH);
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1925
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1926 set_linecap ("square");
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1927 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
1928 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
1929 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
1930
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1931 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
1932 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
1933 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
1934
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1935 if (antialias == GL_TRUE)
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1936 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
1937 #else
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1938
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1939 octave_unused_parameter (props);
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1940
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1941 // 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
1942 // 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
1943
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1944 panic_impossible ();
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1945
35ee7e8fb33b * gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents: 23546
diff changeset
1946 #endif
23546
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1947 }
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1948
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
1949 void
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
1950 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
1951 std::list<graphics_object>& obj_list)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1952 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1953 #if defined (HAVE_OPENGL)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1954 Matrix children = props.get_all_children ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1955
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1956 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
1957 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1958 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
1959
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1960 base_properties p = go.get_properties ();
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1961
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1962 if (p.is_visible ()
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1963 || (selecting && p.pickableparts_is ("all")))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1964 {
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1965 if (go.isa ("light") && ! selecting)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1966 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1967 if (num_lights < max_lights)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1968 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1969 current_light = GL_LIGHT0 + num_lights;
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1970 set_clipping (p.is_clipping ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1971 draw (go);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1972 num_lights++;
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 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1975 warning_with_id ("Octave:max-lights-exceeded",
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1976 "light: Maximum number of lights (%d) in these axes is "
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1977 "exceeded.", max_lights);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1978 }
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1979 else if (go.isa ("hggroup")
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
1980 && ! (selecting && p.pickableparts_is ("none")))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1981 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
1982 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
1983 obj_list.push_back (go);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1984 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1985 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1986 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1987
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1988 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1989 octave_unused_parameter (obj_list);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1990
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1991 // 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
1992 // 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
1993
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1994 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1995
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1996 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1997 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1998
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1999 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2000 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
2001 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2002 #if defined (HAVE_OPENGL)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2003 // list for non-light child objects
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2004 std::list<graphics_object> obj_list;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2005 std::list<graphics_object>::iterator it;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2006
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2007 // 1st pass: draw light objects
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2008
22349
2aac9ec7df29 Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22348
diff changeset
2009 // 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
2010 // 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
2011 // 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
2012 // 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
2013 // Check actual maximum number of lights possible
2aac9ec7df29 Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22348
diff changeset
2014 max_lights = get_maxlights ();
2aac9ec7df29 Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22348
diff changeset
2015
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2016 // 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
2017 // 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
2018
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2019 num_lights = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2020 draw_all_lights (props, obj_list);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2021
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2022 // disable other OpenGL lights
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2023 for (int i = num_lights; i < max_lights; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2024 glDisable (GL_LIGHT0 + i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2025
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2026 // 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
2027 // other objects
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2028 view_vector = props.get_cameraposition ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2029
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2030 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
2031 ColumnVector ambient_color = props.get_ambientlightcolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2032 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2033 cb[i] = ambient_color(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2034 glLightfv (GL_LIGHT0, GL_AMBIENT, cb);
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 // 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
2037
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2038 it = obj_list.begin ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2039 while (it != obj_list.end ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2040 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2041 graphics_object go = (*it);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2042
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2043 // 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
2044 // to "data"
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2045 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
2046 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2047 set_clipping (go.get_properties ().is_clipping ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2048 draw (go);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2049
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2050 it = obj_list.erase (it);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2051 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2052 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2053 it++;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2054 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2055
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2056 // 3rd pass: draw remaining objects
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2057
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2058 glDisable (GL_DEPTH_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2059
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2060 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
2061 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2062 graphics_object go = (*it);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2063
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2064 set_clipping (go.get_properties ().is_clipping ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2065 draw (go);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2066 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2067
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2068 set_clipping (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2069
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2070 // FIXME: finalize rendering (transparency processing)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2071 // 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
2072
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2073 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
2074
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2075 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2076
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2077 // 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
2078 // 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
2079
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2080 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
2081
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2082 #endif
22331
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2085 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2086 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
2087 {
22258
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
2088 #if defined (HAVE_OPENGL)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2089
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2090 // 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
2091 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
2092 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2093
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2094 // 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
2095 // pickable parts is "none".
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2096 if (selecting && props.pickableparts_is ("none"))
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2097 return;
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2098
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2099 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
2100
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2101 double x_min = props.get_x_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2102 double x_max = props.get_x_max ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2103 double y_min = props.get_y_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2104 double y_max = props.get_y_max ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2105 double z_min = props.get_z_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2106 double z_max = props.get_z_max ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2107
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2108 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
2109 || 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
2110 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2111 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
2112 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2113 }
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 setup_opengl_transformation (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2116
23863
56b7352fa456 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23859
diff changeset
2117 // 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
2118 // depth sorting
7148b237f94f Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23807
diff changeset
2119 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
2120 if (is2D)
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
2121 glDisable (GL_DEPTH_TEST);
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
2122 else
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
2123 glEnable (GL_DEPTH_TEST);
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
2124
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2125 draw_axes_planes (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2126
23546
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
2127 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
2128 {
857b553177a5 Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24173
diff changeset
2129 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
2130 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
2131 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
2132 }
22357
8f23b5b23235 Avoid grid overlaying axes box (bug #48842)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22349
diff changeset
2133
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
2134 set_linestyle ("-"); // Disable LineStipple
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2135
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2136 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
2137
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2138 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
2139
23546
06805aabbdd1 Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23535
diff changeset
2140 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
2141 {
857b553177a5 Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24173
diff changeset
2142 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
2143 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
2144 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
2145 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2146
22258
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
2147 #else
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
2148
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2149 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2150
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2151 // 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
2152 // 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
2153
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2154 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
2155
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
2156 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2157 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2158
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2159 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2160 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
2161 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2162 #if defined (HAVE_OPENGL)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2163
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2164 bool draw_all = selecting && props.pickableparts_is ("all");
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2165
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2166 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
2167 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
2168 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
2169
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2170 bool has_z = (z.numel () > 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2171 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
2172 (has_z ? z.numel ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2173 : std::numeric_limits<int>::max ())));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2174 octave_uint8 clip_mask = (props.is_clipping () ? 0x7F : 0x40), clip_ok (0x40);
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 std::vector<octave_uint8> clip (n);
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 if (has_z)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2179 for (int i = 0; i < n; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2180 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
2181 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2182 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2183 double z_mid = (zmin+zmax)/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2184
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2185 for (int i = 0; i < n; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2186 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
2187 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2188
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2189 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
2190 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2191 set_color (props.get_color_rgb ());
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
2192 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
2193 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
2194 set_linecap ("butt");
22759
39f39eb4e476 Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
2195 set_linejoin (props.get_linejoin ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2196
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2197 if (has_z)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2198 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2199 bool flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2200
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2201 for (int i = 1; i < n; i++)
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 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
2204 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2205 if (! flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2206 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2207 flag = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2208 glBegin (GL_LINE_STRIP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2209 glVertex3d (x(i-1), y(i-1), z(i-1));
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 glVertex3d (x(i), y(i), z(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2212 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2213 else if (flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2214 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2215 flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2216 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2217 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2218 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2219
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2220 if (flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2221 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2222 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2223 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2224 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2225 bool flag = false;
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 for (int i = 1; i < n; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2228 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2229 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
2230 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2231 if (! flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2232 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2233 flag = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2234 glBegin (GL_LINE_STRIP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2235 glVertex2d (x(i-1), y(i-1));
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 glVertex2d (x(i), y(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2238 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2239 else if (flag)
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 flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2242 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2243 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2244 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2245
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2246 if (flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2247 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2248 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2249
22358
dc73bbd66363 Make sure all lines associated with axes respect axes linewidth property.
Rik <rik@octave.org>
parents: 22357
diff changeset
2250 set_linewidth (0.5f);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2251 set_linestyle ("-");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2252 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2253
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2254 set_clipping (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2255
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2256 if (! props.marker_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2257 && ! (props.markeredgecolor_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2258 && props.markerfacecolor_is ("none")))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2259 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2260 Matrix lc, fc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2261
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2262 if (draw_all)
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2263 lc = Matrix (1, 3, 0.0);
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2264 else if (props.markeredgecolor_is ("auto"))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2265 lc = props.get_color_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2266 else if (! props.markeredgecolor_is ("none"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2267 lc = props.get_markeredgecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2268
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2269 if (draw_all)
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2270 fc = Matrix (1, 3, 0.0);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2271 if (props.markerfacecolor_is ("auto"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2272 fc = props.get_color_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2273 else if (! props.markerfacecolor_is ("none"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2274 fc = props.get_markerfacecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2275
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2276 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
2277 props.get_linewidth ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2278
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2279 for (int i = 0; i < n; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2280 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2281 if (clip[i] == clip_ok)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2282 draw_marker (x(i), y(i),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2283 has_z ? z(i) : 0.0,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2284 lc, fc);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2285 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2286
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2287 end_marker ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2288 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2289
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2290 set_clipping (props.is_clipping ());
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2291
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2292 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
2293
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2294 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2295
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2296 // 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
2297 // 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
2298
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2299 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
2300
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2301 #endif
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2304 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2305 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
2306 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2307 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2308
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2309 bool draw_all = selecting && props.pickableparts_is ("all");
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2310
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2311 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
2312 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
2313 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
2314
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2315 int zr = z.rows ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2316 int zc = z.columns ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2317
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2318 NDArray c;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2319 const NDArray n = props.get_vertexnormals ().array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2320
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2321 // FIXME: handle transparency
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2322 Matrix a;
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 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
2325 (props.facecolor_is ("flat") ? 1 :
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2326 (props.facecolor_is ("interp") ? 2 :
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2327 (props.facecolor_is ("texturemap") ? 3 : -1))));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2328 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
2329 (props.facelighting_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2330 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
2331 (props.facealpha_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2332 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
2333 (props.edgecolor_is ("flat") ? 1 :
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2334 (props.edgecolor_is ("interp") ? 2 : -1)));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2335 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
2336 (props.edgelighting_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2337 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
2338 (props.edgealpha_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2339 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
2340 (props.backfacelighting_is ("reverselit") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2341
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2342 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
2343 : props.get_facecolor_rgb ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2344 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
2345 double fa = 1.0;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2346
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2347 float as = props.get_ambientstrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2348 float ds = props.get_diffusestrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2349 float ss = props.get_specularstrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2350 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
2351 float scr = props.get_specularcolorreflectance ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2352 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
2353
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2354 opengl_texture tex;
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 int i1, i2, j1, j2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2357 bool x_mat = (x.rows () == z.rows ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2358 bool y_mat = (y.columns () == z.columns ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2359
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2360 i1 = i2 = j1 = j2 = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2361
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2362 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
2363 c = props.get_color_data ().array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2364
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2365 boolMatrix clip (z.dims (), false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2366
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2367 for (int i = 0; i < zr; i++)
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 if (x_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2370 i1 = i;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2371
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2372 for (int j = 0; j < zc; j++)
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 if (y_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2375 j1 = j;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2376
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2377 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
2378 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2379 }
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 (fa_mode > 0 || ea_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2382 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2383 // FIXME: implement alphadata conversion
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2384 //a = props.get_alpha_data ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2385 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2386
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2387 if (fl_mode > 0 || el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2388 glMaterialf (LIGHT_MODE, GL_SHININESS, se);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2389
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2390 // FIXME: good candidate for caching,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2391 // 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
2392 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2393 tex = opengl_texture::create (props.get_color_data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2394
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2395 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
2396 {
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
2397 if (fa_mode == 0)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2398 {
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
2399 fa = props.get_facealpha_double ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2400 if (fc_mode == UNIFORM || fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2401 {
24183
cbb3e02244a4 Fix regression introduced by cset 78ff6ba5cbb1 (bug #52293).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24178
diff changeset
2402 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
2403 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2404 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2405 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2406 cb[i] = as * fcolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2407 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2408
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2409 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2410 cb[i] = ds * fcolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2411 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2412
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2413 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2414 cb[i] = ss * (scr + (1-scr) * fcolor(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2415 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2416 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2417 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2418
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2419 if ((fl_mode > 0) && (num_lights > 0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2420 glEnable (GL_LIGHTING);
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
2421 glShadeModel ((fc_mode == INTERP || fl_mode == GOURAUD)
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
2422 ? 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
2423 set_polygon_offset (true, 1.0);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2424 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2425 glEnable (GL_TEXTURE_2D);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2426
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2427 for (int i = 1; i < zc; i++)
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 if (y_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2430 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2431 i1 = i-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2432 i2 = i;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2433 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2434
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2435 for (int j = 1; j < zr; j++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2436 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2437
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2438 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
2439 || clip(j-1, i) || clip(j, i))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2440 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2441
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2442 if (fc_mode == FLAT)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2443 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2444 // "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
2445 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
2446 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2447 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2448 else if (fc_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2449 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2450 // "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
2451 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
2452 && 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
2453 continue;
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2456 if (x_mat)
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 j1 = j-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2459 j2 = j;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2460 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2461
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2462 glBegin (GL_QUADS);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2463
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2464 // Vertex 1
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2465 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2466 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
2467 double (j-1) / (zr-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2468 else if (fc_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2469 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2470 // 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
2471 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2472 cb[k] = c(j-1, i-1, k);
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
2473 cb[3] = 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
2474 glColor4fv (cb);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2475
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2476 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2477 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2478 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2479 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2480 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2481
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2482 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2483 cb[k] = ds * c(j-1, i-1, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2484 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2487 cb[k] = ss * (scr + (1-scr) * c(j-1, i-1, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2488 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2489 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2490 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2491 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2492 set_normal (bfl_mode, n, j-1, i-1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2493
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2494 glVertex3d (x(j1,i-1), y(j-1,i1), z(j-1,i-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2495
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2496 // Vertex 2
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2497 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2498 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
2499 else if (fc_mode == INTERP)
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2502 cb[k] = c(j-1, i, k);
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
2503 cb[3] = 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
2504 glColor4fv (cb);
22331
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 if (fl_mode > 0)
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2509 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2510 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2511
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2512 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2513 cb[k] = ds * c(j-1, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2514 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2517 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2518 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
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 }
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 if (fl_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2523 set_normal (bfl_mode, n, j-1, i);
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 glVertex3d (x(j1,i), y(j-1,i2), z(j-1,i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2526
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2527 // Vertex 3
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2528 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2529 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
2530 else if (fc_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2531 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2532 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2533 cb[k] = c(j, i, k);
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
2534 cb[3] = 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
2535 glColor4fv (cb);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2536
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2537 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2538 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2539 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2540 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2541 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2542
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2543 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2544 cb[k] = ds * c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2545 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2546
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2547 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2548 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2549 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2550 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2551 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2552 if (fl_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2553 set_normal (bfl_mode, n, j, i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2554
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2555 glVertex3d (x(j2,i), y(j,i2), z(j,i));
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 // Vertex 4
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2558 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2559 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
2560 else if (fc_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2561 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2562 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2563 cb[k] = c(j, i-1, k);
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
2564 cb[3] = 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
2565 glColor4fv (cb);
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 if (fl_mode > 0)
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2570 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2571 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2572
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2573 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2574 cb[k] = ds * c(j, i-1, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2575 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2578 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2579 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2580 }
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 (fl_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2583 set_normal (bfl_mode, n, j, i-1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2584
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2585 glVertex3d (x(j2,i-1), y(j,i1), z(j,i-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2586
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2587 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2588 }
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2591 set_polygon_offset (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2592 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2593 glDisable (GL_TEXTURE_2D);
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 if ((fl_mode > 0) && (num_lights > 0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2596 glDisable (GL_LIGHTING);
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 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2599 {
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
2600 // 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
2601 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2602 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2603
22391
c5da5e5e9846 Fix inconsistent on-screen/printout patch and surface edges (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22369
diff changeset
2604 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
2605 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2606 if (props.get_edgealpha_double () == 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2607 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2608 if (ec_mode == UNIFORM)
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 glColor3dv (ecolor.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2611 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2612 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2613 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2614 cb[i] = as * ecolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2615 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
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 i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2618 cb[i] = ds * ecolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2619 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
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 i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2622 cb[i] = ss * (scr + (1-scr) * ecolor(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2623 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2626
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2627 if ((el_mode > 0) && (num_lights > 0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2628 glEnable (GL_LIGHTING);
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
2629 glShadeModel ((ec_mode == INTERP || el_mode == GOURAUD)
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23446
diff changeset
2630 ? GL_SMOOTH : GL_FLAT);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2631
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
2632 set_linestyle (props.get_linestyle (), false,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
2633 props.get_linewidth ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2634 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
2635 set_linecap ("butt");
22759
39f39eb4e476 Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
2636 set_linejoin ("miter");
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2637
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2638 // Mesh along Y-axis
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2639
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2640 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
2641 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2642 for (int i = 0; i < zc; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2643 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2644 if (y_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2645 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2646 i1 = i-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2647 i2 = i;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2648 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2649
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2650 for (int j = 1; j < zr; j++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2651 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2652 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
2653 continue;
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 if (ec_mode == FLAT)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2656 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2657 // "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
2658 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
2659 continue;
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 else if (ec_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2662 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2663 // "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
2664 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
2665 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2666 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2667
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2668 if (x_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2669 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2670 j1 = j-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2671 j2 = j;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2672 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2673
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2674 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2675
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2676 // Vertex 1
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2677 if (ec_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2678 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2679 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2680 cb[k] = c(j-1, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2681 glColor3fv (cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2682
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2683 if (el_mode > 0)
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] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2687 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2690 cb[k] = ds * c(j-1, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2691 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2692
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2693 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2694 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2695 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2696 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2697 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2698 if (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2699 set_normal (bfl_mode, n, j-1, i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2700
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2701 glVertex3d (x(j1,i), y(j-1,i2), z(j-1,i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2702
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2703 // Vertex 2
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2704 if (ec_mode == INTERP)
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] = c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2708 glColor3fv (cb);
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 if (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2711 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2712 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2713 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2714 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2715
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2716 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2717 cb[k] = ds * c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2718 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2719
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2720 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2721 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2722 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2723 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2724 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2725 if (el_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2726 set_normal (bfl_mode, n, j, i);
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 glVertex3d (x(j2,i), y(j,i2), z(j,i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2729
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2730 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2731 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2732 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2733 }
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 // Mesh along X-axis
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2736
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2737 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
2738 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2739 for (int j = 0; j < zr; j++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2740 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2741 if (x_mat)
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 j1 = j-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2744 j2 = j;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2745 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2746
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2747 for (int i = 1; i < zc; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2748 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2749 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
2750 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2751
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2752 if (ec_mode == FLAT)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2753 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2754 // "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
2755 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
2756 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2757 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2758 else if (ec_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2759 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2760 // "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
2761 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
2762 continue;
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2765 if (y_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2766 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2767 i1 = i-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2768 i2 = i;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2769 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2770
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2771 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2772
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2773 // Vertex 1
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2774 if (ec_mode > 0)
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2777 cb[k] = c(j, i-1, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2778 glColor3fv (cb);
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 if (el_mode > 0)
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2783 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2784 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2785
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2786 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2787 cb[k] = ds * c(j, i-1, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2788 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2791 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2792 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2793 }
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 if (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2796 set_normal (bfl_mode, n, j, i-1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2797
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2798 glVertex3d (x(j2,i-1), y(j,i1), z(j,i-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2799
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2800 // Vertex 2
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2801 if (ec_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2802 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2803 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2804 cb[k] = c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2805 glColor3fv (cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2806
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2807 if (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2808 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2809 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2810 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2811 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2812
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2813 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2814 cb[k] = ds * c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2815 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
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] = ss * (scr + (1-scr) * c(j, i, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2819 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2822 if (el_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2823 set_normal (bfl_mode, n, j, i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2824
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2825 glVertex3d (x(j2,i), y(j,i2), z(j,i));
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 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2828 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2829 }
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
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
2832 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
2833 set_linewidth (0.5f);
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 if ((el_mode > 0) && (num_lights > 0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2836 glDisable (GL_LIGHTING);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2837 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2838 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2839 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2840 // FIXME: implement transparency
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2841 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2842 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2843
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2844 if (! props.marker_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2845 && ! (props.markeredgecolor_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2846 && props.markerfacecolor_is ("none")))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2847 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2848 // 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
2849 // 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
2850 // and facecolor set to none.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2851
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2852 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
2853 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
2854
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2855 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
2856 props.get_markeredgecolor_rgb ());
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2857 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
2858 props.get_markerfacecolor_rgb ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2859 Matrix cc (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2860
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
2861 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
2862 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2863 mecolor = props.get_edgecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2864 do_edge = ! props.edgecolor_is ("none");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2865 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2866
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
2867 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
2868 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2869 mfcolor = props.get_facecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2870 do_face = ! props.facecolor_is ("none");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2871 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2872
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
2873 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
2874 c = props.get_color_data ().array_value ();
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 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
2877 props.get_linewidth ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2878
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2879 for (int i = 0; i < zc; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2880 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2881 if (y_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2882 i1 = i;
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 for (int j = 0; j < zr; j++)
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 if (clip(j,i))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2887 continue;
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 if (x_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2890 j1 = j;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2891
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
2892 if ((do_edge && mecolor.isempty ())
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
2893 || (do_face && mfcolor.isempty ()))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2894 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
2895 if (! math::isfinite (c(j,i)))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2896 continue; // Skip NaNs in color data
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2897
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2898 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2899 cc(k) = c(j,i,k);
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
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
2902 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
2903 : Matrix ());
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
2904 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
2905 : Matrix ());
22331
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 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
2908 }
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2911 end_marker ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2912 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2913
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2914 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
2915
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2916 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2917
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2918 // 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
2919 // 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
2920
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2921 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
2922
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2923 #endif
22331
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2926 // FIXME: global optimization (rendering, data structures...),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2927 // 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
2928 void
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23396
diff changeset
2929 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
2930 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2931 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2932
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2933 // 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
2934 std::string msg;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2935 if (props.has_bad_data (msg))
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 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
2938 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2939 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2940
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2941 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
2942 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
2943 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
2944 Matrix c;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2945 const Matrix n = props.get_vertexnormals ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2946 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
2947 double fa = 1.0;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2948
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2949 int nv = v.rows ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2950 int nf = f.rows ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2951 int fcmax = f.columns ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2952
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2953 bool has_z = (v.columns () > 2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2954 bool has_facecolor = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2955 bool has_facealpha = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2956 // FIXME: remove when patch object has normal computation (patch #8951)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2957 bool has_normals = (n.rows () == nv);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2958
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2959 int fc_mode = ((props.facecolor_is ("none")
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
2960 || 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
2961 (props.facecolor_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2962 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
2963 (props.facelighting_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2964 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
2965 (props.facealpha_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2966 int ec_mode = ((props.edgecolor_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2967 || props.edgecolor_is_rgb ()) ? 0 :
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2968 (props.edgecolor_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2969 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
2970 (props.edgelighting_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2971 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
2972 (props.edgealpha_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2973 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
2974 (props.backfacelighting_is ("reverselit") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2975
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2976 Matrix fcolor = props.get_facecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2977 Matrix ecolor = props.get_edgecolor_rgb ();
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 float as = props.get_ambientstrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2980 float ds = props.get_diffusestrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2981 float ss = props.get_specularstrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2982 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
2983 float scr = props.get_specularcolorreflectance ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2984
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2985 boolMatrix clip (1, nv, false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2986
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2987 if (has_z)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2988 for (int i = 0; i < nv; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2989 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
2990 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2991 for (int i = 0; i < nv; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2992 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
2993
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2994 boolMatrix clip_f (1, nf, false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2995 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
2996
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2997 for (int i = 0; i < nf; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2998 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2999 bool fclip = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3000 int count = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3001
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
3002 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
3003 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
3004
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3005 clip_f(i) = fclip;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3006 count_f(i) = count;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3007 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3008
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3009 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
3010 {
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3011 if (draw_all)
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3012 c = Matrix (1, 3, 0.0);
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3013 else
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3014 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
3015
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3016 if (c.rows () == 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3017 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3018 // 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
3019
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3020 if (draw_all || fc_mode > 0)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3021 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3022 fcolor = c;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3023 fc_mode = UNIFORM;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3024 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3025
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3026 if (draw_all || ec_mode > 0)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3027 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3028 ecolor = c;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3029 ec_mode = UNIFORM;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3030 }
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 c = Matrix ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3033 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3034 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3035 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
3036 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3037
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3038 if (fa_mode > 0 || ea_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3039 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3040 // FIXME: retrieve alpha data from patch object
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3041 //a = props.get_alpha_data ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3042 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
3043 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3044
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
3045 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
3046 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
3047
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3048 octave_idx_type fr = f.rows ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3049 std::vector<vertex_data> vdata (f.numel ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3050
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3051 for (int i = 0; i < nf; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3052 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
3053 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3054 int idx = int (f(i,j) - 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3055
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3056 Matrix vv (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3057 Matrix cc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3058 Matrix nn (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3059 double aa = 1.0;
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 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
3062 if (has_z)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3063 vv(2) = v(idx,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3064 if (has_normals)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
3065 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3066 double dir = 1.0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3067 if (bfl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3068 dir = ((n(idx,0) * view_vector(0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3069 + n(idx,1) * view_vector(1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3070 + n(idx,2) * view_vector(2) < 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3071 ? ((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
3072 nn(0) = dir * n(idx,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3073 nn(1) = dir * n(idx,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3074 nn(2) = dir * n(idx,2);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
3075 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3076 if (c.numel () > 0)
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 cc.resize (1, 3);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3079 if (has_facecolor)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3080 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
3081 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3082 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
3083 }
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
3084 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
3085 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
3086 else if (a.numel () > 0)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3087 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3088 if (has_facealpha)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3089 aa = a(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3090 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3091 aa = a(idx);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3092 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3093
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3094 vdata[i+j*fr] = vertex_data (vv, cc, nn, aa, as, ds, ss, se, scr);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
3095 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3096
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3097 if (fl_mode > 0 || el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3098 glMaterialf (LIGHT_MODE, GL_SHININESS, se);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3099
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3100 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
3101 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3102 // 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
3103 if (fa_mode == 0)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3104 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3105 if (fc_mode == UNIFORM)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3106 {
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
3107 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
3108 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3109 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3110 float cb[4] = { 0, 0, 0, 1 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3111
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3112 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3113 cb[i] = as * fcolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3114 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3115
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3116 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3117 cb[i] = ds * fcolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3118 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3119
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3120 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3121 cb[i] = ss * (scr + (1-scr) * fcolor(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3122 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3123 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3124 }
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 if ((fl_mode > 0) && (num_lights > 0) && has_normals)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3127 glEnable (GL_LIGHTING);
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 // NOTE: Push filled part of patch backwards to avoid Z-fighting with
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3130 // tesselator outline. A value of 1.0 seems to work fine. Value
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3131 // can't be too large or the patch will be pushed below the axes
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3132 // planes at +2.5.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3133 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
3134
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3135 for (int i = 0; i < nf; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3136 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3137 if (clip_f(i))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3138 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3139
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3140 tess.begin_polygon (true);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3141 tess.begin_contour ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3142
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3143 // 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
3144 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
3145 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3146 vertex_data::vertex_data_rep *vv = vdata[i+j*fr].get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3147
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3148 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
3149 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3150
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3151 if (count_f(i) > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3152 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3153 vertex_data::vertex_data_rep *vv = vdata[i].get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3154
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3155 if (fc_mode == FLAT)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3156 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3157 // For "flat" shading, use color of 1st vertex.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3158 Matrix col = vv->color;
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 if (col.numel () == 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3161 {
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
3162 glColor4d (col(0), col(1), col(2), fa);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3163 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3164 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3165 float cb[4] = { 0, 0, 0, 1 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3166
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3167 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3168 cb[k] = (vv->ambient * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3169 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3172 cb[k] = (vv->diffuse * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3173 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3174
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3175 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3176 cb[k] = vv->specular * (vv->specular_color_refl
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3177 + (1-vv->specular_color_refl) * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3178 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3181 }
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 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
3184 }
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 tess.end_contour ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3187 tess.end_polygon ();
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3190 if ((fl_mode > 0) && (num_lights > 0) && has_normals)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3191 glDisable (GL_LIGHTING);
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 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3194 {
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
3195 // FIXME: implement flat and interp transparency
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3196 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3197 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3198
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3199 if (draw_all
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3200 || (! 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
3201 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3202 // FIXME: adapt to double-radio property
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3203 if (props.get_edgealpha_double () == 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3204 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3205 if (ec_mode == UNIFORM)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3206 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3207 glColor3dv (ecolor.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3208 if (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3209 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3210 float cb[4] = { 0, 0, 0, 1 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3211
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3212 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3213 cb[i] = (as * ecolor(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3214 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3215
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3216 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3217 cb[i] = ds * ecolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3218 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3219
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3220 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3221 cb[i] = ss * (scr + (1-scr) * ecolor(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3222 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3223 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3224 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3225
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3226 if ((el_mode > 0) && (num_lights > 0) && has_normals)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3227 glEnable (GL_LIGHTING);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3228
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3229 double linewidth = props.get_linewidth ();
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3230 set_linestyle (props.get_linestyle (), false, linewidth);
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3231 set_linewidth (linewidth);
22838
1444a65085ca Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22759
diff changeset
3232 set_linecap ("butt");
22759
39f39eb4e476 Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
3233 set_linejoin ("miter");
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3234
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3235 // 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
3236 // 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
3237 // 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
3238 // 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
3239 // 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
3240 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
3241
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3242 for (int i = 0; i < nf; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3243 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3244 if (clip_f(i))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3245 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3246 // This is an unclosed contour. Draw it as a line.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3247 bool flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3248
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3249 glShadeModel ((ec_mode == INTERP || el_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3250 ? GL_SMOOTH : GL_FLAT);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3251
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3252 // 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
3253 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
3254 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3255 if (! clip(int (f(i,j) - 1)))
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 vertex_data::vertex_data_rep *vv
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3258 = vdata[i+j*fr].get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3259 const Matrix m = vv->coords;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3260 if (! flag)
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 flag = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3263 glBegin (GL_LINE_STRIP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3264 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3265 if (ec_mode != UNIFORM)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3266 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3267 Matrix col = vv->color;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3268
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3269 if (col.numel () == 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3270 glColor3dv (col.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3271 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3272 glVertex3d (m(0), m(1), m(2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3273 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3274 else if (flag)
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 flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3277 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3278 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3279 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3280 // 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
3281 // from vertex 0 to vertex N.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3282 int j = count_f(i)-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3283 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
3284 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3285 vertex_data::vertex_data_rep *vv
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3286 = vdata[i+j*fr].get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3287 const Matrix m = vv->coords;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3288 if (ec_mode != UNIFORM)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3289 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3290 Matrix col = vv->color;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3291
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3292 if (col.numel () == 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3293 glColor3dv (col.data ());
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 glVertex3d (m(0), m(1), m(2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3296 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3297
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3298 if (flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3299 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3300 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3301 else // Normal edge contour drawn with tesselator
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3302 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3303 tess.begin_polygon (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3304 tess.begin_contour ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3305
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3306 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
3307 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3308 vertex_data::vertex_data_rep *vv
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3309 = vdata[i+j*fr].get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3310 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
3311 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3312
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3313 tess.end_contour ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3314 tess.end_polygon ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3315 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3316 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3317
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3318 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
3319 set_linewidth (0.5f);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3320
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3321 if ((el_mode > 0) && (num_lights > 0) && has_normals)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3322 glDisable (GL_LIGHTING);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3323 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3324 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3325 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3326 // FIXME: implement transparency
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3327 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3328 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3329
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3330 if (! props.marker_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3331 && ! (props.markeredgecolor_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3332 && props.markerfacecolor_is ("none")))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3333 {
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3334 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
3335 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
3336
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3337 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
3338 props.get_markeredgecolor_rgb ());
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3339 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
3340 props.get_markerfacecolor_rgb ());
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3341
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24183
diff changeset
3342 bool has_markerfacecolor = draw_all || false;
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3343
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
3344 if ((mecolor.isempty () && ! props.markeredgecolor_is ("none"))
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
3345 || (mfcolor.isempty () && ! props.markerfacecolor_is ("none")))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3346 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3347 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
3348
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3349 if (mc.rows () == 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3350 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3351 // 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
3352 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
3353 mfcolor = mc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3354
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
3355 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
3356 mecolor = mc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3357 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3358 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3359 {
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
3360 if (c.isempty ())
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3361 c = props.get_color_data ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3362 has_markerfacecolor = ((c.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3363 && (c.rows () == f.rows ()));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3364 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3365 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3366
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3367 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
3368 props.get_linewidth ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3369
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3370 for (int i = 0; i < nf; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3371 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
3372 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3373 int idx = int (f(i,j) - 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3374
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3375 if (clip(idx))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3376 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3377
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3378 Matrix cc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3379 if (c.numel () > 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
3380 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3381 cc.resize (1, 3);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3382 if (has_markerfacecolor)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3383 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
3384 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3385 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
3386 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
3387
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
3388 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
3389 : Matrix ());
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
3390 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
3391 : Matrix ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3392
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3393 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
3394 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3395
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3396 end_marker ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3397 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3398
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3399 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3400
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3401 octave_unused_parameter (props);
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 // 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
3404 // 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
3405
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3406 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3407
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3408 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3409 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3410
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3411 void
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23396
diff changeset
3412 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
3413 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3414 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3415
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3416 // enable light source
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3417 glEnable (current_light);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3418
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3419 // light position
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3420 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
3421 Matrix lpos = props.get_position ().matrix_value ();
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 pos[i] = lpos(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3424 if (props.style_is ("local"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3425 pos[3] = 1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3426 glLightfv (current_light, GL_POSITION, pos);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3427
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3428 // light color
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3429 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
3430 Matrix lcolor = props.get_color ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3431 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3432 col[i] = lcolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3433 glLightfv (current_light, GL_DIFFUSE, col);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3434 glLightfv (current_light, GL_SPECULAR, col);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3435
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3436 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3437
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3438 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3439
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3440 // 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
3441 // 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
3442
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3443 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3444
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3445 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3446 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3447
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3448 void
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23396
diff changeset
3449 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
3450 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3451 draw (props.get_children ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3452 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3453
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3454 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3455 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
3456 {
21789
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3457 #if defined (HAVE_OPENGL)
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3458
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23564
diff changeset
3459 if (props.get_string ().isempty ())
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3460 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3461
24173
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3462 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
3463
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3464 // Handle clipping manually when drawing text background
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3465 if (! 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
3466 (clip_code (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0) ==
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3467 octave_uint8 (0x40)))
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3468 {
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3469 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
3470 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
3471 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
3472 }
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3473
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3474 set_font (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3475
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3476 const Matrix bbox = props.get_extent_matrix ();
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 bool blend = glIsEnabled (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3479
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3480 glEnable (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3481 glEnable (GL_ALPHA_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3482 glRasterPos3d (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0);
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23696
diff changeset
3483 glBitmap (0, 0, 0, 0, bbox(0), bbox(1), nullptr);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3484 glDrawPixels (bbox(2), bbox(3),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3485 GL_RGBA, GL_UNSIGNED_BYTE, props.get_pixels ().data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3486 glDisable (GL_ALPHA_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3487 if (! blend)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3488 glDisable (GL_BLEND);
21789
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3489
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3490 #else
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3491
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3492 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3493
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3494 // 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
3495 // 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
3496
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3497 panic_impossible ();
21789
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3498
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3499 #endif
22331
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3502 void
24173
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3503 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
3504 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
3505 {
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3506 #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
3507
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3508 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
3509 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
3510
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3511 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
3512 return;
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3513
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3514 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
3515 ColumnVector pixpos = get_transform ().transform (pos(0), pos(1),
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3516 pos(2), false);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3517 const Matrix bbox = props.get_extent_matrix ();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3518
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3519 # if defined (HAVE_FRAMEWORK_OPENGL)
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3520 GLint vp[4];
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3521 # else
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3522 int vp[4];
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3523 # endif
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3524
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3525 glGetIntegerv (GL_VIEWPORT, vp);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3526
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3527 // Save current transform matrices and set orthogonal window coordinates
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3528 glMatrixMode (GL_PROJECTION);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3529 glPushMatrix ();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3530 glLoadIdentity ();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3531 glOrtho (0, vp[2], vp[3], 0, xZ1, xZ2);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3532 glMatrixMode (GL_MODELVIEW);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3533 glPushMatrix ();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3534 glLoadIdentity ();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3535
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3536 // Translate coordinates so that the text anchor is (0,0)
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3537 glTranslated (pixpos(0), pixpos(1), -pixpos(2));
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3538
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3539 // 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
3540 // 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
3541 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
3542
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3543 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
3544 && rotation != 180.0 && rotation != 270.0)
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3545 glRotated (-rotation, 0.0, 0.0, 1.0);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3546
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3547 double m = props.get_margin ();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3548 double x0 = bbox (0) - m;
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3549 double x1 = x0 + bbox(2) + 2 * m;
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3550 double y0 = -(bbox (1) - m);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3551 double y1 = y0 - (bbox(3) + 2 * m);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3552
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3553 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
3554 {
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3555 glColor3f (bgcol(0), bgcol(1), bgcol(2));
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3556
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3557 bool depth_test = glIsEnabled (GL_DEPTH_TEST);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3558 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
3559 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
3560
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3561 glBegin (GL_QUADS);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3562 glVertex2d (x0, y0);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3563 glVertex2d (x1, y0);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3564 glVertex2d (x1, y1);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3565 glVertex2d (x0, y1);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3566 glEnd ();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3567
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3568 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
3569 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
3570 }
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3571
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3572 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
3573 {
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3574 glColor3f (ecol(0), ecol(1), ecol(2));
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3575
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3576 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
3577 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
3578
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3579 glBegin (GL_LINE_STRIP);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3580 glVertex2d (x0, y0);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3581 glVertex2d (x1, y0);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3582 glVertex2d (x1, y1);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3583 glVertex2d (x0, y1);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3584 glVertex2d (x0, y0);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3585 glEnd ();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3586 }
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3587
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3588 // Restore previous coordinate system
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3589 glPopMatrix();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3590 glMatrixMode (GL_PROJECTION);
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3591 glPopMatrix();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3592
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3593 #else
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3594
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3595 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
3596 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
3597
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3598 // 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
3599 // 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
3600
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3601 panic_impossible ();
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3602
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3603 #endif
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3604 }
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3605
730227072acb Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24154
diff changeset
3606 void
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3607 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
3608 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3609 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3610
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3611 octave_value cdata = props.get_color_data ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3612 dim_vector dv (cdata.dims ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3613 int h = dv(0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3614 int w = dv(1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3615
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3616 Matrix x = props.get_xdata ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3617 Matrix y = props.get_ydata ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3618
22369
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22363
diff changeset
3619 // 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
3620 if (x.isempty () || y.isempty ())
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3621 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3622
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3623 if (w > 1 && x(1) == x(0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3624 x(1) = x(1) + (w-1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3625
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3626 if (h > 1 && y(1) == y(0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3627 y(1) = y(1) + (h-1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3628
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3629 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
3630 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
3631
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
3632 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
3633 || 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
3634 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3635 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
3636 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3637 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3638
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3639 // image pixel size in screen pixel units
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3640 float pix_dx, pix_dy;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3641 // image pixel size in normalized units
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3642 float nor_dx, nor_dy;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3643
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3644 if (w > 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3645 {
22369
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22363
diff changeset
3646 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
3647 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
3648 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3649 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3650 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3651 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
3652 pix_dx = p1w(0) - p0(0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3653 nor_dx = 1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3654 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3655
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3656 if (h > 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3657 {
22369
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22363
diff changeset
3658 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
3659 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
3660 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3661 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3662 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3663 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
3664 pix_dy = p1h(1) - p0(1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3665 nor_dy = 1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3666 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3667
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3668 // 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
3669 // 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
3670
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3671 int j0, j1, i0, i1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3672 j0 = 0, j1 = w;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3673 i0 = 0, i1 = h;
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 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
3676 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
3677 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
3678 float im_ymax = y(1) + nor_dy/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3679 if (props.is_clipping ()) // clip to axes
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3680 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3681 if (im_xmin < xmin)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3682 j0 += (xmin - im_xmin)/nor_dx + 1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3683 if (im_xmax > xmax)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3684 j1 -= (im_xmax - xmax)/nor_dx;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3685
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3686 if (im_ymin < ymin)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3687 i0 += (ymin - im_ymin)/nor_dy + 1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3688 if (im_ymax > ymax)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3689 i1 -= (im_ymax - ymax)/nor_dy;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3690 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3691 else // clip to viewport
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3692 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3693 GLfloat vp[4];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3694 glGetFloatv (GL_VIEWPORT, vp);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3695 // FIXME: actually add the code to do it!
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3698 if (i0 >= i1 || j0 >= j1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3699 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3700
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3701 glPixelZoom (pix_dx, -pix_dy);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3702 glRasterPos3d (im_xmin + nor_dx*j0, im_ymin + nor_dy*i0, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3703
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3704 // by default this is 4
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3705 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3706
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3707 // Expect RGB data
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3708 if (dv.ndims () == 3 && dv(2) == 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3709 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3710 if (cdata.is_double_type ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3711 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3712 const NDArray xcdata = cdata.array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3713
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3714 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
3715
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3716 for (int i = i0; i < i1; i++)
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 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
3719 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3720 a[idx] = xcdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3721 a[idx+1] = xcdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3722 a[idx+2] = xcdata(i,j,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3723 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3724 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3725
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3726 draw_pixels (j1-j0, i1-i0, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3727
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3728 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3729 else if (cdata.is_single_type ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3730 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3731 const FloatNDArray xcdata = cdata.float_array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3732
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3733 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
3734
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3735 for (int i = i0; i < i1; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3736 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3737 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
3738 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3739 a[idx] = xcdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3740 a[idx+1] = xcdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3741 a[idx+2] = xcdata(i,j,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3742 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3743 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3744
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3745 draw_pixels (j1-j0, i1-i0, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3746
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3747 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3748 else if (cdata.is_uint8_type ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3749 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3750 const uint8NDArray xcdata = cdata.uint8_array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3751
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3752 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
3753
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3754 for (int i = i0; i < i1; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3755 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3756 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
3757 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3758 a[idx] = xcdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3759 a[idx+1] = xcdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3760 a[idx+2] = xcdata(i,j,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3761 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3762 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3763
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3764 draw_pixels (j1-j0, i1-i0, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3765
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3766 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3767 else if (cdata.is_uint16_type ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3768 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3769 const uint16NDArray xcdata = cdata.uint16_array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3770
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3771 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
3772
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3773 for (int i = i0; i < i1; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3774 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3775 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
3776 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3777 a[idx] = xcdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3778 a[idx+1] = xcdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3779 a[idx+2] = xcdata(i,j,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3780 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3781 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3782
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3783 draw_pixels (j1-j0, i1-i0, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3784
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3785 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3786 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3787 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
3788 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3789 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3790 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
3791
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3792 glPixelZoom (1, 1);
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3793
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3794 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3795
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3796 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3797
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3798 // 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
3799 // 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
3800
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3801 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3802
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3803 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3804 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3805
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3806 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3807 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
3808 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3809 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3810
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3811 glViewport (0, 0, w, h);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3812
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3813 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3814
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3815 octave_unused_parameter (w);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3816 octave_unused_parameter (h);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3817
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3818 // 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
3819 // 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
3820
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3821 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3822
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3823 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3824 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3825
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3826 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3827 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
3828 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3829 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3830
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3831 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
3832
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3833 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3834
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3835 octave_unused_parameter (width);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3836 octave_unused_parameter (height);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3837 octave_unused_parameter (data);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3838
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3839 // 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
3840 // 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
3841
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3842 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3843
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3844 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3845 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3846
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3847 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3848 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
3849 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3850 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3851
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3852 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
3853
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3854 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3855
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3856 octave_unused_parameter (width);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3857 octave_unused_parameter (height);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3858 octave_unused_parameter (data);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3859
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3860 // 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
3861 // 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
3862
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3863 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3864
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3865 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3866 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3867
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3868 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3869 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
3870 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3871 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3872
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3873 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
3874
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3875 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3876
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3877 octave_unused_parameter (width);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3878 octave_unused_parameter (height);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3879 octave_unused_parameter (data);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3880
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3881 // 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
3882 // 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
3883
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3884 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3885
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3886 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3887 }
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 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3890 opengl_renderer::set_color (const Matrix& c)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3891 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3892 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3893
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3894 glColor3dv (c.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3895
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3896 txt_renderer.set_color (c);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3897
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3898 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3899
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3900 octave_unused_parameter (c);
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 // 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
3903 // 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
3904
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3905 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3906
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3907 #endif
22331
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3910 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3911 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
3912 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3913 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
3914 props.get ("fontweight").string_value (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3915 props.get ("fontangle").string_value (),
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22528
diff changeset
3916 props.get ("__fontsize_points__").double_value ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3917 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3918
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3919 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3920 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
3921 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3922 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3923
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3924 if (on)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3925 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3926 glEnable (GL_POLYGON_OFFSET_FILL);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3927 glEnable (GL_POLYGON_OFFSET_LINE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3928 glPolygonOffset (offset, offset);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3929 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3930 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3931 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3932 glDisable (GL_POLYGON_OFFSET_FILL);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3933 glDisable (GL_POLYGON_OFFSET_LINE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3934 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3935
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3936 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3937
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3938 octave_unused_parameter (on);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3939 octave_unused_parameter (offset);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3940
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3941 // 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
3942 // 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
3943
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3944 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3945
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3946 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3947 }
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 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3950 opengl_renderer::set_linewidth (float w)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3951 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3952 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3953
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3954 glLineWidth (w);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3955
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3956 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3957
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3958 octave_unused_parameter (w);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3959
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3960 // 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
3961 // 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
3962
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3963 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3964
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3965 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3966 }
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 void
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3969 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
3970 double linewidth)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3971 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3972 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3973
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3974 bool solid = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3975
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3976 if (s == "-")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3977 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3978 glLineStipple (1, static_cast<unsigned short> (0xFFFF));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3979 solid = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3980 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3981 else if (s == ":")
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3982 glLineStipple (linewidth, static_cast<unsigned short> (0x5555));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3983 else if (s == "--")
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3984 glLineStipple (linewidth, static_cast<unsigned short> (0x0F0F));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3985 else if (s == "-.")
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3986 glLineStipple (linewidth, static_cast<unsigned short> (0x6F6F));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3987 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3988 glLineStipple (1, static_cast<unsigned short> (0x0000));
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 if (solid && ! use_stipple)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3991 glDisable (GL_LINE_STIPPLE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3992 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3993 glEnable (GL_LINE_STIPPLE);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3994
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3995 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3996
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3997 octave_unused_parameter (s);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3998 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
3999 octave_unused_parameter (linewidth);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4000
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4001 // 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
4002 // 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
4003
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4004 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4005
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4006 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4007 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4008
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4009 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4010 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
4011 double z1, double z2)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4012 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4013 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4014
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4015 double dx = (x2-x1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4016 double dy = (y2-y1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4017 double dz = (z2-z1);
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 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
4020 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
4021 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
4022
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4023 ColumnVector p (4, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4024
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4025 p(0) = -1; p(3) = x2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4026 glClipPlane (GL_CLIP_PLANE0, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4027 p(0) = 1; p(3) = -x1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4028 glClipPlane (GL_CLIP_PLANE1, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4029 p(0) = 0; p(1) = -1; p(3) = y2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4030 glClipPlane (GL_CLIP_PLANE2, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4031 p(1) = 1; p(3) = -y1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4032 glClipPlane (GL_CLIP_PLANE3, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4033 p(1) = 0; p(2) = -1; p(3) = z2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4034 glClipPlane (GL_CLIP_PLANE4, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4035 p(2) = 1; p(3) = -z1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4036 glClipPlane (GL_CLIP_PLANE5, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4037
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4038 xmin = x1; xmax = x2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4039 ymin = y1; ymax = y2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4040 zmin = z1; zmax = z2;
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4041
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4042 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4043
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4044 octave_unused_parameter (x1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4045 octave_unused_parameter (x2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4046 octave_unused_parameter (y1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4047 octave_unused_parameter (y2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4048 octave_unused_parameter (z1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4049 octave_unused_parameter (z2);
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 // 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
4052 // 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
4053
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4054 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4055
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4056 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4057 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4058
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4059 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4060 opengl_renderer::set_clipping (bool enable)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4061 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4062 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4063
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4064 bool has_clipping = (glIsEnabled (GL_CLIP_PLANE0) == GL_TRUE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4065
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4066 if (enable != has_clipping)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4067 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4068 if (enable)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4069 for (int i = 0; i < 6; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4070 glEnable (GL_CLIP_PLANE0+i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4071 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4072 for (int i = 0; i < 6; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4073 glDisable (GL_CLIP_PLANE0+i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4074 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4075
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4076 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4077
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4078 octave_unused_parameter (enable);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4079
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4080 // 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
4081 // 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
4082
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4083 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4084
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4085 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4086 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4087
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4088 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4089 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
4090 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4091 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4092
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4093 # if defined (HAVE_FRAMEWORK_OPENGL)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4094 GLint vw[4];
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4095 # else
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4096 int vw[4];
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4097 # endif
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
4098
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4099 glGetIntegerv (GL_VIEWPORT, vw);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4100
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4101 glMatrixMode (GL_PROJECTION);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4102 glPushMatrix ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4103 glLoadIdentity ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4104 glOrtho (0, vw[2], vw[3], 0, xZ1, xZ2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4105 glMatrixMode (GL_MODELVIEW);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4106 glPushMatrix ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4107
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4108 set_clipping (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4109 set_linewidth (width);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4110
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4111 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
4112 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
4113
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4114 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4115
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4116 octave_unused_parameter (m);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4117 octave_unused_parameter (size);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4118 octave_unused_parameter (width);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4119
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4120 // 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
4121 // 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
4122
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4123 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4124
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4125 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4126 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4127
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4128 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4129 opengl_renderer::end_marker (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4130 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4131 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4132
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4133 glDeleteLists (marker_id, 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4134 glDeleteLists (filled_marker_id, 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4135
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4136 glMatrixMode (GL_MODELVIEW);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4137 glPopMatrix ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4138 glMatrixMode (GL_PROJECTION);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4139 glPopMatrix ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4140 set_linewidth (0.5f);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4141
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4142 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4143
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4144 // 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
4145 // 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
4146
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4147 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4148
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4149 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4150 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4151
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4152 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4153 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
4154 const Matrix& lc, const Matrix& fc)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4155 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4156 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4157
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4158 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
4159
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4160 glLoadIdentity ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4161 glTranslated (tmp(0), tmp(1), -tmp(2));
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 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
4164 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4165 glColor3dv (fc.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4166 set_polygon_offset (true, -1.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4167 glCallList (filled_marker_id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4168 if (lc.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4169 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4170 glColor3dv (lc.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4171 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4172 glEdgeFlag (GL_TRUE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4173 set_polygon_offset (true, -2.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4174 glCallList (filled_marker_id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4175 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4176 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4177 set_polygon_offset (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4178 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4179 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
4180 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4181 glColor3dv (lc.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4182 glCallList (marker_id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4183 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4184
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4185 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4186
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4187 octave_unused_parameter (x);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4188 octave_unused_parameter (y);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4189 octave_unused_parameter (z);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4190 octave_unused_parameter (lc);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4191 octave_unused_parameter (fc);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4192
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4193 // 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
4194 // 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
4195
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4196 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4197
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4198 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4199 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4200
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4201 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4202 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
4203 {
21797
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
4204 #if defined (HAVE_OPENGL)
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
4205
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4206 double x = n(j,i,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4207 double y = n(j,i,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4208 double z = n(j,i,2);
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 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
4211
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4212 double dir = 1.0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4213
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4214 if (bfl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4215 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
4216 ? ((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
4217
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4218 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
4219
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
4220 #else
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
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 (bfl_mode);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4223 octave_unused_parameter (n);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4224 octave_unused_parameter (j);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4225 octave_unused_parameter (i);
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 // 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
4228 // 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
4229
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4230 panic_impossible ();
21797
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
4231
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
4232 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4233 }
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 unsigned int
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4236 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
4237 bool filled) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4238 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4239 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4240
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4241 char c = marker[0];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4242
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4243 if (filled && (c == '+' || c == 'x' || c == '*' || c == '.'))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4244 return 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4245
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4246 unsigned int ID = glGenLists (1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4247 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
4248
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4249 // constants for the * marker
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4250 const double sqrt2d4 = 0.35355339059327;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4251 double tt = sz*sqrt2d4;
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 glNewList (ID, GL_COMPILE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4254
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4255 switch (marker[0])
7851
002b1d8460d2 added some more markers
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7846
diff changeset
4256 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4257 case '+':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4258 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4259 glVertex2d (-sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4260 glVertex2d (sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4261 glVertex2d (0, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4262 glVertex2d (0, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4263 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4264 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4265 case 'x':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4266 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4267 glVertex2d (-sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4268 glVertex2d (sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4269 glVertex2d (-sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4270 glVertex2d (sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4271 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4272 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4273 case '*':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4274 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4275 glVertex2d (-sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4276 glVertex2d (sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4277 glVertex2d (0, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4278 glVertex2d (0, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4279 glVertex2d (-tt, -tt);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4280 glVertex2d (+tt, +tt);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4281 glVertex2d (-tt, +tt);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4282 glVertex2d (+tt, -tt);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4283 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4284 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4285 case '.':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4286 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4287 // 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
4288
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4289 // 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
4290 if (sz > 0 && sz < 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4291 sz = 3;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4292
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4293 int div = static_cast <int> (M_PI * sz / 12);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4294 if (! (div % 2))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4295 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
4296 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
4297 double ang_step = M_PI / div;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4298
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4299 glBegin (GL_POLYGON);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4300 for (double ang = 0; ang < 2*M_PI; ang += ang_step)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4301 glVertex2d (sz/6*cos (ang), sz/6*sin (ang));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4302 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4303 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4304 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4305 case 's':
22268
a54d6b9c08bc Fix badly drawn 'o' and '.' markers at small and large sizes (OpenGL).
Rik <rik@octave.org>
parents: 22258
diff changeset
4306 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
4307 glVertex2d (-sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4308 glVertex2d (-sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4309 glVertex2d (sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4310 glVertex2d (sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4311 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4312 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4313 case 'o':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4314 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4315 int div = static_cast <int> (M_PI * sz / 4);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4316 if (! (div % 2))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4317 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
4318 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
4319 double ang_step = M_PI / div;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4320
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4321 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4322 for (double ang = 0; ang < 2*M_PI; ang += ang_step)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4323 glVertex2d (sz/2*cos (ang), sz/2*sin (ang));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4324 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4325 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4326 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4327 case 'd':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4328 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4329 glVertex2d (0, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4330 glVertex2d (sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4331 glVertex2d (0, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4332 glVertex2d (-sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4333 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4334 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4335 case 'v':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4336 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4337 glVertex2d (0, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4338 glVertex2d (sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4339 glVertex2d (-sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4340 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4341 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4342 case '^':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4343 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4344 glVertex2d (0, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4345 glVertex2d (-sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4346 glVertex2d (sz/2, sz/2);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
4347 glEnd ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4348 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4349 case '>':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4350 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4351 glVertex2d (sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4352 glVertex2d (-sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4353 glVertex2d (-sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4354 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4355 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4356 case '<':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4357 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4358 glVertex2d (-sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4359 glVertex2d (sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4360 glVertex2d (sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4361 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4362 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4363 case 'p':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4364 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4365 double ang, r, dr;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4366 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
4367
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4368 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4369 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
4370 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4371 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
4372 r = 1.0 - (dr * fmod (double (i+1), 2.0));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4373 glVertex2d (sz/2*r*cos (ang), sz/2*r*sin (ang));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4374 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4375 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4376 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4377 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4378 case 'h':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4379 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4380 double ang, r, dr;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4381 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
4382
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4383 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4384 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
4385 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4386 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
4387 r = 1.0 - (dr * fmod (double (i+1), 2.0));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4388 glVertex2d (sz/2*r*cos (ang), sz/2*r*sin (ang));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4389 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4390 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4391 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4392 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4393 default:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4394 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
4395 break;
7851
002b1d8460d2 added some more markers
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7846
diff changeset
4396 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4397
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4398 glEndList ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4399
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4400 return ID;
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4401
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4402 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4403
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4404 octave_unused_parameter (marker);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4405 octave_unused_parameter (size);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4406 octave_unused_parameter (filled);
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::text_to_pixels (const std::string& txt,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4418 uint8NDArray& pixels,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4419 Matrix& bbox,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4420 int halign, int valign, double rotation)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4421 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4422 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
4423 rotation, interpreter);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4424 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4425
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4426 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4427 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
4428 std::list<text_renderer::string>& lst,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4429 Matrix& bbox,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4430 int halign, int valign, double rotation)
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 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
4433 rotation, interpreter);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4434 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4435
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4436 Matrix
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4437 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
4438 double x, double y, double z,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4439 int halign, int valign, double rotation)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4440 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4441 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4442
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4443 Matrix bbox (1, 4, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4444
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4445 if (txt.empty ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4446 return bbox;
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 if (txt_renderer.ok ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4449 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4450 uint8NDArray pixels;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4451 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
4452
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4453 bool blend = glIsEnabled (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4454
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4455 glEnable (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4456 glEnable (GL_ALPHA_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4457 glRasterPos3d (x, y, z);
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23696
diff changeset
4458 glBitmap(0, 0, 0, 0, bbox(0), bbox(1), nullptr);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4459 glDrawPixels (bbox(2), bbox(3),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4460 GL_RGBA, GL_UNSIGNED_BYTE, pixels.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4461 glDisable (GL_ALPHA_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4462
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4463 if (! blend)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4464 glDisable (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4465 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4466
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
4467 return bbox;
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
4468
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4469 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4470
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4471 octave_unused_parameter (txt);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4472 octave_unused_parameter (x);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4473 octave_unused_parameter (y);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4474 octave_unused_parameter (z);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4475 octave_unused_parameter (halign);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4476 octave_unused_parameter (valign);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4477 octave_unused_parameter (rotation);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4478
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4479 // 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
4480 // 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
4481
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4482 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4483
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4484 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4485 }
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
4486 }