Mercurial > octave
annotate libinterp/corefcn/gl-render.cc @ 31605:e88a07dec498 stable
maint: Use macros to begin/end C++ namespaces.
* oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE,
OCTAVE_END_NAMESPACE) that can be used to start/end a namespace.
* mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc,
__dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc,
__ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc,
auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h,
besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h,
call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc,
colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc,
defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc,
display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc,
ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h,
event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc,
fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc,
ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc,
getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc,
gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc,
graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc,
help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h,
interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h,
inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc,
latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h,
lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc,
ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h,
mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc,
oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h,
oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h,
oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h,
oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy,
ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc,
pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc,
qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h,
sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc,
sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h,
stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc,
symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h,
symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h,
text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc,
toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc,
url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc,
variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h,
__delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc,
audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh,
mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc,
cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h,
cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h,
cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc,
ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc,
ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h,
ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc,
ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h,
ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc,
op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc,
op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc,
op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc,
op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc,
op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc,
op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc,
op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc,
op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc,
op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc,
op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc,
op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc,
op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc,
op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc,
op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc,
op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc,
op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc,
op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h,
anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h,
comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc,
oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h,
pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h,
pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h,
pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h,
pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h,
pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc,
pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc,
pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc,
pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc,
pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc,
pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc,
pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h,
pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h,
range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc,
chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h,
lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h,
oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h,
oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc,
qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc,
randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc,
sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc,
child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc,
file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h,
mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h,
oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc,
oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h,
base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h,
file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc,
lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h,
oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h,
oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h,
oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h,
pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h,
url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Dec 2022 14:23:45 -0800 |
parents | 670a0d878af1 |
children | aac27ad79be6 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30253
diff
changeset
|
3 // Copyright (C) 2008-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
7825
13871b7de124
Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21691
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21209
diff
changeset
|
27 # include "config.h" |
7825
13871b7de124
Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
28 #endif |
13871b7de124
Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
29 |
28763
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
30 #include <limits> |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
31 #include <memory> |
25438
cb1606f78f6b
prefer <istream>, <ostream>, or <iosfwd> to <iostream> where possible
John W. Eaton <jwe@octave.org>
parents:
25423
diff
changeset
|
32 #include <sstream> |
9403
4af6e29449c1
[mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
33 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21691
diff
changeset
|
34 #if defined (HAVE_WINDOWS_H) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21198
diff
changeset
|
35 # define WIN32_LEAN_AND_MEAN |
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21198
diff
changeset
|
36 # 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
|
37 #endif |
bd96c2efd4fe
move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents:
21115
diff
changeset
|
38 |
23479
06bf3a0b08bf
maint: Use "" instead of <> for our own include files.
John W. Eaton <jwe@octave.org>
parents:
23450
diff
changeset
|
39 #include "lo-mappers.h" |
8377
25bc2d31e1bf
improve OCTAVE_LOCAL_BUFFER
Jaroslav Hajek <highegg@gmail.com>
parents:
8263
diff
changeset
|
40 #include "oct-locbuf.h" |
21115
629643522cc0
include errwarn.h in all files that use gripe_disabled_feature
John W. Eaton <jwe@octave.org>
parents:
21109
diff
changeset
|
41 |
629643522cc0
include errwarn.h in all files that use gripe_disabled_feature
John W. Eaton <jwe@octave.org>
parents:
21109
diff
changeset
|
42 #include "errwarn.h" |
7825
13871b7de124
Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
43 #include "gl-render.h" |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
44 #include "interpreter-private.h" |
21196
bd96c2efd4fe
move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents:
21115
diff
changeset
|
45 #include "oct-opengl.h" |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
46 #include "text-renderer.h" |
7825
13871b7de124
Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
47 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
48 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
49 |
24725
edef866fba7b
* gl-render.cc: Fix compilation error when HAVE_OPENGL is not defined.
John W. Eaton <jwe@octave.org>
parents:
24722
diff
changeset
|
50 #if defined (HAVE_OPENGL) |
edef866fba7b
* gl-render.cc: Fix compilation error when HAVE_OPENGL is not defined.
John W. Eaton <jwe@octave.org>
parents:
24722
diff
changeset
|
51 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
52 static int |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
53 next_power_of_2 (int n) |
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 int m = 1; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
56 |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
57 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
|
58 m <<= 1; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
59 |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
60 return m; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24634
diff
changeset
|
61 } |
22393
026067ffcf66
fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents:
22391
diff
changeset
|
62 |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7825
diff
changeset
|
63 #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
|
64 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
65 // Use symbolic names for axes |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
66 enum |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
67 { |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
68 X_AXIS, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
69 Y_AXIS, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
70 Z_AXIS |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
71 }; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
72 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
73 // Use symbolic names for color mode |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
74 enum |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
75 { |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
76 UNIFORM, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
77 FLAT, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
78 INTERP, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
79 TEXTURE |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
80 }; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
81 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
82 // Use symbolic names for lighting |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
83 enum |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
84 { |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
85 NONE, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
86 //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
|
87 GOURAUD = 2 |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
88 }; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
89 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
90 // Win32 API requires the CALLBACK attributes for |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
91 // 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
|
92 // other platforms. |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21691
diff
changeset
|
93 #if ! defined (CALLBACK) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21198
diff
changeset
|
94 # 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
|
95 #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
|
96 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
97 class opengl_texture |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
98 { |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
99 private: |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
100 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
101 class texture_rep |
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 public: |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
104 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
105 texture_rep (opengl_functions& glfcns) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
106 : m_glfcns (glfcns), m_id (), m_w (), m_h (), m_tw (), m_th (), |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
107 m_tx (), m_ty (), m_valid (false) |
22331
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 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
110 texture_rep (opengl_functions& glfcns, GLuint id, int w, int h, |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
111 int tw, int th) |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
112 : m_glfcns (glfcns), m_id (id), m_w (w), m_h (h), m_tw (tw), m_th (th), |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
113 m_tx (double(m_w)/m_tw), m_ty (double(m_h)/m_th), m_valid (true) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
114 { } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
115 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
116 ~texture_rep (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
117 { |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
118 if (m_valid) |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
119 m_glfcns.glDeleteTextures (1, &m_id); |
22331
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
122 void bind (int mode) const |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
123 { |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
124 if (m_valid) |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
125 m_glfcns.glBindTexture (mode, m_id); |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
126 } |
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 void tex_coord (double q, double r) const |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
129 { |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
130 if (m_valid) |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
131 m_glfcns.glTexCoord2d (q*m_tx, r*m_ty); |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
132 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
133 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
134 opengl_functions& m_glfcns; |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
135 GLuint m_id; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
136 int m_w, m_h; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
137 int m_tw, m_th; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
138 double m_tx, m_ty; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
139 bool m_valid; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
140 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
141 |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
142 public: |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
143 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
144 opengl_texture (opengl_functions& glfcns) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
145 : m_rep (new texture_rep (glfcns)) |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
146 { } |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
147 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
148 opengl_texture (opengl_functions& glfcns, GLuint id, int w, int h, |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
149 int tw, int th) |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
150 : m_rep (new texture_rep (glfcns, id, w, h, tw, th)) |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
151 { } |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
152 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
153 opengl_texture (const opengl_texture&) = default; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
154 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
155 ~opengl_texture (void) = default; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
156 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
157 opengl_texture& operator = (const opengl_texture&) = default; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
158 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
159 static opengl_texture create (opengl_functions& glfcns, |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
160 const octave_value& data); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
161 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
162 void bind (int mode = GL_TEXTURE_2D) const { m_rep->bind (mode); } |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
163 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
164 void tex_coord (double q, double r) const { m_rep->tex_coord (q, r); } |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
165 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
166 bool is_valid (void) const { return m_rep->m_valid; } |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
167 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
168 private: |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
169 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
170 opengl_texture (const std::shared_ptr<texture_rep>& new_rep) |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
171 : m_rep (new_rep) |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
172 { } |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
173 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
174 std::shared_ptr<texture_rep> m_rep; |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
175 }; |
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
176 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
177 opengl_texture |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
178 opengl_texture::create (opengl_functions& glfcns, const octave_value& data) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
179 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
180 opengl_texture retval (glfcns); |
22331
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 dim_vector dv (data.dims ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
183 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
184 // Expect RGB data |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
185 if (dv.ndims () == 3 && (dv(2) == 3 || dv(2) == 4)) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
186 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
187 // 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
|
188 // 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
|
189 int h, w, tw, th; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
190 h = dv(0), w = dv(1); |
26862
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
191 |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
192 // Return early if the image data are larger than the texture |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
193 // can hold |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
194 int max_size; |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
195 glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_size); |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
196 static bool warned = false; |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
197 if (h > max_size || w > max_size) |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
198 { |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
199 if (! warned) |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
200 { |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
201 warning ("opengl_texture::create: the opengl library in use " |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
202 "doesn't support images with either dimension larger " |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
203 "than %d. Not rendering.", max_size); |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
204 warned = true; |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
205 } |
26995
ab5bfee22d18
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
26862
diff
changeset
|
206 |
26862
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
207 return opengl_texture (glfcns); |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
208 } |
26995
ab5bfee22d18
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
26862
diff
changeset
|
209 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
210 GLuint id; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
211 bool ok = true; |
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 tw = next_power_of_2 (w); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
214 th = next_power_of_2 (h); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
215 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
216 glfcns.glGenTextures (1, &id); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
217 glfcns.glBindTexture (GL_TEXTURE_2D, id); |
22331
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 if (data.is_double_type ()) |
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 const NDArray xdata = data.array_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
222 |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
223 OCTAVE_LOCAL_BUFFER (GLfloat, a, (3*tw*th)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
224 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
225 for (int i = 0; i < h; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
226 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
227 for (int 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
|
228 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
229 a[idx] = xdata(i,j,0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
230 a[idx+1] = xdata(i,j,1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
231 a[idx+2] = xdata(i,j,2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
232 } |
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 |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
235 glfcns.glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB, |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
236 GL_FLOAT, a); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
237 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
238 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
239 else if (data.is_single_type ()) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
240 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
241 const FloatNDArray xdata = data.float_array_value (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
242 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
243 OCTAVE_LOCAL_BUFFER (GLfloat, a, (3*tw*th)); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
244 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
245 for (int i = 0; i < h; i++) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
246 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
247 for (int j = 0, idx = i*tw*3; j < w; j++, idx += 3) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
248 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
249 a[idx] = xdata(i,j,0); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
250 a[idx+1] = xdata(i,j,1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
251 a[idx+2] = xdata(i,j,2); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
252 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
253 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
254 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
255 glfcns.glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB, |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
256 GL_FLOAT, a); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
257 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
258 else if (data.is_uint16_type ()) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
259 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
260 const uint16NDArray xdata = data.uint16_array_value (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
261 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
262 OCTAVE_LOCAL_BUFFER (GLushort, a, (3*tw*th)); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
263 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
264 for (int i = 0; i < h; i++) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
265 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
266 for (int j = 0, idx = i*tw*3; j < w; j++, idx += 3) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
267 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
268 a[idx] = xdata(i,j,0); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
269 a[idx+1] = xdata(i,j,1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
270 a[idx+2] = xdata(i,j,2); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
271 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
272 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
273 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
274 glfcns.glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
275 GL_RGB, GL_UNSIGNED_SHORT, a); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
276 } |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
277 else if (data.is_uint8_type () && dv(2) == 3) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
278 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
279 const uint8NDArray xdata = data.uint8_array_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
280 |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
281 OCTAVE_LOCAL_BUFFER (GLubyte, a, (3*tw*th)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
282 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
283 for (int i = 0; i < h; i++) |
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 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
|
286 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
287 a[idx] = xdata(i,j,0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
288 a[idx+1] = xdata(i,j,1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
289 a[idx+2] = xdata(i,j,2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
290 } |
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 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
293 glfcns.glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
294 GL_RGB, GL_UNSIGNED_BYTE, a); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
295 } |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
296 else if (data.is_uint8_type () && dv(2) == 4) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
297 { |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
298 const uint8NDArray xdata = data.uint8_array_value (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
299 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
300 OCTAVE_LOCAL_BUFFER (GLubyte, a, (4*tw*th)); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
301 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
302 for (int i = 0; i < h; i++) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
303 { |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
304 for (int j = 0, idx = i*tw*4; j < w; j++, idx += 4) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
305 { |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
306 a[idx] = xdata(i,j,0); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
307 a[idx+1] = xdata(i,j,1); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
308 a[idx+2] = xdata(i,j,2); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
309 a[idx+3] = xdata(i,j,3); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
310 } |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
311 } |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
312 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
313 glfcns.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
314 GL_RGBA, GL_UNSIGNED_BYTE, a); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
315 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
316 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
317 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
318 ok = false; |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
319 warning ("opengl_texture::create: invalid image data type, expected double, single, uint8, or uint16"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
320 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
321 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
322 if (ok) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
323 { |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
324 glfcns.glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
325 GL_NEAREST); |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
326 glfcns.glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
327 GL_NEAREST); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
328 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
329 if (glfcns.glGetError () != GL_NO_ERROR) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
330 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
|
331 else |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
332 retval = opengl_texture (glfcns, id, w, h, tw, th); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
333 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
334 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
335 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
336 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
|
337 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
338 return retval; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
339 } |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
340 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
341 class |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
342 opengl_tessellator |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
343 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
344 public: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
345 #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
|
346 typedef GLvoid (CALLBACK *fcn) (...); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
347 #else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
348 typedef void (CALLBACK *fcn) (void); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
349 #endif |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
350 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
351 public: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
352 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
353 opengl_tessellator (void) : m_glu_tess (nullptr), m_fill () { init (); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
354 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
355 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
356 |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
357 opengl_tessellator (const opengl_tessellator&) = delete; |
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
358 |
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
359 opengl_tessellator operator = (const opengl_tessellator&) = delete; |
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
360 |
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
361 virtual ~opengl_tessellator (void) |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
362 { if (m_glu_tess) gluDeleteTess (m_glu_tess); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
363 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
364 void begin_polygon (bool filled = true) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
365 { |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
366 gluTessProperty (m_glu_tess, GLU_TESS_BOUNDARY_ONLY, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
367 (filled ? GL_FALSE : GL_TRUE)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
368 m_fill = filled; |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
369 gluTessBeginPolygon (m_glu_tess, this); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
370 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
371 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
372 void end_polygon (void) const |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
373 { gluTessEndPolygon (m_glu_tess); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
374 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
375 void begin_contour (void) const |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
376 { gluTessBeginContour (m_glu_tess); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
377 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
378 void end_contour (void) const |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
379 { gluTessEndContour (m_glu_tess); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
380 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
381 void add_vertex (double *loc, void *data) const |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
382 { gluTessVertex (m_glu_tess, loc, data); } |
22331
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 protected: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
385 virtual void begin (GLenum /*type*/) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
386 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
387 virtual void end (void) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
388 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
389 virtual void vertex (void * /*data*/) { } |
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 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
|
392 GLfloat [4] /*w*/, void ** /*out_data*/) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
393 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
394 virtual void edge_flag (GLboolean /*flag*/) { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
395 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
396 virtual void error (GLenum err) |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
397 { ::error ("OpenGL tessellation error (%d)", err); } |
22331
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 virtual void init (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
400 { |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
401 m_glu_tess = gluNewTess (); |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
402 |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
403 gluTessCallback (m_glu_tess, GLU_TESS_BEGIN_DATA, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
404 reinterpret_cast<fcn> (tess_begin)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
405 gluTessCallback (m_glu_tess, GLU_TESS_END_DATA, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
406 reinterpret_cast<fcn> (tess_end)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
407 gluTessCallback (m_glu_tess, GLU_TESS_VERTEX_DATA, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
408 reinterpret_cast<fcn> (tess_vertex)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
409 gluTessCallback (m_glu_tess, GLU_TESS_COMBINE_DATA, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
410 reinterpret_cast<fcn> (tess_combine)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
411 gluTessCallback (m_glu_tess, GLU_TESS_EDGE_FLAG_DATA, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
412 reinterpret_cast<fcn> (tess_edge_flag)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
413 gluTessCallback (m_glu_tess, GLU_TESS_ERROR_DATA, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
414 reinterpret_cast<fcn> (tess_error)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
415 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
416 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
417 bool is_filled (void) const { return m_fill; } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
418 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
419 private: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
420 static void CALLBACK tess_begin (GLenum type, void *t) |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
421 { reinterpret_cast<opengl_tessellator *> (t)->begin (type); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
422 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
423 static void CALLBACK tess_end (void *t) |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
424 { reinterpret_cast<opengl_tessellator *> (t)->end (); } |
22331
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 static void CALLBACK tess_vertex (void *v, void *t) |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
427 { reinterpret_cast<opengl_tessellator *> (t)->vertex (v); } |
22331
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 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
|
430 void **out, void *t) |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
431 { reinterpret_cast<opengl_tessellator *> (t)->combine (c, v, w, out); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
432 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
433 static void CALLBACK tess_edge_flag (GLboolean flag, void *t) |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
434 { reinterpret_cast<opengl_tessellator *> (t)->edge_flag (flag); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
435 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
436 static void CALLBACK tess_error (GLenum err, void *t) |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
437 { reinterpret_cast<opengl_tessellator *> (t)->error (err); } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
438 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
439 //-------- |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
440 |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
441 GLUtesselator *m_glu_tess; |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
442 bool m_fill; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
443 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
444 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
445 class vertex_data |
22331
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 public: |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
448 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
449 class vertex_data_rep |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
450 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
451 public: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
452 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
453 vertex_data_rep (void) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
454 : m_coords (), m_color (), m_vertex_normal (), m_face_normal (), |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
455 m_alpha (), m_ambient (), m_diffuse (), m_specular (), |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
456 m_specular_exp (), m_specular_color_refl () |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
457 { } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
458 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
459 vertex_data_rep (const Matrix& c, const Matrix& col, const Matrix& vn, |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
460 const Matrix& fn, double a, float as, float ds, float ss, |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
461 float se, float scr) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
462 : m_coords (c), m_color (col), m_vertex_normal (vn), |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
463 m_face_normal (fn), m_alpha (a), m_ambient (as), m_diffuse (ds), |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
464 m_specular (ss), m_specular_exp (se), m_specular_color_refl (scr) |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
465 { } |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
466 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
467 Matrix m_coords; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
468 Matrix m_color; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
469 Matrix m_vertex_normal; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
470 Matrix m_face_normal; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
471 double m_alpha; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
472 float m_ambient; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
473 float m_diffuse; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
474 float m_specular; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
475 float m_specular_exp; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
476 float m_specular_color_refl; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
477 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
478 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
479 public: |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
480 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
481 // Required to instantiate std::list<vertex_data> objects. |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
482 vertex_data (void) : m_rep (nil_rep ()) { } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
483 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
484 vertex_data (const Matrix& c, const Matrix& col, const Matrix& vn, |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
485 const Matrix& fn, double a, float as, float ds, float ss, |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
486 float se, float scr) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
487 : m_rep (new vertex_data_rep (c, col, vn, fn, a, as, ds, ss, se, scr)) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
488 { } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
489 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
490 vertex_data (const vertex_data&) = default; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
491 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
492 ~vertex_data (void) = default; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
493 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
494 vertex_data& operator = (const vertex_data&) = default; |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
495 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
496 vertex_data_rep * get_rep (void) const { return m_rep.get (); } |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
497 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
498 private: |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
499 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
500 static std::shared_ptr<vertex_data_rep> nil_rep (void) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
501 { |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
502 static std::shared_ptr<vertex_data_rep> nr (new vertex_data_rep ()); |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
503 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
504 return nr; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
505 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
506 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
507 std::shared_ptr<vertex_data_rep> m_rep; |
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
510 class |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
511 opengl_renderer::patch_tessellator : public opengl_tessellator |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
512 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
513 public: |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
514 patch_tessellator (opengl_renderer *r, int cmode, int lmode, bool fl, |
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
515 float idx = 0.0) |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
516 : opengl_tessellator (), m_renderer (r), |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
517 m_color_mode (cmode), m_light_mode (lmode), m_face_lighting (fl), |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
518 m_index (idx), m_first (true), m_tmp_vdata () |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
519 { } |
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 protected: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
522 void begin (GLenum type) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
523 { |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
524 opengl_functions& glfcns = m_renderer->get_opengl_functions (); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
525 |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
526 //printf ("patch_tessellator::begin (%d)\n", type); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
527 m_first = true; |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
528 |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
529 if (m_color_mode == INTERP || m_light_mode == GOURAUD) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
530 glfcns.glShadeModel (GL_SMOOTH); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
531 else |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
532 glfcns.glShadeModel (GL_FLAT); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
533 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
534 if (is_filled ()) |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
535 m_renderer->set_polygon_offset (true, m_index); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
536 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
537 glfcns.glBegin (type); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
538 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
539 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
540 void end (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
541 { |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
542 opengl_functions& glfcns = m_renderer->get_opengl_functions (); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
543 |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
544 //printf ("patch_tessellator::end\n"); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
545 glfcns.glEnd (); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
546 m_renderer->set_polygon_offset (false); |
22331
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 void vertex (void *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
550 { |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
551 opengl_functions& glfcns = m_renderer->get_opengl_functions (); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
552 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
553 vertex_data::vertex_data_rep *v |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
554 = reinterpret_cast<vertex_data::vertex_data_rep *> (data); |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
555 //printf ("patch_tessellator::vertex (%g, %g, %g)\n", v->m_coords(0), v->m_coords(1), v->m_coords(2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
556 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
557 // 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
|
558 // 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
|
559 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
560 if (m_color_mode == INTERP || (m_color_mode == FLAT && ! is_filled ())) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
561 { |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
562 Matrix col = v->m_color; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
563 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
564 if (col.numel () == 3) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
565 { |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
566 glfcns.glColor4d (col(0), col(1), col(2), v->m_alpha); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
567 if (m_light_mode > 0) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
568 { |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
569 // edge lighting only uses ambient light |
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
570 float buf[4] = { 0.0f, 0.0f, 0.0f, 1.0f };; |
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
571 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
572 if (m_face_lighting) |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
573 for (int k = 0; k < 3; k++) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
574 buf[k] = (v->m_specular |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
575 * (v->m_specular_color_refl + |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
576 (1 - v->m_specular_color_refl) * col(k))); |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
577 glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, buf); |
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
578 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
579 if (m_face_lighting) |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
580 for (int k = 0; k < 3; k++) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
581 buf[k] = (v->m_diffuse * col(k)); |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
582 glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, buf); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
583 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
584 for (int k = 0; k < 3; k++) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
585 buf[k] = (v->m_ambient * col(k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
586 glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, buf); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
587 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
588 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
589 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
590 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
591 if (m_light_mode == FLAT && m_first) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
592 glfcns.glNormal3dv (v->m_face_normal.data ()); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
593 else if (m_light_mode == GOURAUD) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
594 glfcns.glNormal3dv (v->m_vertex_normal.data ()); |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
595 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
596 glfcns.glVertex3dv (v->m_coords.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
597 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
598 m_first = false; |
7831
c7925666f0bf
Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7829
diff
changeset
|
599 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
600 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
601 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
|
602 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
603 vertex_data::vertex_data_rep *v[4]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
604 int vmax = 4; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
605 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
606 for (int i = 0; i < 4; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
607 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
608 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
|
609 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
610 if (vmax == 4 && ! v[i]) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
611 vmax = i; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
612 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
613 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
614 Matrix vv (1, 3, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
615 Matrix cc; |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
616 Matrix vnn (1, 3, 0.0); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
617 Matrix fnn (1, 3, 0.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
618 double aa = 0.0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
619 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
620 vv(0) = xyz[0]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
621 vv(1) = xyz[1]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
622 vv(2) = xyz[2]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
623 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
624 if (v[0]->m_color.numel ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
625 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
626 cc.resize (1, 3, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
627 for (int ic = 0; ic < 3; ic++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
628 for (int iv = 0; iv < vmax; iv++) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
629 cc(ic) += (w[iv] * v[iv]->m_color (ic)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
630 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
631 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
632 if (v[0]->m_vertex_normal.numel () > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
633 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
634 for (int in = 0; in < 3; in++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
635 for (int iv = 0; iv < vmax; iv++) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
636 vnn(in) += (w[iv] * v[iv]->m_vertex_normal (in)); |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
637 } |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
638 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
639 if (v[0]->m_face_normal.numel () > 0) |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
640 { |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
641 for (int in = 0; in < 3; in++) |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
642 for (int iv = 0; iv < vmax; iv++) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
643 fnn(in) += (w[iv] * v[iv]->m_face_normal (in)); |
22331
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
646 for (int iv = 0; iv < vmax; iv++) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
647 aa += (w[iv] * v[iv]->m_alpha); |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
648 |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
649 vertex_data new_v (vv, cc, vnn, fnn, aa, v[0]->m_ambient, v[0]->m_diffuse, |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
650 v[0]->m_specular, v[0]->m_specular_exp, |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
651 v[0]->m_specular_color_refl); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
652 m_tmp_vdata.push_back (new_v); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
653 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
654 *out_data = new_v.get_rep (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
655 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
656 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
657 private: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
658 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
659 // No copying! |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
660 |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
661 patch_tessellator (const patch_tessellator&) = delete; |
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
662 |
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
663 patch_tessellator& operator = (const patch_tessellator&) = delete; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
664 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
665 opengl_renderer *m_renderer; |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
666 int m_color_mode; |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
667 int m_light_mode; |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
668 bool m_face_lighting; |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
669 int m_index; |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
670 bool m_first; |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
671 std::list<vertex_data> m_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
|
672 }; |
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
|
673 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
674 #else |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
675 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
676 class |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
677 opengl_renderer::patch_tessellator |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
678 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
679 // Dummy class. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
680 }; |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
681 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
682 #endif |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
683 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
684 opengl_renderer::opengl_renderer (opengl_functions& glfcns) |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
685 : m_glfcns (glfcns), m_xmin (), m_xmax (), m_ymin (), m_ymax (), |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
686 m_zmin (), m_zmax (), m_devpixratio (1.0), m_xform (), m_toolkit (), |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
687 m_xZ1 (), m_xZ2 (), m_marker_id (), m_filled_marker_id (), |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
688 m_camera_pos (), m_camera_dir (), m_view_vector (), |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
689 m_interpreter ("none"), m_txt_renderer (), m_current_light (0), |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
690 m_max_lights (0), m_selecting (false), m_printing (false) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
691 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
692 // 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
|
693 // 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
|
694 // OpenGL types. |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
695 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
696 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
697 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
698 // 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
|
699 // FIXME: should we check signed vs. unsigned? |
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 static bool ok = (sizeof (int) <= sizeof (GLsizei)); |
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 if (! ok) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
704 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
|
705 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
706 #else |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
707 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
708 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
|
709 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
710 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
711 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
712 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
713 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
714 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
|
715 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
716 if (! go.valid_object ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
717 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
718 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
719 const base_properties& props = go.get_properties (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
720 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
721 if (! m_toolkit) |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
722 m_toolkit = props.get_toolkit (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
723 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
724 if (go.isa ("figure")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
725 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
|
726 else if (go.isa ("axes")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
727 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
|
728 else if (go.isa ("line")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
729 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
|
730 else if (go.isa ("surface")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
731 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
|
732 else if (go.isa ("patch")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
733 draw_patch (dynamic_cast<const patch::properties&> (props)); |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
734 else if (go.isa ("scatter")) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
735 draw_scatter (dynamic_cast<const scatter::properties&> (props)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
736 else if (go.isa ("light")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
737 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
|
738 else if (go.isa ("hggroup")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
739 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
|
740 else if (go.isa ("text")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
741 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
|
742 else if (go.isa ("image")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
743 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
|
744 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
|
745 || go.isa ("uicontextmenu") || go.isa ("uitoolbar") |
26112
36e0e5b428e7
Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents:
26025
diff
changeset
|
746 || go.isa ("uipushtool") || go.isa ("uitoggletool") |
36e0e5b428e7
Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents:
26025
diff
changeset
|
747 || go.isa ("uitable")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
748 ; // SKIP |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
749 else if (go.isa ("uipanel")) |
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 if (toplevel) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
752 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
|
753 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
754 else if (go.isa ("uibuttongroup")) |
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 if (toplevel) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
757 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
|
758 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
759 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
760 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
761 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
|
762 props.graphics_object_name ().c_str ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
763 } |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
764 |
22500
1d3b71530539
fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents:
22494
diff
changeset
|
765 #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
|
766 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
767 GLenum gl_error = m_glfcns.glGetError (); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
768 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
|
769 warning ("opengl_renderer: Error '%s' (%d) occurred drawing '%s' object", |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
770 gluErrorString (gl_error), gl_error, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
771 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
|
772 |
1d3b71530539
fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents:
22494
diff
changeset
|
773 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
774 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
775 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
776 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
777 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
|
778 { |
28189
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
779 m_printing = props.is___printing__ (); |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
780 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
781 // Initialize OpenGL context |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
782 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
|
783 |
21689
9467549bd5ff
* gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents:
21684
diff
changeset
|
784 #if defined (HAVE_OPENGL) |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
785 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
786 props.set___gl_extensions__ (get_string (GL_EXTENSIONS)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
787 props.set___gl_renderer__ (get_string (GL_RENDERER)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
788 props.set___gl_vendor__ (get_string (GL_VENDOR)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
789 props.set___gl_version__ (get_string (GL_VERSION)); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
790 |
21689
9467549bd5ff
* gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents:
21684
diff
changeset
|
791 #endif |
21684
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
792 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
793 // Draw children |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
794 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
795 draw (props.get_all_children (), false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
796 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
797 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
798 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
799 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
|
800 const graphics_object& go) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
801 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
802 graphics_object fig = go.get_ancestor ("figure"); |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
803 const figure::properties& figProps |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
804 = dynamic_cast<const figure::properties&> (fig.get_properties ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
805 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
806 // Initialize OpenGL context |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
807 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
808 init_gl_context (figProps.is_graphicssmoothing (), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
809 props.get_backgroundcolor_rgb ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
810 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
811 // Draw children |
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 draw (props.get_all_children (), false); |
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
816 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
817 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
|
818 const graphics_object& go) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
819 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
820 graphics_object fig = go.get_ancestor ("figure"); |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
821 const figure::properties& figProps |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
822 = dynamic_cast<const figure::properties&> (fig.get_properties ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
823 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
824 // Initialize OpenGL context |
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 init_gl_context (figProps.is_graphicssmoothing (), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
827 props.get_backgroundcolor_rgb ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
828 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
829 // Draw children |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
830 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
831 draw (props.get_all_children (), false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
832 } |
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 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
835 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
|
836 { |
21689
9467549bd5ff
* gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents:
21684
diff
changeset
|
837 #if defined (HAVE_OPENGL) |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
838 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
839 // Initialize OpenGL context |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
840 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
841 m_glfcns.glEnable (GL_DEPTH_TEST); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
842 m_glfcns.glDepthFunc (GL_LEQUAL); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
843 m_glfcns.glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
844 m_glfcns.glAlphaFunc (GL_GREATER, 0.0f); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
845 m_glfcns.glEnable (GL_NORMALIZE); |
27767
3212c50369cb
Make graphics antialiasing and blending independent (bug #57343)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27446
diff
changeset
|
846 m_glfcns.glEnable (GL_BLEND); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
847 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
848 if (enhanced) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
849 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
850 m_glfcns.glEnable (GL_MULTISAMPLE); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
851 bool has_multisample = false; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
852 if (! m_glfcns.glGetError ()) |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
853 { |
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
854 GLint iMultiSample, iNumSamples; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
855 m_glfcns.glGetIntegerv (GL_SAMPLE_BUFFERS, &iMultiSample); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
856 m_glfcns.glGetIntegerv (GL_SAMPLES, &iNumSamples); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
857 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
|
858 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
|
859 } |
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
860 |
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
861 if (! has_multisample) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
862 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
863 // MultiSample not implemented. Use old-style anti-aliasing |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
864 m_glfcns.glDisable (GL_MULTISAMPLE); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
865 // 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
|
866 // implemented. Thus, call glGetError to reset the error state. |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
867 m_glfcns.glGetError (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
868 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
869 m_glfcns.glEnable (GL_LINE_SMOOTH); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
870 m_glfcns.glHint (GL_LINE_SMOOTH_HINT, GL_NICEST); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
874 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
875 m_glfcns.glDisable (GL_LINE_SMOOTH); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
876 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
877 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
878 // Clear background |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
879 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
880 if (c.numel () >= 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
881 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
882 m_glfcns.glClearColor (c(0), c(1), c(2), 1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
883 m_glfcns.glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
884 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
885 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
886 GLenum gl_error = m_glfcns.glGetError (); |
22494
3564b6b6b8d1
Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22407
diff
changeset
|
887 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
|
888 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
|
889 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
|
890 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
891 #else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
892 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
893 octave_unused_parameter (enhanced); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
894 octave_unused_parameter (c); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
895 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
896 // 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
|
897 // 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
|
898 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
899 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
900 |
21689
9467549bd5ff
* gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents:
21684
diff
changeset
|
901 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
902 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
903 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
904 void |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
905 opengl_renderer::render_grid (const double linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
906 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
|
907 const Matrix& gridcolor, const double gridalpha, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
908 const Matrix& ticks, double lim1, double lim2, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
909 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
|
910 int xyz, bool is_3D) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
911 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
912 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
913 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
914 m_glfcns.glColor4d (gridcolor(0), gridcolor(1), gridcolor(2), gridalpha); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
915 set_linestyle (gridstyle, true, linewidth); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
916 m_glfcns.glBegin (GL_LINES); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
917 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
|
918 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
919 double val = ticks(i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
920 if (lim1 <= val && val <= lim2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
921 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
922 if (xyz == X_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
923 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
924 m_glfcns.glVertex3d (val, p1N, p2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
925 m_glfcns.glVertex3d (val, p1, p2); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
926 if (is_3D) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
927 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
928 m_glfcns.glVertex3d (val, p1, p2N); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
929 m_glfcns.glVertex3d (val, p1, p2); |
22331
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 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
932 else if (xyz == Y_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
933 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
934 m_glfcns.glVertex3d (p1N, val, p2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
935 m_glfcns.glVertex3d (p1, val, p2); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
936 if (is_3D) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
937 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
938 m_glfcns.glVertex3d (p1, val, p2N); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
939 m_glfcns.glVertex3d (p1, val, p2); |
22331
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 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
942 else if (xyz == Z_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
943 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
944 m_glfcns.glVertex3d (p1N, p2, val); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
945 m_glfcns.glVertex3d (p1, p2, val); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
946 m_glfcns.glVertex3d (p1, p2N, val); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
947 m_glfcns.glVertex3d (p1, p2, val); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
948 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
949 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
950 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
951 m_glfcns.glEnd (); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
952 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
|
953 double black[3] = {0, 0, 0}; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
954 m_glfcns.glColor3dv (black); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
955 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
956 #else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
957 |
22500
1d3b71530539
fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents:
22494
diff
changeset
|
958 octave_unused_parameter (linewidth); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
959 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
|
960 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
|
961 octave_unused_parameter (gridalpha); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
962 octave_unused_parameter (ticks); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
963 octave_unused_parameter (lim1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
964 octave_unused_parameter (lim2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
965 octave_unused_parameter (p1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
966 octave_unused_parameter (p1N); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
967 octave_unused_parameter (p2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
968 octave_unused_parameter (p2N); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
969 octave_unused_parameter (xyz); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
970 octave_unused_parameter (is_3D); |
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 // 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
|
973 // 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
|
974 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
975 panic_impossible (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
976 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
977 #endif |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
978 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
979 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
980 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
981 opengl_renderer::render_tickmarks (const Matrix& ticks, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
982 double lim1, double lim2, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
983 double p1, double p1N, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
984 double p2, double p2N, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
985 double dx, double dy, double dz, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
986 int xyz, bool mirror) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
987 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
988 #if defined (HAVE_OPENGL) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
989 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
990 m_glfcns.glBegin (GL_LINES); |
22331
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 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
|
993 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
994 double val = ticks(i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
995 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
996 if (lim1 <= val && val <= lim2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
997 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
998 if (xyz == X_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
999 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1000 m_glfcns.glVertex3d (val, p1, p2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1001 m_glfcns.glVertex3d (val, p1+dy, p2+dz); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1002 if (mirror) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1003 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1004 m_glfcns.glVertex3d (val, p1N, p2N); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1005 m_glfcns.glVertex3d (val, p1N-dy, p2N-dz); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1006 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1007 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1008 else if (xyz == Y_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1009 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1010 m_glfcns.glVertex3d (p1, val, p2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1011 m_glfcns.glVertex3d (p1+dx, val, p2+dz); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1012 if (mirror) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1013 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1014 m_glfcns.glVertex3d (p1N, val, p2N); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1015 m_glfcns.glVertex3d (p1N-dx, val, p2N-dz); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1016 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1017 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1018 else if (xyz == Z_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1019 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1020 m_glfcns.glVertex3d (p1, p2, val); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1021 m_glfcns.glVertex3d (p1+dx, p2+dy, val); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1022 if (mirror) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1023 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1024 m_glfcns.glVertex3d (p1N, p2N, val); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1025 m_glfcns.glVertex3d (p1N-dx, p2N-dy, val); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1026 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1027 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1028 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1029 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1030 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1031 m_glfcns.glEnd (); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1032 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1033 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1034 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1035 octave_unused_parameter (ticks); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1036 octave_unused_parameter (lim1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1037 octave_unused_parameter (lim2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1038 octave_unused_parameter (p1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1039 octave_unused_parameter (p1N); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1040 octave_unused_parameter (p2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1041 octave_unused_parameter (p2N); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1042 octave_unused_parameter (dx); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1043 octave_unused_parameter (dy); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1044 octave_unused_parameter (dz); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1045 octave_unused_parameter (xyz); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1046 octave_unused_parameter (mirror); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1047 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1048 // 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
|
1049 // 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
|
1050 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1051 panic_impossible (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1052 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1053 #endif |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1054 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1055 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1056 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1057 opengl_renderer::render_ticktexts (const Matrix& ticks, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1058 const string_vector& ticklabels, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1059 double lim1, double lim2, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1060 double p1, double p2, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1061 int xyz, int ha, int va, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1062 int& wmax, int& hmax) |
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 #if defined (HAVE_OPENGL) |
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 int nticks = ticks.numel (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1067 int nlabels = ticklabels.numel (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1068 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1069 if (nlabels == 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1070 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1071 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1072 for (int i = 0; i < nticks; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1073 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1074 double val = ticks(i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1075 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1076 if (lim1 <= val && val <= lim2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1077 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1078 Matrix b; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1079 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1080 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
|
1081 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
|
1082 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
|
1083 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1084 // 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
|
1085 // drawn after axes object, for correct rendering? |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1086 if (xyz == X_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1087 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1088 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
|
1089 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1090 else if (xyz == Y_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1091 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1092 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
|
1093 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1094 else if (xyz == Z_AXIS) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1095 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1096 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
|
1097 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1098 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1099 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
|
1100 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
|
1101 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1102 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1103 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1104 #else |
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 octave_unused_parameter (ticks); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1107 octave_unused_parameter (ticklabels); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1108 octave_unused_parameter (lim1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1109 octave_unused_parameter (lim2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1110 octave_unused_parameter (p1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1111 octave_unused_parameter (p2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1112 octave_unused_parameter (xyz); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1113 octave_unused_parameter (ha); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1114 octave_unused_parameter (va); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1115 octave_unused_parameter (wmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1116 octave_unused_parameter (hmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1117 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1118 // 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
|
1119 // 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
|
1120 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1121 panic_impossible (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1122 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1123 #endif |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1124 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1125 |
25863
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1126 void |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1127 opengl_renderer::draw_zoom_rect (int x1, int y1, int x2, int y2) |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1128 { |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1129 #if defined (HAVE_OPENGL) |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1130 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1131 m_glfcns.glVertex2d (x1, y1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1132 m_glfcns.glVertex2d (x2, y1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1133 m_glfcns.glVertex2d (x2, y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1134 m_glfcns.glVertex2d (x1, y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1135 m_glfcns.glVertex2d (x1, y1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1136 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1137 #else |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1138 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1139 octave_unused_parameter (x1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1140 octave_unused_parameter (x2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1141 octave_unused_parameter (y1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1142 octave_unused_parameter (y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1143 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1144 // This shouldn't happen because construction of opengl_renderer |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1145 // objects is supposed to be impossible if OpenGL is not available. |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1146 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1147 panic_impossible (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1148 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1149 #endif |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1150 } |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1151 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1152 void |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1153 opengl_renderer::draw_zoom_box (int width, int height, |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1154 int x1, int y1, int x2, int y2, |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1155 const Matrix& overlaycolor, |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1156 double overlayalpha, |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1157 const Matrix& bordercolor, |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1158 double borderalpha, double borderwidth) |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1159 { |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1160 #if defined (HAVE_OPENGL) |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1161 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1162 m_glfcns.glMatrixMode (GL_MODELVIEW); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1163 m_glfcns.glPushMatrix (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1164 m_glfcns.glLoadIdentity (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1165 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1166 m_glfcns.glMatrixMode (GL_PROJECTION); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1167 m_glfcns.glPushMatrix (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1168 m_glfcns.glLoadIdentity (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1169 m_glfcns.glOrtho (0, width, height, 0, 1, -1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1170 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1171 m_glfcns.glPushAttrib (GL_DEPTH_BUFFER_BIT | GL_CURRENT_BIT); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1172 m_glfcns.glDisable (GL_DEPTH_TEST); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1173 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1174 m_glfcns.glBegin (GL_POLYGON); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1175 m_glfcns.glColor4f (overlaycolor(0), overlaycolor(1), overlaycolor(2), |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1176 overlayalpha); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1177 draw_zoom_rect (x1, y1, x2, y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1178 m_glfcns.glEnd (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1179 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1180 m_glfcns.glLineWidth (borderwidth); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1181 m_glfcns.glBegin (GL_LINE_STRIP); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1182 m_glfcns.glColor4f (bordercolor(0), bordercolor(1), bordercolor(2), |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1183 borderalpha); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1184 draw_zoom_rect (x1, y1, x2, y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1185 m_glfcns.glEnd (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1186 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1187 m_glfcns.glPopAttrib (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1188 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1189 m_glfcns.glMatrixMode (GL_MODELVIEW); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1190 m_glfcns.glPopMatrix (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1191 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1192 m_glfcns.glMatrixMode (GL_PROJECTION); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1193 m_glfcns.glPopMatrix (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1194 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1195 #else |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1196 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1197 octave_unused_parameter (width); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1198 octave_unused_parameter (height); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1199 octave_unused_parameter (x1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1200 octave_unused_parameter (x2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1201 octave_unused_parameter (y1); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1202 octave_unused_parameter (y2); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1203 octave_unused_parameter (overlaycolor); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1204 octave_unused_parameter (overlayalpha); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1205 octave_unused_parameter (bordercolor); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1206 octave_unused_parameter (borderalpha); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1207 octave_unused_parameter (borderwidth); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1208 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1209 // This shouldn't happen because construction of opengl_renderer |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1210 // objects is supposed to be impossible if OpenGL is not available. |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1211 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1212 panic_impossible (); |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1213 |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1214 #endif |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1215 } |
8a6bf76abf31
eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents:
25862
diff
changeset
|
1216 |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1217 uint8NDArray |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1218 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
|
1219 { |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1220 #if defined (HAVE_OPENGL) |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1221 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1222 m_glfcns.glPixelStorei (GL_PACK_ALIGNMENT, 1); |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1223 uint8NDArray pix(dim_vector (3, width, height), 0); |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25980
diff
changeset
|
1224 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1225 m_glfcns.glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25980
diff
changeset
|
1226 pix.fortran_vec ()); |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1227 |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1228 // 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
|
1229 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
|
1230 perm(0) = 2; |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1231 perm(1) = 1; |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1232 perm(2) = 0; |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1233 |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1234 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
|
1235 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
|
1236 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
|
1237 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
|
1238 |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1239 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
|
1240 |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1241 #else |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1242 |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1243 // This shouldn't happen because construction of opengl_renderer |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1244 // objects is supposed to be impossible if OpenGL is not available. |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1245 |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1246 octave_unused_parameter (width); |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1247 octave_unused_parameter (height); |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1248 |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
1249 panic_impossible (); |
23535
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1250 |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1251 #endif |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1252 } |
2aab625b502c
Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23479
diff
changeset
|
1253 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1254 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1255 opengl_renderer::finish (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1256 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1257 #if defined (HAVE_OPENGL) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1258 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1259 m_glfcns.glFinish (); |
22331
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 #else |
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 // 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
|
1264 // 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
|
1265 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1266 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1267 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1268 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1269 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1270 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1271 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1272 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
|
1273 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1274 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1275 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1276 // setup OpenGL transformation |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1277 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1278 Matrix x_zlim = props.get_transform_zlim (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1279 |
28763
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1280 // Expand the distance between the clipping planes symmetrically by |
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1281 // an arbitrary factor (see bug #54551). |
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1282 const double expansion_fac = 100.0; |
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1283 // Also make sure that the distance between the clipping planes |
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1284 // differs in single precision (see bug #58956). This factor is also |
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1285 // arbitrary. Different values (>2) might also work. |
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1286 const double single_prec_fac = 10.0; |
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1287 |
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1288 double avgZ = x_zlim(0) / 2.0 + x_zlim(1) / 2.0; |
29127
a948253f9976
maint: strip trailing spaces from code base.
Rik <rik@octave.org>
parents:
28857
diff
changeset
|
1289 double span |
28763
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1290 = std::max (expansion_fac * (x_zlim(1)-x_zlim(0)), |
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1291 single_prec_fac * std::abs (avgZ) |
b8e9e012bb21
Improve rendering issues due to small distance between clipping plains (bug #58956).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28559
diff
changeset
|
1292 * std::numeric_limits<float>::epsilon ()); |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1293 m_xZ1 = avgZ - span; |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1294 m_xZ2 = avgZ + span; |
22331
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 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
|
1297 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
|
1298 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1299 m_glfcns.glMatrixMode (GL_MODELVIEW); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1300 m_glfcns.glLoadIdentity (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1301 m_glfcns.glScaled (1, 1, -1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1302 m_glfcns.glMultMatrixd (x_mat1.data ()); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1303 m_glfcns.glMatrixMode (GL_PROJECTION); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1304 m_glfcns.glLoadIdentity (); |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25871
diff
changeset
|
1305 |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
1306 Matrix vp = get_viewport_scaled (); |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1307 m_glfcns.glOrtho (0, vp(2), vp(3), 0, m_xZ1, m_xZ2); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1308 m_glfcns.glMultMatrixd (x_mat2.data ()); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1309 m_glfcns.glMatrixMode (GL_MODELVIEW); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1310 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1311 m_glfcns.glClear (GL_DEPTH_BUFFER_BIT); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1312 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1313 // store axes transformation data |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1314 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1315 m_xform = props.get_transform (); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1316 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1317 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1318 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1319 octave_unused_parameter (props); |
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 // 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
|
1322 // 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
|
1323 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1324 panic_impossible (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1325 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1326 #endif |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1327 } |
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 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1330 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
|
1331 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1332 #if defined (HAVE_OPENGL) |
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 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
|
1335 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
|
1336 return; |
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 double xPlane = props.get_xPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1339 double yPlane = props.get_yPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1340 double zPlane = props.get_zPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1341 double xPlaneN = props.get_xPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1342 double yPlaneN = props.get_yPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1343 double zPlaneN = props.get_zPlaneN (); |
26020
912e1daa03d2
maint: Use 2D, 3D in variable names in graphics code rather than 2d,3d.
Rik <rik@octave.org>
parents:
25999
diff
changeset
|
1344 bool is2D = props.get_is2D (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1345 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1346 // Axes planes |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1347 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
|
1348 set_polygon_offset (true, 9.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1349 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1350 m_glfcns.glBegin (GL_QUADS); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1351 |
26020
912e1daa03d2
maint: Use 2D, 3D in variable names in graphics code rather than 2d,3d.
Rik <rik@octave.org>
parents:
25999
diff
changeset
|
1352 if (! is2D) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1353 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1354 // X plane |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1355 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1356 m_glfcns.glVertex3d (xPlane, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1357 m_glfcns.glVertex3d (xPlane, yPlane, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1358 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlane); |
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 // Y plane |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1361 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1362 m_glfcns.glVertex3d (xPlane, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1363 m_glfcns.glVertex3d (xPlane, yPlane, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1364 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1365 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1366 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1367 // Z plane |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1368 m_glfcns.glVertex3d (xPlaneN, yPlaneN, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1369 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1370 m_glfcns.glVertex3d (xPlane, yPlane, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1371 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlane); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1372 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1373 m_glfcns.glEnd (); |
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 set_polygon_offset (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1376 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1377 #else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1378 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1379 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1380 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1381 // 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
|
1382 // 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
|
1383 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1384 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1385 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1386 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1387 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1388 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1389 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1390 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
|
1391 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1392 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1393 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1394 if (! props.is_visible ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1395 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1396 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1397 bool xySym = props.get_xySym (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1398 bool layer2Dtop = props.get_layer2Dtop (); |
26020
912e1daa03d2
maint: Use 2D, 3D in variable names in graphics code rather than 2d,3d.
Rik <rik@octave.org>
parents:
25999
diff
changeset
|
1399 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
|
1400 bool isXOrigin = props.xaxislocation_is ("origin") |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1401 && ! props.yscale_is ("log"); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1402 bool isYOrigin = props.yaxislocation_is ("origin") |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1403 && ! props.xscale_is ("log"); |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1404 bool boxFull = (props.get_boxstyle () == "full"); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1405 double linewidth = props.get_linewidth (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1406 double xPlane = props.get_xPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1407 double yPlane = props.get_yPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1408 double zPlane = props.get_zPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1409 double xPlaneN = props.get_xPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1410 double yPlaneN = props.get_yPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1411 double zPlaneN = props.get_zPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1412 double xpTick = props.get_xpTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1413 double ypTick = props.get_ypTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1414 double zpTick = props.get_zpTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1415 double xpTickN = props.get_xpTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1416 double ypTickN = props.get_ypTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1417 double zpTickN = props.get_zpTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1418 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1419 bool plotyy = (props.has_property ("__plotyy_axes__")); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1420 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1421 // Axes box |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1422 |
24807
8585b3f9c28c
Use "butt" linecap to workaround split lines in printout (bug #53229).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24725
diff
changeset
|
1423 set_linecap ("square"); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1424 set_linestyle ("-", true, linewidth); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1425 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1426 m_glfcns.glBegin (GL_LINES); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1427 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1428 if (layer2Dtop) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1429 std::swap (zpTick, zpTickN); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1430 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1431 // X box |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1432 Matrix color = props.get_xcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1433 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1434 if (! color.isempty ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1435 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1436 set_color (color); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1437 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1438 if (! isXOrigin || props.is_box() || ! is2D) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1439 { |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1440 m_glfcns.glVertex3d (xPlaneN, ypTick, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1441 m_glfcns.glVertex3d (xPlane, ypTick, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1442 } |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1443 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1444 if (props.is_box ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1445 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1446 m_glfcns.glVertex3d (xPlaneN, ypTickN, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1447 m_glfcns.glVertex3d (xPlane, ypTickN, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1448 if (! is2D) |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1449 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1450 m_glfcns.glVertex3d (xPlaneN, ypTickN, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1451 m_glfcns.glVertex3d (xPlane, ypTickN, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1452 if (boxFull) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1453 { |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1454 m_glfcns.glVertex3d (xPlaneN, ypTick, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1455 m_glfcns.glVertex3d (xPlane, ypTick, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1456 } |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1457 } |
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 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1460 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1461 // Y box |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1462 color = props.get_ycolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1463 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1464 if (! color.isempty ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1465 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1466 set_color (color); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1467 if (! isYOrigin || props.is_box() || ! is2D) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1468 { |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1469 m_glfcns.glVertex3d (xpTick, yPlaneN, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1470 m_glfcns.glVertex3d (xpTick, yPlane, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1471 } |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1472 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1473 if (props.is_box () && ! plotyy) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1474 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1475 m_glfcns.glVertex3d (xpTickN, yPlaneN, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1476 m_glfcns.glVertex3d (xpTickN, yPlane, zpTick); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1477 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1478 if (! is2D) |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1479 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1480 m_glfcns.glVertex3d (xpTickN, yPlaneN, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1481 m_glfcns.glVertex3d (xpTickN, yPlane, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1482 if (boxFull) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1483 { |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1484 m_glfcns.glVertex3d (xpTick, yPlaneN, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1485 m_glfcns.glVertex3d (xpTick, yPlane, zpTickN); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1486 } |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1487 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1488 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1489 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1490 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1491 // Z box |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1492 color = props.get_zcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1493 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1494 if (! color.isempty () && ! is2D) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1495 { |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1496 set_color (color); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1497 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1498 if (xySym) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1499 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1500 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1501 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1502 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1503 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1504 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1505 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1506 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1507 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1508 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1509 if (props.is_box ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1510 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1511 m_glfcns.glVertex3d (xPlane, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1512 m_glfcns.glVertex3d (xPlane, yPlane, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1513 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1514 if (xySym) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1515 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1516 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1517 m_glfcns.glVertex3d (xPlane, yPlaneN, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1518 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1519 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1520 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1521 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1522 m_glfcns.glVertex3d (xPlaneN, yPlane, zPlane); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1523 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1524 |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1525 if (boxFull) |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1526 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1527 m_glfcns.glVertex3d (xPlaneN, yPlaneN, zPlaneN); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1528 m_glfcns.glVertex3d (xPlaneN, yPlaneN, zPlane); |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22362
diff
changeset
|
1529 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1530 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1531 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1532 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1533 m_glfcns.glEnd (); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1534 |
25260
601cc3a063f5
Fix OpenGL line-stipple bug manifested as Nouveau driver crash (bug #53644)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1535 set_linestyle ("-"); // Disable LineStipple |
601cc3a063f5
Fix OpenGL line-stipple bug manifested as Nouveau driver crash (bug #53644)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
1536 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1537 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1538 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1539 octave_unused_parameter (props); |
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 // 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
|
1542 // 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
|
1543 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1544 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
1545 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1546 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1547 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1548 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1549 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1550 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
|
1551 { |
22740
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1552 #if defined (HAVE_OPENGL) |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1553 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
1554 gh_manager& gh_mgr = __get_gh_manager__ (); |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
1555 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1556 int xstate = props.get_xstate (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1557 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
1558 if (xstate != AXE_DEPTH_DIR |
24634
ab2321d4ba03
maint: strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1559 && (props.is_visible () |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1560 || (m_selecting && props.pickableparts_is ("all")))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1561 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1562 int zstate = props.get_zstate (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1563 bool x2Dtop = props.get_x2Dtop (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1564 bool layer2Dtop = props.get_layer2Dtop (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1565 bool xyzSym = props.get_xyzSym (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1566 bool nearhoriz = props.get_nearhoriz (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1567 double xticklen = props.get_xticklen (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1568 double xtickoffset = props.get_xtickoffset (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1569 double fy = props.get_fy (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1570 double fz = props.get_fz (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1571 double x_min = props.get_x_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1572 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
|
1573 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
|
1574 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
|
1575 double yPlane = props.get_yPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1576 double yPlaneN = props.get_yPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1577 double ypTick = props.get_ypTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1578 double ypTickN = props.get_ypTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1579 double zPlane = props.get_zPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1580 double zPlaneN = props.get_zPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1581 double zpTick = props.get_zpTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1582 double zpTickN = props.get_zpTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1583 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1584 // X ticks and grid properties |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1585 Matrix xticks = m_xform.xscale (props.get_xtick ().matrix_value ()); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1586 Matrix xmticks = m_xform.xscale (props.get_xminortickvalues ().matrix_value ()); |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1587 bool do_xminortick = props.is_xminortick () && ! xticks.isempty (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1588 string_vector xticklabels = props.get_xticklabel ().string_vector_value (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1589 int wmax = 0; |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1590 int hmax = 0; |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1591 bool tick_along_z = nearhoriz || math::isinf (fy); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1592 double linewidth = props.get_linewidth (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1593 std::string gridstyle = props.get_gridlinestyle (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1594 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
|
1595 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
|
1596 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
|
1597 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
|
1598 double minorgridalpha = props.get_minorgridalpha (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1599 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
|
1600 bool do_xminorgrid = (props.is_xminorgrid () |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1601 && (minorgridstyle != "none") |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1602 && ! xticks.isempty ()); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1603 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
|
1604 && ! props.yscale_is ("log"); |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1605 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
|
1606 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
|
1607 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1608 // X grid |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1609 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1610 // possibly use axis color for gridcolor & minorgridcolor |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1611 if (props.gridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1612 if (props.xcolormode_is ("manual") && ! props.xcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1613 gridcolor = props.get_xcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1614 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1615 if (props.minorgridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1616 if (props.xcolormode_is ("manual") && ! props.xcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1617 minorgridcolor = props.get_xcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1618 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1619 if (gridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1620 do_xgrid = false; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1621 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1622 if (minorgridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1623 do_xminorgrid = false; |
22528
5a1167e15c0e
Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22500
diff
changeset
|
1624 |
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
|
1625 // 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
|
1626 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
|
1627 { |
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 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
|
1629 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
|
1630 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
|
1631 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
|
1632 } |
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 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1634 // minor grid lines |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1635 if (do_xminorgrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1636 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1637 minorgridstyle, minorgridcolor, minorgridalpha, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1638 xmticks, x_min, x_max, |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1639 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1640 0, (zstate != AXE_DEPTH_DIR)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1641 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1642 // grid lines |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1643 if (do_xgrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1644 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1645 gridstyle, gridcolor, gridalpha, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1646 xticks, x_min, x_max, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1647 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1648 0, (zstate != AXE_DEPTH_DIR)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1649 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1650 // Skip drawing axis, ticks, and ticklabels when color is "none" |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1651 if (props.xcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1652 return; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1653 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1654 set_color (props.get_xcolor_rgb ()); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1655 |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1656 // axis line |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1657 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
|
1658 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
|
1659 { |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1660 y_axis_pos = math::max (math::min (0., y_max), y_min); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1661 m_glfcns.glBegin (GL_LINES); |
26430
a665b4823da9
gl-render.cc (draw_axes_x_grid): Fix copy & paste error (bug #55390).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26417
diff
changeset
|
1662 set_color (props.get_xcolor_rgb ()); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1663 m_glfcns.glVertex3d (x_min, y_axis_pos, zpTick); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1664 m_glfcns.glVertex3d (x_max, y_axis_pos, zpTick); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1665 m_glfcns.glEnd (); |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1666 } |
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1667 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1668 // minor tick marks |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1669 if (do_xminortick) |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1670 { |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1671 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
|
1672 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
|
1673 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
|
1674 zpTick, zpTickN, 0., 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1675 (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
|
1676 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
|
1677 0, ! is_origin && mirror); |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1678 else |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1679 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
|
1680 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
|
1681 zpTick, zpTick, 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1682 (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
|
1683 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
|
1684 0., 0, ! is_origin && mirror); |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1685 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1686 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1687 // tick marks |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1688 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
|
1689 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
|
1690 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
|
1691 zpTick, zpTickN, 0., 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1692 (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
|
1693 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
|
1694 0, ! is_origin && mirror); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1695 else |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1696 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
|
1697 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
|
1698 zpTick, zpTick, 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1699 (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
|
1700 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
|
1701 0., 0, ! is_origin && mirror); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1702 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1703 // tick texts |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1704 if (xticklabels.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1705 { |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1706 int halign = (xstate == AXE_HORZ_DIR |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1707 ? 1 |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1708 : (xyzSym || is_origin_low ? 0 : 2)); |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1709 int valign = (xstate == AXE_VERT_DIR |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1710 ? 1 |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1711 : (x2Dtop || is_origin_low ? 0 : 2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1712 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1713 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
|
1714 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
|
1715 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
|
1716 zpTick + |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1717 (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
|
1718 math::signum (zpTick-zpTickN)*fz*xtickoffset, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1719 0, halign, valign, wmax, hmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1720 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1721 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
|
1722 (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
|
1723 (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
|
1724 math::signum (ypTick-ypTickN)*fy*xtickoffset, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1725 zpTick, 0, halign, valign, wmax, hmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1726 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1727 |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
1728 gh_mgr.get_object (props.get_xlabel ()).set ("visible", "on"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1729 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1730 else |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
1731 gh_mgr.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
|
1732 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1733 #else |
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 octave_unused_parameter (props); |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1736 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1737 // 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
|
1738 // 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
|
1739 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1740 panic_impossible (); |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1741 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1742 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1743 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1744 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1745 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1746 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
|
1747 { |
22740
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1748 #if defined (HAVE_OPENGL) |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1749 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
1750 gh_manager& gh_mgr = __get_gh_manager__ (); |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
1751 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1752 int ystate = props.get_ystate (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1753 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
1754 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
|
1755 && (props.is_visible () |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1756 || (m_selecting && props.pickableparts_is ("all")))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1757 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1758 int zstate = props.get_zstate (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1759 bool y2Dright = props.get_y2Dright (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1760 bool layer2Dtop = props.get_layer2Dtop (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1761 bool xyzSym = props.get_xyzSym (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1762 bool nearhoriz = props.get_nearhoriz (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1763 double yticklen = props.get_yticklen (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1764 double ytickoffset = props.get_ytickoffset (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1765 double fx = props.get_fx (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1766 double fz = props.get_fz (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1767 double xPlane = props.get_xPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1768 double xPlaneN = props.get_xPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1769 double xpTick = props.get_xpTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1770 double xpTickN = props.get_xpTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1771 double y_min = props.get_y_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1772 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
|
1773 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
|
1774 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
|
1775 double zPlane = props.get_zPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1776 double zPlaneN = props.get_zPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1777 double zpTick = props.get_zpTick (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1778 double zpTickN = props.get_zpTickN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1779 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1780 // Y ticks and grid properties |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1781 Matrix yticks = m_xform.yscale (props.get_ytick ().matrix_value ()); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1782 Matrix ymticks = m_xform.yscale (props.get_yminortickvalues ().matrix_value ()); |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1783 bool do_yminortick = props.is_yminortick () && ! yticks.isempty (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1784 string_vector yticklabels = props.get_yticklabel ().string_vector_value (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1785 int wmax = 0; |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1786 int hmax = 0; |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1787 bool tick_along_z = nearhoriz || math::isinf (fx); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1788 double linewidth = props.get_linewidth (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1789 std::string gridstyle = props.get_gridlinestyle (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1790 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
|
1791 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
|
1792 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
|
1793 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
|
1794 double minorgridalpha = props.get_minorgridalpha (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1795 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
|
1796 bool do_yminorgrid = (props.is_yminorgrid () |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1797 && (minorgridstyle != "none") |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1798 && ! yticks.isempty ()); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1799 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
|
1800 && ! props.xscale_is ("log"); |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1801 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
|
1802 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
|
1803 && (! props.has_property ("__plotyy_axes__")); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1804 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1805 // Y grid |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1806 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1807 // possibly use axis color for gridcolor & minorgridcolor |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1808 if (props.gridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1809 if (props.ycolormode_is ("manual") && ! props.ycolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1810 gridcolor = props.get_ycolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1811 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1812 if (props.minorgridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1813 if (props.ycolormode_is ("manual") && ! props.ycolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1814 minorgridcolor = props.get_ycolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1815 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1816 if (gridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1817 do_ygrid = false; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1818 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1819 if (minorgridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1820 do_yminorgrid = false; |
22528
5a1167e15c0e
Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22500
diff
changeset
|
1821 |
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
|
1822 // 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
|
1823 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
|
1824 { |
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
|
1825 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
|
1826 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
|
1827 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
|
1828 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
|
1829 } |
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
|
1830 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1831 // minor grid lines |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1832 if (do_yminorgrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1833 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1834 minorgridstyle, minorgridcolor, minorgridalpha, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1835 ymticks, y_min, y_max, |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1836 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1837 1, (zstate != AXE_DEPTH_DIR)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1838 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1839 // grid lines |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1840 if (do_ygrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1841 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1842 gridstyle, gridcolor, gridalpha, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1843 yticks, y_min, y_max, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1844 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1845 1, (zstate != AXE_DEPTH_DIR)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1846 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1847 // Skip drawing axis, ticks, and ticklabels when color is "none" |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1848 if (props.ycolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1849 return; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1850 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1851 set_color (props.get_ycolor_rgb ()); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1852 |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1853 // axis line |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1854 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
|
1855 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
|
1856 { |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25058
diff
changeset
|
1857 x_axis_pos = math::max (math::min (0., x_max), x_min); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1858 m_glfcns.glBegin (GL_LINES); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1859 set_color (props.get_ycolor_rgb ()); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1860 m_glfcns.glVertex3d (x_axis_pos, y_min, zpTick); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1861 m_glfcns.glVertex3d (x_axis_pos, y_max, zpTick); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
1862 m_glfcns.glEnd (); |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1863 } |
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1864 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1865 // minor tick marks |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1866 if (do_yminortick) |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1867 { |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1868 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
|
1869 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
|
1870 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
|
1871 zpTick, zpTickN, 0., 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1872 (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
|
1873 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
|
1874 1, ! is_origin && mirror); |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1875 else |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1876 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
|
1877 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
|
1878 zpTick, zpTick, |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1879 (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
|
1880 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
|
1881 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
|
1882 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
1883 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1884 // tick marks |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1885 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
|
1886 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
|
1887 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
|
1888 zpTick, zpTickN, 0., 0., |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1889 (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
|
1890 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
|
1891 1, ! is_origin && mirror); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1892 else |
22711
074765d5c83b
Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22623
diff
changeset
|
1893 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
|
1894 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
|
1895 zpTick, zpTick, |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1896 (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
|
1897 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
|
1898 0., 0., 1, ! is_origin && mirror); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1899 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1900 // tick texts |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1901 if (yticklabels.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1902 { |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1903 int halign = (ystate == AXE_HORZ_DIR |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1904 ? 1 |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1905 : (! 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
|
1906 int valign = (ystate == AXE_VERT_DIR |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1907 ? 1 |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
1908 : (is_origin_low ? 0 : 2)); |
22331
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 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
|
1911 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
|
1912 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
|
1913 zpTick + |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
1914 (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
|
1915 math::signum (zpTick-zpTickN)*fz*ytickoffset, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1916 1, halign, valign, wmax, hmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1917 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1918 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
|
1919 (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
|
1920 (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
|
1921 math::signum (xpTick-xpTickN)*fx*ytickoffset, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1922 zpTick, 1, halign, valign, wmax, hmax); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1923 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1924 |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
1925 gh_mgr.get_object (props.get_ylabel ()).set ("visible", "on"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1926 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1927 else |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
1928 gh_mgr.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
|
1929 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1930 #else |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1931 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1932 octave_unused_parameter (props); |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1933 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1934 // 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
|
1935 // 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
|
1936 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1937 panic_impossible (); |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1938 |
3b2a30e9e49f
build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents:
22711
diff
changeset
|
1939 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1940 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1941 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1942 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1943 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
|
1944 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
1945 gh_manager& gh_mgr = __get_gh_manager__ (); |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
1946 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1947 int zstate = props.get_zstate (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1948 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
1949 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
|
1950 && (props.is_visible () |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1951 || (m_selecting && props.pickableparts_is ("all")))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1952 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1953 bool xySym = props.get_xySym (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1954 bool zSign = props.get_zSign (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1955 double zticklen = props.get_zticklen (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1956 double ztickoffset = props.get_ztickoffset (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1957 double fx = props.get_fx (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1958 double fy = props.get_fy (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1959 double xPlane = props.get_xPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1960 double xPlaneN = props.get_xPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1961 double yPlane = props.get_yPlane (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1962 double yPlaneN = props.get_yPlaneN (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1963 double z_min = props.get_z_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1964 double z_max = props.get_z_max (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1965 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1966 // Z ticks and grid properties |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1967 Matrix zticks = m_xform.zscale (props.get_ztick ().matrix_value ()); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
1968 Matrix zmticks = m_xform.zscale (props.get_zminortickvalues ().matrix_value ()); |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1969 bool do_zminortick = props.is_zminortick () && ! zticks.isempty (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1970 string_vector zticklabels = props.get_zticklabel ().string_vector_value (); |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1971 int wmax = 0; |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1972 int hmax = 0; |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1973 double linewidth = props.get_linewidth (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1974 std::string gridstyle = props.get_gridlinestyle (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1975 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
|
1976 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
|
1977 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
|
1978 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
|
1979 double minorgridalpha = props.get_minorgridalpha (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1980 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
|
1981 bool do_zminorgrid = (props.is_zminorgrid () |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1982 && (minorgridstyle != "none") |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1983 && ! zticks.isempty ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1984 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
|
1985 |
26669
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1986 // Z grid |
879f22ca59c8
gl-render.cc: Omit minor grid and minor ticks if ticks are empty (bug #55633).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26564
diff
changeset
|
1987 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1988 // possibly use axis color for gridcolor & minorgridcolor |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1989 if (props.gridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1990 if (props.zcolormode_is ("manual") && ! props.zcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1991 gridcolor = props.get_zcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1992 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1993 if (props.minorgridcolormode_is ("auto")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1994 if (props.zcolormode_is ("manual") && ! props.zcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1995 minorgridcolor = props.get_zcolor_rgb (); |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1996 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1997 if (gridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1998 do_zgrid = false; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
1999 |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
2000 if (minorgridcolor.isempty ()) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
2001 do_zminorgrid = false; |
22528
5a1167e15c0e
Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22500
diff
changeset
|
2002 |
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
|
2003 // 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
|
2004 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
|
2005 { |
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
|
2006 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
|
2007 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
|
2008 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
|
2009 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
|
2010 } |
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
|
2011 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2012 // minor grid lines |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2013 if (do_zminorgrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2014 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2015 minorgridstyle, minorgridcolor, minorgridalpha, |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2016 zmticks, z_min, z_max, |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2017 xPlane, xPlaneN, yPlane, yPlaneN, 2, true); |
22331
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 // grid lines |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2020 if (do_zgrid) |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2021 render_grid (linewidth, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2022 gridstyle, gridcolor, gridalpha, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2023 zticks, z_min, z_max, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2024 xPlane, xPlaneN, yPlane, yPlaneN, 2, true); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2025 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
2026 // Skip drawing axis, ticks, and ticklabels when color is "none" |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
2027 if (props.zcolor_is ("none")) |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
2028 return; |
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
2029 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2030 set_color (props.get_zcolor_rgb ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2031 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2032 // minor tick marks |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2033 if (do_zminortick) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2034 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2035 if (xySym) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2036 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2037 if (math::isinf (fy)) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2038 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
|
2039 yPlane, yPlane, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2040 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
|
2041 0., 0., 2, mirror); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2042 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2043 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
|
2044 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
|
2045 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
|
2046 0., 2, false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2047 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2048 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2049 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2050 if (math::isinf (fx)) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2051 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
|
2052 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
|
2053 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
|
2054 0., 2, mirror); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2055 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2056 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
|
2057 yPlaneN, yPlaneN, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2058 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
|
2059 0., 0., 2, false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2060 } |
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 |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2063 // tick marks |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2064 if (xySym) |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2065 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2066 if (math::isinf (fy)) |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2067 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
|
2068 yPlane, yPlane, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2069 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
|
2070 0., 0., 2, mirror); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2071 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2072 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
|
2073 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
|
2074 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
|
2075 0., 2, false); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2076 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2077 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2078 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2079 if (math::isinf (fx)) |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2080 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
|
2081 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
|
2082 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
|
2083 0., 2, mirror); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2084 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2085 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
|
2086 yPlaneN, yPlane, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2087 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
|
2088 0., 0., 2, false); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2089 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2090 |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2091 // tick texts |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2092 if (zticklabels.numel () > 0) |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2093 { |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2094 int halign = 2; |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2095 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
|
2096 |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2097 if (xySym) |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2098 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2099 if (math::isinf (fy)) |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2100 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
|
2101 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
|
2102 yPlane, 2, halign, valign, wmax, hmax); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2103 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2104 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
|
2105 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
|
2106 2, halign, valign, wmax, hmax); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2107 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2108 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2109 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
2110 if (math::isinf (fx)) |
22362
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2111 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
|
2112 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
|
2113 2, halign, valign, wmax, hmax); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2114 else |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2115 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
|
2116 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
|
2117 yPlaneN, 2, halign, valign, wmax, hmax); |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2118 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2119 } |
f3ce0015dd42
Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents:
22358
diff
changeset
|
2120 |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
2121 gh_mgr.get_object (props.get_zlabel ()).set ("visible", "on"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2122 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2123 else |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
2124 gh_mgr.get_object (props.get_zlabel ()).set ("visible", "off"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2125 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2126 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2127 void |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2128 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
|
2129 { |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2130 #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
|
2131 // 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
|
2132 GLboolean antialias; |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2133 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2134 m_glfcns.glGetBooleanv (GL_LINE_SMOOTH, &antialias); |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2135 |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2136 if (antialias == GL_TRUE) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2137 m_glfcns.glDisable (GL_LINE_SMOOTH); |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2138 |
24807
8585b3f9c28c
Use "butt" linecap to workaround split lines in printout (bug #53229).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24725
diff
changeset
|
2139 set_linecap ("butt"); |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2140 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
|
2141 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
|
2142 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
|
2143 |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2144 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
|
2145 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
|
2146 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
|
2147 |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2148 if (antialias == GL_TRUE) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2149 m_glfcns.glEnable (GL_LINE_SMOOTH); |
23562
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2150 #else |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2151 |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2152 octave_unused_parameter (props); |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2153 |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2154 // 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
|
2155 // 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
|
2156 |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2157 panic_impossible (); |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2158 |
35ee7e8fb33b
* gl-render.cc: Allow build to succeed without OpenGL.
John W. Eaton <jwe@octave.org>
parents:
23546
diff
changeset
|
2159 #endif |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2160 } |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2161 |
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2162 void |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
2163 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
|
2164 std::list<graphics_object>& obj_list) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2165 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2166 #if defined (HAVE_OPENGL) |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
2167 gh_manager& gh_mgr = __get_gh_manager__ (); |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
2168 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2169 Matrix children = props.get_all_children (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2170 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2171 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
|
2172 { |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
2173 graphics_object go = gh_mgr.get_object (children(i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2174 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2175 base_properties p = go.get_properties (); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2176 |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2177 if (p.is_visible () |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2178 || (m_selecting && p.pickableparts_is ("all"))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2179 { |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2180 if (go.isa ("light") && ! m_selecting) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2181 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2182 if (m_current_light-GL_LIGHT0 < m_max_lights) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2183 { |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2184 set_clipping (p.is_clipping ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2185 draw (go); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2186 m_current_light++; |
22331
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 } |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2189 else if (go.isa ("hggroup") |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2190 && ! (m_selecting && p.pickableparts_is ("none"))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2191 draw_all_lights (go.get_properties (), obj_list); |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2192 else if (! (m_selecting && p.pickableparts_is ("none"))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2193 obj_list.push_back (go); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2194 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2195 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2196 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2197 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2198 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2199 octave_unused_parameter (obj_list); |
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 // 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
|
2202 // 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
|
2203 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2204 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2205 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2206 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2207 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2208 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2209 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2210 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
|
2211 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2212 #if defined (HAVE_OPENGL) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2213 // list for non-light child objects |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2214 std::list<graphics_object> obj_list; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2215 std::list<graphics_object>::iterator it; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2216 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2217 // 1st pass: draw light objects |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2218 |
22349
2aac9ec7df29
Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22348
diff
changeset
|
2219 // 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
|
2220 // 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
|
2221 // 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
|
2222 // 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
|
2223 // Check actual maximum number of lights possible |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2224 init_maxlights (); |
22349
2aac9ec7df29
Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22348
diff
changeset
|
2225 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2226 // 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
|
2227 // 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
|
2228 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2229 if (props.get_num_lights () > m_max_lights) |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2230 warning_with_id ("Octave:max-lights-exceeded", |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2231 "light: Maximum number of lights (%d) in these axes is " |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2232 "exceeded.", m_max_lights); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2233 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2234 m_current_light = GL_LIGHT0; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2235 draw_all_lights (props, obj_list); |
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 // disable other OpenGL lights |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2238 for (unsigned int i = props.get_num_lights (); i < m_max_lights; i++) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2239 m_glfcns.glDisable (GL_LIGHT0 + i); |
22331
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 // 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
|
2242 // other objects |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2243 m_view_vector = props.get_cameraposition ().matrix_value (); |
22331
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 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
|
2246 ColumnVector ambient_color = props.get_ambientlightcolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2247 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2248 cb[i] = ambient_color(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2249 m_glfcns.glLightfv (GL_LIGHT0, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2250 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2251 // 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
|
2252 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2253 it = obj_list.begin (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2254 while (it != obj_list.end ()) |
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 graphics_object go = (*it); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2257 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2258 // 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
|
2259 // to "data" |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2260 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
|
2261 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2262 set_clipping (go.get_properties ().is_clipping ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2263 draw (go); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2264 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2265 it = obj_list.erase (it); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2266 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2267 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2268 it++; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2269 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2270 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2271 // 3rd pass: draw remaining objects |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2272 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2273 m_glfcns.glDisable (GL_DEPTH_TEST); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2274 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2275 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
|
2276 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2277 graphics_object go = (*it); |
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 set_clipping (go.get_properties ().is_clipping ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2280 draw (go); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2281 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2282 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2283 set_clipping (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2284 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2285 // FIXME: finalize rendering (transparency processing) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2286 // 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
|
2287 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2288 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2289 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2290 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2291 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2292 // 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
|
2293 // 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
|
2294 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2295 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2296 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2297 #endif |
22331
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2300 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2301 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
|
2302 { |
22258
553490ffc203
Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22192
diff
changeset
|
2303 #if defined (HAVE_OPENGL) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2304 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2305 // 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
|
2306 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
|
2307 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2308 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2309 // 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
|
2310 // pickable parts is "none". |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2311 if (m_selecting && props.pickableparts_is ("none")) |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2312 return; |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2313 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2314 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
|
2315 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2316 double x_min = props.get_x_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2317 double x_max = props.get_x_max (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2318 double y_min = props.get_y_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2319 double y_max = props.get_y_max (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2320 double z_min = props.get_z_min (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2321 double z_max = props.get_z_max (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2322 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2323 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
|
2324 || 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
|
2325 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2326 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
|
2327 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2328 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2329 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2330 setup_opengl_transformation (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2331 |
23863
56b7352fa456
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23859
diff
changeset
|
2332 // 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
|
2333 // depth sorting |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23807
diff
changeset
|
2334 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
|
2335 if (is2D) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2336 m_glfcns.glDisable (GL_DEPTH_TEST); |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2337 else |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2338 m_glfcns.glEnable (GL_DEPTH_TEST); |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2339 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2340 draw_axes_planes (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2341 |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2342 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
|
2343 { |
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2344 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
|
2345 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
|
2346 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
|
2347 } |
22357
8f23b5b23235
Avoid grid overlaying axes box (bug #48842)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22349
diff
changeset
|
2348 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2349 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
|
2350 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2351 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
|
2352 |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23535
diff
changeset
|
2353 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
|
2354 { |
857b553177a5
Fix regression with axes lines layer (see bug #39692 comment #24)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
2355 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
|
2356 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
|
2357 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
|
2358 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2359 |
22258
553490ffc203
Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22192
diff
changeset
|
2360 #else |
553490ffc203
Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22192
diff
changeset
|
2361 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2362 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2363 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2364 // 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
|
2365 // 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
|
2366 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2367 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
|
2368 |
553490ffc203
Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22192
diff
changeset
|
2369 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2370 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2371 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2372 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2373 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
|
2374 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2375 #if defined (HAVE_OPENGL) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2376 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2377 bool draw_all = m_selecting && props.pickableparts_is ("all"); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2378 |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2379 Matrix x = m_xform.xscale (props.get_xdata ().matrix_value ()); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2380 Matrix y = m_xform.yscale (props.get_ydata ().matrix_value ()); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2381 Matrix z = m_xform.zscale (props.get_zdata ().matrix_value ()); |
22331
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 bool has_z = (z.numel () > 0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2384 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
|
2385 (has_z ? z.numel () |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2386 : std::numeric_limits<int>::max ()))); |
25896
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
2387 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40); |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
2388 uint8_t clip_ok = 0x40; |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
2389 |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
2390 std::vector<uint8_t> clip (n); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2391 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2392 if (has_z) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2393 for (int i = 0; i < n; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2394 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
|
2395 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2396 { |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2397 double z_mid = (m_zmin+m_zmax)/2; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2398 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2399 for (int i = 0; i < n; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2400 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
|
2401 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2402 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2403 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
|
2404 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2405 set_color (props.get_color_rgb ()); |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2406 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
|
2407 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
|
2408 set_linecap ("butt"); |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
2409 set_linejoin (props.get_linejoin ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2410 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2411 if (has_z) |
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 bool flag = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2414 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2415 for (int i = 1; i < n; i++) |
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 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
|
2418 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2419 if (! flag) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2420 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2421 flag = true; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2422 m_glfcns.glBegin (GL_LINE_STRIP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2423 m_glfcns.glVertex3d (x(i-1), y(i-1), z(i-1)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2424 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2425 m_glfcns.glVertex3d (x(i), y(i), z(i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2426 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2427 else if (flag) |
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 flag = false; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2430 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2431 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2432 } |
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 if (flag) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2435 m_glfcns.glEnd (); |
22331
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 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2438 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2439 bool flag = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2440 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2441 for (int i = 1; i < n; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2442 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2443 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
|
2444 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2445 if (! flag) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2446 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2447 flag = true; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2448 m_glfcns.glBegin (GL_LINE_STRIP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2449 m_glfcns.glVertex2d (x(i-1), y(i-1)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2450 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2451 m_glfcns.glVertex2d (x(i), y(i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2452 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2453 else if (flag) |
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 flag = false; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2456 m_glfcns.glEnd (); |
22331
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 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2459 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2460 if (flag) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2461 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2462 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2463 |
22358
dc73bbd66363
Make sure all lines associated with axes respect axes linewidth property.
Rik <rik@octave.org>
parents:
22357
diff
changeset
|
2464 set_linewidth (0.5f); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2465 set_linestyle ("-"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2466 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2467 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2468 set_clipping (false); |
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 if (! props.marker_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2471 && ! (props.markeredgecolor_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2472 && props.markerfacecolor_is ("none"))) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2473 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2474 Matrix lc, fc; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2475 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2476 if (draw_all) |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2477 lc = Matrix (1, 3, 0.0); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2478 else if (props.markeredgecolor_is ("auto")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2479 lc = props.get_color_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2480 else if (! props.markeredgecolor_is ("none")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2481 lc = props.get_markeredgecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2482 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2483 if (draw_all) |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2484 fc = Matrix (1, 3, 0.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2485 if (props.markerfacecolor_is ("auto")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2486 fc = props.get_color_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2487 else if (! props.markerfacecolor_is ("none")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2488 fc = props.get_markerfacecolor_rgb (); |
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 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
|
2491 props.get_linewidth ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2492 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2493 for (int i = 0; i < n; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2494 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2495 if (clip[i] == clip_ok) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2496 draw_marker (x(i), y(i), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2497 has_z ? z(i) : 0.0, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2498 lc, fc); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2499 } |
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 end_marker (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2502 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2503 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2504 set_clipping (props.is_clipping ()); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2505 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2506 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2507 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2508 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2509 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2510 // 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
|
2511 // 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
|
2512 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2513 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
2514 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2515 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2516 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2517 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2518 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2519 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
|
2520 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2521 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
2522 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2523 bool draw_all = m_selecting && props.pickableparts_is ("all"); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2524 |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2525 const Matrix x = m_xform.xscale (props.get_xdata ().matrix_value ()); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2526 const Matrix y = m_xform.yscale (props.get_ydata ().matrix_value ()); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
2527 const Matrix z = m_xform.zscale (props.get_zdata ().matrix_value ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2528 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2529 int zr = z.rows (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2530 int zc = z.columns (); |
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 NDArray c; |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2533 const NDArray vn = props.get_vertexnormals ().array_value (); |
25871
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2534 dim_vector vn_dims = vn.dims (); |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
2535 bool has_vertex_normals = (vn_dims(0) == zr && vn_dims(1) == zc |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
2536 && vn_dims(2) == 3); |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2537 const NDArray fn = props.get_facenormals ().array_value (); |
25871
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2538 dim_vector fn_dims = fn.dims (); |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
2539 bool has_face_normals = (fn_dims(0) == zr - 1 && fn_dims(1) == zc - 1 |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
2540 && fn_dims(2) == 3); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2541 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2542 // FIXME: handle transparency |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2543 Matrix a; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2544 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2545 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
|
2546 (props.facecolor_is ("flat") ? 1 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2547 (props.facecolor_is ("interp") ? 2 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2548 (props.facecolor_is ("texturemap") ? 3 : -1)))); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2549 int fl_mode = (props.facelighting_is ("none") ? 0 : |
25871
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2550 (props.facelighting_is ("flat") ? |
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2551 (has_face_normals ? 1 : 0) : |
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2552 (has_vertex_normals ? 2 : 0))); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2553 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
|
2554 (props.facealpha_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2555 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
|
2556 (props.edgecolor_is ("flat") ? 1 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2557 (props.edgecolor_is ("interp") ? 2 : -1))); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2558 int el_mode = (props.edgelighting_is ("none") ? 0 : |
25871
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2559 (props.edgelighting_is ("flat") ? |
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2560 (has_face_normals ? 1 : 0) : |
d8e7532edf5f
Don't render with lighting if dimensions of normals don't match.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25867
diff
changeset
|
2561 (has_vertex_normals ? 2 : 0))); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2562 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
|
2563 (props.edgealpha_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2564 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
|
2565 (props.backfacelighting_is ("reverselit") ? 1 : 2)); |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2566 bool do_lighting = props.get_do_lighting (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2567 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2568 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
|
2569 : props.get_facecolor_rgb ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2570 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
|
2571 double fa = 1.0; |
22331
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 float as = props.get_ambientstrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2574 float ds = props.get_diffusestrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2575 float ss = props.get_specularstrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2576 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
|
2577 float scr = props.get_specularcolorreflectance (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2578 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
|
2579 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2580 opengl_texture tex (m_glfcns); |
22331
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 int i1, i2, j1, j2; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2583 bool x_mat = (x.rows () == z.rows ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2584 bool y_mat = (y.columns () == z.columns ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2585 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2586 i1 = i2 = j1 = j2 = 0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2587 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2588 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
|
2589 c = props.get_color_data ().array_value (); |
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 boolMatrix clip (z.dims (), false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2592 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2593 for (int i = 0; i < zr; i++) |
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 (x_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2596 i1 = i; |
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 for (int j = 0; j < zc; j++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2599 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2600 if (y_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2601 j1 = j; |
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 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
|
2604 } |
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2607 if (fa_mode > 0 || ea_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2608 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2609 // FIXME: implement alphadata conversion |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2610 //a = props.get_alpha_data (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2611 } |
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 if (fl_mode > 0 || el_mode > 0) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2614 m_glfcns.glMaterialf (LIGHT_MODE, GL_SHININESS, se); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2615 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2616 // FIXME: good candidate for caching, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2617 // 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
|
2618 if (fc_mode == TEXTURE) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2619 tex = opengl_texture::create (m_glfcns, props.get_color_data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2620 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
2621 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
|
2622 { |
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
|
2623 if (fa_mode == 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2624 { |
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
|
2625 fa = props.get_facealpha_double (); |
26468
bdf03ab385c2
Use facealpha for surface objects with uniform facecolor and lighting (bug #55384).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26465
diff
changeset
|
2626 cb[3] = fa; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2627 if (fc_mode == UNIFORM || fc_mode == TEXTURE) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2628 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2629 m_glfcns.glColor4d (fcolor(0), fcolor(1), fcolor(2), fa); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2630 if (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2631 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2632 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2633 cb[i] = as * fcolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2634 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2635 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2636 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2637 cb[i] = ds * fcolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2638 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2639 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2640 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2641 cb[i] = ss * (scr + (1-scr) * fcolor(i)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2642 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2643 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2644 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2645 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2646 if ((fl_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2647 m_glfcns.glEnable (GL_LIGHTING); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2648 m_glfcns.glShadeModel ((fc_mode == INTERP || fl_mode == GOURAUD) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
2649 ? 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
|
2650 set_polygon_offset (true, 1.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2651 if (fc_mode == TEXTURE) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2652 m_glfcns.glEnable (GL_TEXTURE_2D); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2653 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2654 for (int i = 1; i < zc; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2655 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2656 if (y_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2657 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2658 i1 = i-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2659 i2 = i; |
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2662 for (int j = 1; j < zr; j++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2663 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2664 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2665 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
|
2666 || clip(j-1, i) || clip(j, i)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2667 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2668 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2669 if (fc_mode == FLAT) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2670 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2671 // "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
|
2672 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
|
2673 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2674 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2675 else if (fc_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2676 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2677 // "interp" needs valid color at all 4 vertices |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2678 if (! (math::isfinite (c(j-1, i-1)) |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2679 && math::isfinite (c(j, i-1)) |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2680 && math::isfinite (c(j-1, i)) |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2681 && math::isfinite (c(j, i)))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2682 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2683 } |
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 if (x_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2686 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2687 j1 = j-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2688 j2 = j; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2689 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2690 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2691 m_glfcns.glBegin (GL_QUADS); |
22331
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 // Vertex 1 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2694 if (fc_mode == TEXTURE) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2695 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
|
2696 double (j-1) / (zr-1)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2697 else if (fc_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2698 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2699 // 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
|
2700 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2701 cb[k] = c(j-1, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2702 m_glfcns.glColor4fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2703 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2704 if (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2705 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2706 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2707 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2708 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2709 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2710 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2711 cb[k] = ds * c(j-1, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2712 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2713 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2714 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2715 cb[k] = ss * (scr + (1-scr) * c(j-1, i-1, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2716 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2717 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2718 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2719 if (fl_mode > 0) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2720 set_normal (bfl_mode, (fl_mode == GOURAUD ? vn : fn), |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2721 j-1, i-1); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2722 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2723 m_glfcns.glVertex3d (x(j1,i-1), y(j-1,i1), z(j-1,i-1)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2724 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2725 // Vertex 2 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2726 if (fc_mode == TEXTURE) |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2727 tex.tex_coord (double (i) / (zc-1), |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2728 double (j-1) / (zr-1)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2729 else if (fc_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2730 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2731 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2732 cb[k] = c(j-1, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2733 m_glfcns.glColor4fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2734 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2735 if (fl_mode > 0) |
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 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2738 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2739 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2740 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2741 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2742 cb[k] = ds * c(j-1, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2743 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2744 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2745 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2746 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2747 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2748 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2749 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2750 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2751 if (fl_mode == GOURAUD) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2752 set_normal (bfl_mode, vn, j-1, i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2753 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2754 m_glfcns.glVertex3d (x(j1,i), y(j-1,i2), z(j-1,i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2755 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2756 // Vertex 3 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2757 if (fc_mode == TEXTURE) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2758 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
|
2759 else if (fc_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2760 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2761 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2762 cb[k] = c(j, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2763 m_glfcns.glColor4fv (cb); |
22331
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 (fl_mode > 0) |
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 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2768 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2769 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2770 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2771 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2772 cb[k] = ds * c(j, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2773 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2774 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2775 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2776 cb[k] = ss * (scr + (1-scr) * c(j, i, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2777 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2778 } |
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 (fl_mode == GOURAUD) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2781 set_normal (bfl_mode, vn, j, i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2782 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2783 m_glfcns.glVertex3d (x(j2,i), y(j,i2), z(j,i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2784 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2785 // Vertex 4 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2786 if (fc_mode == TEXTURE) |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2787 tex.tex_coord (double (i-1) / (zc-1), |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2788 double (j) / (zr-1)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2789 else if (fc_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2790 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2791 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2792 cb[k] = c(j, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2793 m_glfcns.glColor4fv (cb); |
22331
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 (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2796 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2797 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2798 cb[k] *= as; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2799 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2800 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2801 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2802 cb[k] = ds * c(j, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2803 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2804 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2805 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2806 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2807 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2808 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2809 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2810 if (fl_mode == GOURAUD) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2811 set_normal (bfl_mode, vn, j, i-1); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2812 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2813 m_glfcns.glVertex3d (x(j2,i-1), y(j,i1), z(j,i-1)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2814 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2815 m_glfcns.glEnd (); |
22331
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 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2818 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2819 set_polygon_offset (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2820 if (fc_mode == TEXTURE) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2821 m_glfcns.glDisable (GL_TEXTURE_2D); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2822 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2823 if ((fl_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2824 m_glfcns.glDisable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2825 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2826 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2827 { |
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
|
2828 // 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
|
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 |
22391
c5da5e5e9846
Fix inconsistent on-screen/printout patch and surface edges (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22369
diff
changeset
|
2832 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
|
2833 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2834 if (props.get_edgealpha_double () == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2835 { |
26468
bdf03ab385c2
Use facealpha for surface objects with uniform facecolor and lighting (bug #55384).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26465
diff
changeset
|
2836 cb[3] = 1.0; // edgealpha isn't implemented yet |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2837 if (ec_mode == UNIFORM) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2838 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2839 m_glfcns.glColor3dv (ecolor.data ()); |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
2840 if (el_mode > 0) |
22331
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 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2843 cb[i] = as * ecolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2844 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2845 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2846 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2847 cb[i] = ds * ecolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2848 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2849 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2850 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2851 cb[i] = ss * (scr + (1-scr) * ecolor(i)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2852 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2853 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2854 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2855 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
2856 if ((el_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2857 m_glfcns.glEnable (GL_LIGHTING); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2858 m_glfcns.glShadeModel ((ec_mode == INTERP || el_mode == GOURAUD) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
2859 ? GL_SMOOTH : GL_FLAT); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2860 |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2861 set_linestyle (props.get_linestyle (), false, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2862 props.get_linewidth ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2863 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
|
2864 set_linecap ("butt"); |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
2865 set_linejoin ("miter"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2866 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2867 // Mesh along Y-axis |
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 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
|
2870 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2871 for (int i = 0; i < zc; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2872 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2873 if (y_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2874 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2875 i1 = i-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2876 i2 = i; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2877 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2878 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2879 for (int j = 1; j < zr; j++) |
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 (clip(j-1,i) || clip(j,i)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2882 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2883 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2884 if (ec_mode == FLAT) |
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 // "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
|
2887 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
|
2888 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2889 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2890 else if (ec_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2891 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2892 // "interp" needs valid color at both vertices |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2893 if (! (math::isfinite (c(j-1, i)) |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2894 && math::isfinite (c(j, i)))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2895 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2896 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2897 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2898 if (x_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2899 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2900 j1 = j-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2901 j2 = j; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2902 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2903 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2904 m_glfcns.glBegin (GL_LINES); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2905 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2906 // Vertex 1 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2907 if (ec_mode > 0) |
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 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2910 cb[k] = c(j-1, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2911 m_glfcns.glColor3fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2912 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2913 if (el_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2914 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2915 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2916 cb[k] *= as; |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2917 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2918 cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2919 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2920 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2921 cb[k] = ds * c(j-1, i, k); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2922 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2923 cb); |
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 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2926 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2927 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2928 cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2929 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2930 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2931 if (el_mode > 0) |
26465
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2932 { |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2933 if (el_mode == GOURAUD) |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2934 set_normal (bfl_mode, vn, j-1, i); |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2935 else |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2936 set_normal (bfl_mode, fn, j-1, std::min (i, zc-2)); |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
2937 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2938 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2939 m_glfcns.glVertex3d (x(j1,i), y(j-1,i2), z(j-1,i)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2940 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2941 // Vertex 2 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2942 if (ec_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2943 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2944 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2945 cb[k] = c(j, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2946 m_glfcns.glColor3fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2947 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2948 if (el_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2949 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2950 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2951 cb[k] *= as; |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2952 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2953 cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2954 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2955 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2956 cb[k] = ds * c(j, i, k); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2957 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2958 cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2959 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2960 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2961 cb[k] = ss * (scr + (1-scr) * c(j, i, k)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2962 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
2963 cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2964 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2965 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2966 if (el_mode == GOURAUD) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
2967 set_normal (bfl_mode, vn, j, i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2968 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2969 m_glfcns.glVertex3d (x(j2,i), y(j,i2), z(j,i)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2970 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
2971 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2972 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2973 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2974 } |
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 // Mesh along X-axis |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2977 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2978 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
|
2979 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2980 for (int j = 0; j < zr; j++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2981 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2982 if (x_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2983 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2984 j1 = j-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2985 j2 = j; |
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2988 for (int i = 1; i < zc; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2989 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2990 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
|
2991 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2992 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2993 if (ec_mode == FLAT) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2994 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
2995 // "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
|
2996 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
|
2997 continue; |
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 else if (ec_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3000 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3001 // "interp" needs valid color at both vertices |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3002 if (! (math::isfinite (c(j, i-1)) |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3003 && math::isfinite (c(j, i)))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3004 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3005 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3006 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3007 if (y_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3008 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3009 i1 = i-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3010 i2 = i; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3011 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3012 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3013 m_glfcns.glBegin (GL_LINES); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3014 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3015 // Vertex 1 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3016 if (ec_mode > 0) |
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 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3019 cb[k] = c(j, i-1, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3020 m_glfcns.glColor3fv (cb); |
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 if (el_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3023 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3024 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3025 cb[k] *= as; |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3026 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3027 cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3028 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3029 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3030 cb[k] = ds * c(j, i-1, k); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3031 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3032 cb); |
22331
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 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3035 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3036 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3037 cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3038 } |
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 if (el_mode > 0) |
26465
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
3041 { |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
3042 if (el_mode == GOURAUD) |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
3043 set_normal (bfl_mode, vn, j, i-1); |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
3044 else |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
3045 set_normal (bfl_mode, fn, std::min (j, zr-2), i-1); |
dd40f9650821
Avoid heap-buffer-overflow with facenormals on surface edges (bug #48519).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26430
diff
changeset
|
3046 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3047 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3048 m_glfcns.glVertex3d (x(j2,i-1), y(j,i1), z(j,i-1)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3049 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3050 // Vertex 2 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3051 if (ec_mode == INTERP) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3052 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3053 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3054 cb[k] = c(j, i, k); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3055 m_glfcns.glColor3fv (cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3056 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3057 if (el_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3058 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3059 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3060 cb[k] *= as; |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3061 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3062 cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3063 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3064 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3065 cb[k] = ds * c(j, i, k); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3066 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3067 cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3068 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3069 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3070 cb[k] = ss * (scr + (1-scr) * c(j, i, k)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3071 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3072 cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3073 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3074 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3075 if (el_mode == GOURAUD) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25864
diff
changeset
|
3076 set_normal (bfl_mode, vn, j, i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3077 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3078 m_glfcns.glVertex3d (x(j2,i), y(j,i2), z(j,i)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3079 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3080 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3081 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3082 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3083 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3084 |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
3085 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
|
3086 set_linewidth (0.5f); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3087 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
3088 if ((el_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3089 m_glfcns.glDisable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3090 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3091 else |
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 // FIXME: implement transparency |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3094 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3095 } |
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 (! props.marker_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3098 && ! (props.markeredgecolor_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3099 && props.markerfacecolor_is ("none"))) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3100 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3101 // 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
|
3102 // 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
|
3103 // and facecolor set to none. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3104 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3105 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
|
3106 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
|
3107 |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3108 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
|
3109 props.get_markeredgecolor_rgb ()); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3110 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
|
3111 props.get_markerfacecolor_rgb ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3112 Matrix cc (1, 3, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3113 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3114 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
|
3115 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3116 mecolor = props.get_edgecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3117 do_edge = ! props.edgecolor_is ("none"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3118 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3119 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3120 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
|
3121 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3122 mfcolor = props.get_facecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3123 do_face = ! props.facecolor_is ("none"); |
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 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3126 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
|
3127 c = props.get_color_data ().array_value (); |
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 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
|
3130 props.get_linewidth ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3131 |
25896
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3132 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40); |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3133 uint8_t clip_ok = 0x40; |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3134 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3135 for (int i = 0; i < zc; 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 (y_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3138 i1 = i; |
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 for (int j = 0; j < zr; j++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3141 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3142 if (x_mat) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3143 j1 = j; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3144 |
25896
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3145 if ((clip_code (x(j1,i), y(j,i1), z(j,i)) & clip_mask) |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3146 != clip_ok) |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3147 continue; |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3148 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3149 if ((do_edge && mecolor.isempty ()) |
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3150 || (do_face && mfcolor.isempty ())) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3151 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
3152 if (! math::isfinite (c(j,i))) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3153 continue; // Skip NaNs in color data |
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 for (int k = 0; k < 3; k++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3156 cc(k) = c(j,i,k); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3157 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3158 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3159 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
|
3160 : Matrix ()); |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3161 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
|
3162 : Matrix ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3163 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3164 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
|
3165 } |
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3168 end_marker (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3169 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3170 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3171 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3172 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3173 octave_unused_parameter (props); |
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 // 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
|
3176 // 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
|
3177 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3178 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3179 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3180 #endif |
22331
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 // FIXME: global optimization (rendering, data structures...), |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3184 // 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
|
3185 void |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23396
diff
changeset
|
3186 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
|
3187 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3188 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3189 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3190 // 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
|
3191 std::string msg; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3192 if (props.has_bad_data (msg)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3193 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3194 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
|
3195 return; |
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 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3198 bool draw_all = m_selecting && props.pickableparts_is ("all"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3199 const Matrix f = props.get_faces ().matrix_value (); |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3200 const Matrix v = m_xform.scale (props.get_vertices ().matrix_value ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3201 Matrix c; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3202 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
|
3203 double fa = 1.0; |
22331
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 int nv = v.rows (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3206 int nf = f.rows (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3207 int fcmax = f.columns (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3208 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3209 bool has_z = (v.columns () > 2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3210 bool has_facecolor = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3211 bool has_facealpha = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3212 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3213 int fc_mode = ((props.facecolor_is ("none") |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3214 || 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
|
3215 (props.facecolor_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3216 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
|
3217 (props.facelighting_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3218 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
|
3219 (props.facealpha_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3220 int ec_mode = ((props.edgecolor_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3221 || props.edgecolor_is_rgb ()) ? 0 : |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3222 (props.edgecolor_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3223 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
|
3224 (props.edgelighting_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3225 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
|
3226 (props.edgealpha_is ("flat") ? 1 : 2)); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3227 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
|
3228 (props.backfacelighting_is ("reverselit") ? 1 : 2)); |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25419
diff
changeset
|
3229 bool do_lighting = props.get_do_lighting (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3230 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3231 Matrix fcolor = props.get_facecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3232 Matrix ecolor = props.get_edgecolor_rgb (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3233 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3234 float as = props.get_ambientstrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3235 float ds = props.get_diffusestrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3236 float ss = props.get_specularstrength (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3237 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
|
3238 float scr = props.get_specularcolorreflectance (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3239 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3240 const Matrix vn = props.get_vertexnormals ().matrix_value (); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3241 bool has_vertex_normals = (vn.rows () == nv); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3242 const Matrix fn = props.get_facenormals ().matrix_value (); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3243 bool has_face_normals = (fn.rows () == nf); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3244 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3245 boolMatrix clip (1, nv, false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3246 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3247 if (has_z) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3248 for (int i = 0; i < nv; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3249 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
|
3250 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3251 for (int i = 0; i < nv; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3252 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
|
3253 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3254 boolMatrix clip_f (1, nf, false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3255 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
|
3256 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3257 for (int i = 0; i < nf; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3258 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3259 bool fclip = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3260 int count = 0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3261 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
3262 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
|
3263 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
|
3264 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3265 clip_f(i) = fclip; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3266 count_f(i) = count; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3267 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3268 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3269 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
|
3270 { |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3271 if (draw_all) |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3272 c = Matrix (1, 3, 0.0); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3273 else |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3274 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
|
3275 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3276 if (c.rows () == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3277 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3278 // 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
|
3279 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3280 if (draw_all || fc_mode > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3281 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3282 fcolor = c; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3283 fc_mode = UNIFORM; |
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 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3286 if (draw_all || ec_mode > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3287 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3288 ecolor = c; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3289 ec_mode = UNIFORM; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3290 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3291 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3292 c = Matrix (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3293 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3294 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3295 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
|
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 (fa_mode > 0 || ea_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3299 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3300 // FIXME: retrieve alpha data from patch object |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3301 //a = props.get_alpha_data (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3302 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
|
3303 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3304 |
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
|
3305 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
|
3306 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
|
3307 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3308 octave_idx_type fr = f.rows (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3309 std::vector<vertex_data> vdata (f.numel ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3310 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3311 for (int i = 0; i < nf; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3312 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
|
3313 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3314 int idx = int (f(i,j) - 1); |
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 Matrix vv (1, 3, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3317 Matrix cc; |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3318 Matrix vnn (1, 3, 0.0); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3319 Matrix fnn (1, 3, 0.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3320 double aa = 1.0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3321 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3322 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
|
3323 if (has_z) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3324 vv(2) = v(idx,2); |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3325 if (((fl_mode == FLAT) || (el_mode == FLAT)) && has_face_normals) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3326 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3327 double dir = 1.0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3328 if (bfl_mode > 0) |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3329 dir = ((fn(i,0) * m_view_vector(0) |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3330 + fn(i,1) * m_view_vector(1) |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3331 + fn(i,2) * m_view_vector(2) < 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3332 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0); |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3333 fnn(0) = dir * fn(i,0); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3334 fnn(1) = dir * fn(i,1); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3335 fnn(2) = dir * fn(i,2); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3336 } |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
3337 if ((fl_mode == GOURAUD || el_mode == GOURAUD) && has_vertex_normals) |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3338 { |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3339 double dir = 1.0; |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3340 if (bfl_mode > 0) |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3341 dir = ((vn(idx,0) * m_view_vector(0) |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3342 + vn(idx,1) * m_view_vector(1) |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3343 + vn(idx,2) * m_view_vector(2) < 0) |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3344 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3345 vnn(0) = dir * vn(idx,0); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3346 vnn(1) = dir * vn(idx,1); |
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3347 vnn(2) = dir * vn(idx,2); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3348 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3349 if (c.numel () > 0) |
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 cc.resize (1, 3); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3352 if (has_facecolor) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3353 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
|
3354 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3355 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
|
3356 } |
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
|
3357 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
|
3358 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
|
3359 else if (a.numel () > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3360 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3361 if (has_facealpha) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3362 aa = a(i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3363 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3364 aa = a(idx); |
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 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3367 vdata[i+j*fr] |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3368 = vertex_data (vv, cc, vnn, fnn, aa, as, ds, ss, se, scr); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3369 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3370 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3371 if (fl_mode > 0 || el_mode > 0) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3372 m_glfcns.glMaterialf (LIGHT_MODE, GL_SHININESS, se); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3373 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3374 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
|
3375 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3376 // 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
|
3377 if (fa_mode == 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3378 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3379 if (fc_mode == UNIFORM) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3380 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3381 m_glfcns.glColor4d (fcolor(0), fcolor(1), fcolor(2), fa); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3382 if (fl_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3383 { |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
3384 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f };; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3385 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3386 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3387 cb[i] = as * fcolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3388 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3389 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3390 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3391 cb[i] = ds * fcolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3392 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3393 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3394 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3395 cb[i] = ss * (scr + (1-scr) * fcolor(i)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3396 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3397 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3398 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3399 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3400 if ((fl_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3401 m_glfcns.glEnable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3402 |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3403 // NOTE: Push filled part of patch backwards to avoid Z-fighting |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3404 // with tessellator outline. A value of 1.0 seems to work fine. |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3405 // Value can't be too large or the patch will be pushed below the |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3406 // axes planes at +2.5. |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
3407 patch_tessellator tess (this, fc_mode, fl_mode, true, 1.0); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3408 |
27798
8c1cb06468db
Change class of coplanar_last_idx for patch objects (bug #55895).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27767
diff
changeset
|
3409 std::vector<octave_idx_type>::const_iterator it; |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3410 octave_idx_type i_start, i_end; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3411 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3412 for (int i = 0; i < nf; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3413 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3414 if (clip_f(i)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3415 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3416 |
25419
7361fd8aed86
Fix segmentation fault with last change (bug #47677).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3417 bool is_non_planar = false; |
30040
805357e6b058
maint: use "m_" prefix for member variables of graphics objects.
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
3418 if (props.m_coplanar_last_idx.size () > 0 |
805357e6b058
maint: use "m_" prefix for member variables of graphics objects.
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
3419 && props.m_coplanar_last_idx[i].size () > 1) |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3420 { |
25419
7361fd8aed86
Fix segmentation fault with last change (bug #47677).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3421 is_non_planar = true; |
30040
805357e6b058
maint: use "m_" prefix for member variables of graphics objects.
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
3422 it = props.m_coplanar_last_idx[i].end (); |
27798
8c1cb06468db
Change class of coplanar_last_idx for patch objects (bug #55895).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27767
diff
changeset
|
3423 it--; |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3424 } |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3425 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3426 // loop over planar subsets of face |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3427 do |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3428 { |
25419
7361fd8aed86
Fix segmentation fault with last change (bug #47677).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3429 if (is_non_planar) |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3430 { |
27798
8c1cb06468db
Change class of coplanar_last_idx for patch objects (bug #55895).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27767
diff
changeset
|
3431 i_end = *it; |
30040
805357e6b058
maint: use "m_" prefix for member variables of graphics objects.
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
3432 if (it == props.m_coplanar_last_idx[i].begin ()) |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3433 i_start = 0; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3434 else |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3435 { |
27798
8c1cb06468db
Change class of coplanar_last_idx for patch objects (bug #55895).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27767
diff
changeset
|
3436 it--; |
8c1cb06468db
Change class of coplanar_last_idx for patch objects (bug #55895).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27767
diff
changeset
|
3437 i_start = *it - 1; |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3438 } |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3439 } |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3440 else |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3441 { |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3442 i_end = count_f(i) - 1; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3443 i_start = 0; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3444 } |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3445 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3446 tess.begin_polygon (true); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3447 tess.begin_contour (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3448 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3449 // Add vertices in reverse order for Matlab compatibility |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3450 for (int j = i_end; j > i_start; j--) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3451 { |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
3452 vertex_data::vertex_data_rep *vv |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26995
diff
changeset
|
3453 = vdata[i+j*fr].get_rep (); |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3454 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3455 tess.add_vertex (vv->m_coords.fortran_vec (), vv); |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3456 } |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3457 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3458 if (count_f(i) > 0) |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3459 { |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3460 vertex_data::vertex_data_rep *vv = vdata[i].get_rep (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3461 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3462 if (fc_mode == FLAT) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3463 { |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3464 // For "flat" shading, use color of 1st vertex. |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3465 Matrix col = vv->m_color; |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3466 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3467 if (col.numel () == 3) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3468 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3469 m_glfcns.glColor4d (col(0), col(1), col(2), fa); |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3470 if (fl_mode > 0) |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3471 { |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
3472 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3473 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3474 for (int k = 0; k < 3; k++) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3475 cb[k] = (vv->m_ambient * col(k)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3476 m_glfcns.glMaterialfv (LIGHT_MODE, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3477 GL_AMBIENT, cb); |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3478 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3479 for (int k = 0; k < 3; k++) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3480 cb[k] = (vv->m_diffuse * col(k)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3481 m_glfcns.glMaterialfv (LIGHT_MODE, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3482 GL_DIFFUSE, cb); |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3483 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3484 for (int k = 0; k < 3; k++) |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3485 cb[k] = vv->m_specular * |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3486 (vv->m_specular_color_refl |
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3487 + (1-vv->m_specular_color_refl) * |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3488 col(k)); |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3489 m_glfcns.glMaterialfv (LIGHT_MODE, |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3490 GL_SPECULAR, cb); |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3491 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3492 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3493 } |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3494 |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3495 tess.add_vertex (vv->m_coords.fortran_vec (), vv); |
22331
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 |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3498 tess.end_contour (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3499 tess.end_polygon (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3500 } while (i_start > 0); |
22331
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 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3503 if ((fl_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3504 m_glfcns.glDisable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3505 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3506 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3507 { |
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
|
3508 // FIXME: implement flat and interp transparency |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3509 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3510 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3511 |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3512 if (draw_all |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3513 || (! 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
|
3514 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3515 // FIXME: adapt to double-radio property |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3516 if (props.get_edgealpha_double () == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3517 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3518 if (ec_mode == UNIFORM) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3519 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3520 m_glfcns.glColor3dv (ecolor.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3521 if (el_mode > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3522 { |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
3523 // edge lighting only uses ambient light |
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
3524 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; |
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
3525 m_glfcns.glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb); |
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
3526 m_glfcns.glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3527 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3528 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3529 cb[i] = (as * ecolor(i)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3530 m_glfcns.glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3531 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3532 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3533 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3534 if ((el_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3535 m_glfcns.glEnable (GL_LIGHTING); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3536 |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
3537 double linewidth = props.get_linewidth (); |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
3538 set_linestyle (props.get_linestyle (), false, linewidth); |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
3539 set_linewidth (linewidth); |
22838
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
3540 set_linecap ("butt"); |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
3541 set_linejoin ("miter"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3542 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3543 // NOTE: patch contour cannot be offset. Offset must occur with |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3544 // the filled portion of the patch above. The tessellator uses |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3545 // 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
|
3546 // 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
|
3547 // not supported by glPolygonOffset which is used to do Z offsets. |
28006
91316b5dc5a2
Only use ambient light for edge lighting on patches (bug #57553).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27992
diff
changeset
|
3548 patch_tessellator tess (this, ec_mode, el_mode, false); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3549 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3550 for (int i = 0; i < nf; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3551 { |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3552 bool is_non_planar = false; |
30040
805357e6b058
maint: use "m_" prefix for member variables of graphics objects.
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
3553 if (props.m_coplanar_last_idx.size () > 0 |
805357e6b058
maint: use "m_" prefix for member variables of graphics objects.
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
3554 && props.m_coplanar_last_idx[i].size () > 1) |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3555 is_non_planar = true; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3556 if (clip_f(i) || is_non_planar) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3557 { |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3558 // This is an unclosed contour or a non-planar face. |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25260
diff
changeset
|
3559 // Draw it as a line. |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3560 bool flag = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3561 |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3562 m_glfcns.glShadeModel ((ec_mode == INTERP |
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
3563 || el_mode == GOURAUD) |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
3564 ? GL_SMOOTH : GL_FLAT); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3565 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3566 // 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
|
3567 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
|
3568 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3569 if (! clip(int (f(i,j) - 1))) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3570 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3571 vertex_data::vertex_data_rep *vv |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3572 = vdata[i+j*fr].get_rep (); |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3573 const Matrix m = vv->m_coords; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3574 if (! flag) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3575 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3576 flag = true; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3577 m_glfcns.glBegin (GL_LINE_STRIP); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3578 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3579 if (ec_mode != UNIFORM) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3580 { |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3581 Matrix col = vv->m_color; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3582 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3583 if (col.numel () == 3) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3584 m_glfcns.glColor3dv (col.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3585 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3586 m_glfcns.glVertex3d (m(0), m(1), m(2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3587 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3588 else if (flag) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3589 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3590 flag = false; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3591 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3592 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3593 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3594 // 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
|
3595 // from vertex 0 to vertex N. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3596 int j = count_f(i)-1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3597 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
|
3598 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3599 vertex_data::vertex_data_rep *vv |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3600 = vdata[i+j*fr].get_rep (); |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3601 const Matrix m = vv->m_coords; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3602 if (ec_mode != UNIFORM) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3603 { |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3604 Matrix col = vv->m_color; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3605 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3606 if (col.numel () == 3) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3607 m_glfcns.glColor3dv (col.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3608 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3609 m_glfcns.glVertex3d (m(0), m(1), m(2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3610 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3611 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3612 if (flag) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3613 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3614 } |
27979
cd7f8df11669
fix spelling of tessellate on default branch (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3615 else // Normal edge contour drawn with tessellator |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3616 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3617 tess.begin_polygon (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3618 tess.begin_contour (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3619 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3620 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
|
3621 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3622 vertex_data::vertex_data_rep *vv |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3623 = vdata[i+j*fr].get_rep (); |
29427
c850a9cd28f6
use std::shared_ptr and m_ prefix for vertex_data and opengl_texture classes
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3624 tess.add_vertex (vv->m_coords.fortran_vec (), vv); |
22331
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 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3627 tess.end_contour (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3628 tess.end_polygon (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3629 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3630 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3631 |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
3632 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
|
3633 set_linewidth (0.5f); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3634 |
25820
218feb083dcc
Use "facenormals" for flat lighting on patches (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25688
diff
changeset
|
3635 if ((el_mode > 0) && do_lighting) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3636 m_glfcns.glDisable (GL_LIGHTING); |
22331
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 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3639 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3640 // FIXME: implement transparency |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3641 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3642 } |
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 (! props.marker_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3645 && ! (props.markeredgecolor_is ("none") |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3646 && props.markerfacecolor_is ("none"))) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3647 { |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3648 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
|
3649 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
|
3650 |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3651 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
|
3652 props.get_markeredgecolor_rgb ()); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3653 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
|
3654 props.get_markerfacecolor_rgb ()); |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3655 |
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24183
diff
changeset
|
3656 bool has_markerfacecolor = draw_all || false; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3657 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3658 if ((mecolor.isempty () && ! props.markeredgecolor_is ("none")) |
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3659 || (mfcolor.isempty () && ! props.markerfacecolor_is ("none"))) |
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 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
|
3662 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3663 if (mc.rows () == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3664 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3665 // 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
|
3666 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
|
3667 mfcolor = mc; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3668 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3669 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
|
3670 mecolor = mc; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3671 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3672 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3673 { |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3674 if (c.isempty ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3675 c = props.get_color_data ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3676 has_markerfacecolor = ((c.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3677 && (c.rows () == f.rows ())); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3678 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3679 } |
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 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
|
3682 props.get_linewidth ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3683 |
25896
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3684 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40); |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3685 uint8_t clip_ok = 0x40; |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3686 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3687 for (int i = 0; i < nf; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3688 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
|
3689 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3690 int idx = int (f(i,j) - 1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3691 |
25896
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3692 if ((clip_code (v(idx,0), v(idx,1), (has_z ? v(idx,2) : 0)) |
c1cd5561d1dc
Fix clipping of patch/surface markers (bug #54690)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25889
diff
changeset
|
3693 & clip_mask) != clip_ok) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3694 continue; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3695 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3696 Matrix cc; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3697 if (c.numel () > 0) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3698 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3699 cc.resize (1, 3); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3700 if (has_markerfacecolor) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3701 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
|
3702 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3703 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
|
3704 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10202
diff
changeset
|
3705 |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3706 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
|
3707 : Matrix ()); |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
3708 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
|
3709 : Matrix ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3710 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3711 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
|
3712 } |
22331
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 end_marker (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3715 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3716 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3717 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3718 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3719 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3720 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3721 // 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
|
3722 // 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
|
3723 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3724 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3725 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3726 #endif |
22331
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 void |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3730 opengl_renderer::draw_scatter (const scatter::properties& props) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3731 { |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3732 #if defined (HAVE_OPENGL) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3733 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3734 // Do not render if the scatter object has incoherent data |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3735 std::string msg; |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3736 if (props.has_bad_data (msg)) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3737 { |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3738 warning ("opengl_renderer: %s. Not rendering.", msg.c_str ()); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3739 return; |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3740 } |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3741 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3742 bool draw_all = m_selecting; |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3743 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3744 if (draw_all || (! props.marker_is ("none") |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3745 && ! (props.markeredgecolor_is ("none") |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3746 && props.markerfacecolor_is ("none")))) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3747 { |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3748 bool do_edge = draw_all || ! props.markeredgecolor_is ("none"); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3749 bool do_face = draw_all || ! props.markerfacecolor_is ("none"); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3750 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3751 const Matrix x = props.get_xdata ().matrix_value (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3752 const Matrix y = props.get_ydata ().matrix_value (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3753 const Matrix z = props.get_zdata ().matrix_value (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3754 const Matrix c = props.get_color_data ().matrix_value (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3755 const Matrix s = props.get_sizedata ().matrix_value (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3756 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3757 int np = x.rows (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3758 bool has_z = ! z.isempty (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3759 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3760 // If markeredgecolor is "flat", mecolor is empty |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3761 Matrix mecolor = (draw_all ? Matrix (1, 3, 0.0) : |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3762 props.get_markeredgecolor_rgb ()); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3763 Matrix mfcolor = (draw_all ? Matrix (1, 3, 0.0) : |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3764 props.get_markerfacecolor_rgb ()); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3765 const double mea = props.get_markeredgealpha (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3766 const double mfa = props.get_markerfacealpha (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3767 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3768 if (props.markerfacecolor_is ("auto")) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3769 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
3770 gh_manager& gh_mgr = __get_gh_manager__ (); |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3771 graphics_object go = gh_mgr.get_object (props.get___myhandle__ ()); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3772 graphics_object ax = go.get_ancestor ("axes"); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3773 const axes::properties& ax_props |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3774 = dynamic_cast<const axes::properties&> (ax.get_properties ()); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3775 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3776 mfcolor = ax_props.get_color ().matrix_value (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3777 } |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3778 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3779 init_marker (props.get_marker (), std::sqrt (s(0)), |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3780 props.get_linewidth ()); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3781 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3782 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3783 uint8_t clip_ok = 0x40; |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3784 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3785 Matrix cc; |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3786 if (! c.isempty ()) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3787 { |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3788 if (c.rows () == 1) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3789 cc = c; |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3790 else |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3791 { |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3792 cc.resize (1, 3); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3793 cc(0) = c(0,0); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3794 cc(1) = c(0,1); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3795 cc(2) = c(0,2); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3796 } |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3797 } |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3798 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3799 for (int i = 0; i < np; i++) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3800 { |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3801 if ((clip_code (x(i), y(i), (has_z ? z(i) : 0.0)) & clip_mask) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3802 != clip_ok) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3803 continue; |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3804 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3805 if (c.rows () > 1) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3806 { |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3807 cc(0) = c(i,0); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3808 cc(1) = c(i,1); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3809 cc(2) = c(i,2); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3810 } |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3811 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3812 Matrix lc = (do_edge ? (mecolor.isempty () ? cc : mecolor) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3813 : Matrix ()); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3814 Matrix fc = (do_face ? (mfcolor.isempty () ? cc : mfcolor) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3815 : Matrix ()); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3816 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3817 if (s.numel () > 1) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3818 change_marker (props.get_marker (), std::sqrt (s(i))); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3819 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3820 draw_marker (x(i), y(i), (has_z ? z(i) : 0.0), lc, fc, mea, mfa); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3821 } |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3822 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3823 end_marker (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3824 } |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3825 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3826 #else |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3827 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3828 octave_unused_parameter (props); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3829 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3830 // This shouldn't happen because construction of opengl_renderer |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3831 // objects is supposed to be impossible if OpenGL is not available. |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3832 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3833 panic_impossible (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3834 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3835 #endif |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3836 } |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3837 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
3838 void |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23396
diff
changeset
|
3839 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
|
3840 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3841 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3842 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3843 // enable light source |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3844 m_glfcns.glEnable (m_current_light); |
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 // light position |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3847 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
|
3848 Matrix lpos = props.get_position ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3849 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3850 pos[i] = lpos(i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3851 if (props.style_is ("local")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3852 pos[3] = 1; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3853 m_glfcns.glLightfv (m_current_light, GL_POSITION, pos); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3854 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3855 // light color |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3856 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
|
3857 Matrix lcolor = props.get_color ().matrix_value (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3858 for (int i = 0; i < 3; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3859 col[i] = lcolor(i); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3860 m_glfcns.glLightfv (m_current_light, GL_DIFFUSE, col); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3861 m_glfcns.glLightfv (m_current_light, GL_SPECULAR, col); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3862 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3863 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3864 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3865 octave_unused_parameter (props); |
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 // 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
|
3868 // 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
|
3869 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3870 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
3871 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
3872 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3873 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3874 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3875 void |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23396
diff
changeset
|
3876 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
|
3877 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3878 draw (props.get_children ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3879 } |
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 void |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3882 opengl_renderer::set_ortho_coordinates (void) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3883 { |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3884 #if defined (HAVE_OPENGL) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3885 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3886 m_glfcns.glMatrixMode (GL_PROJECTION); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3887 m_glfcns.glPushMatrix (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3888 m_glfcns.glLoadIdentity (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3889 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3890 Matrix vp = get_viewport_scaled (); |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3891 m_glfcns.glOrtho (0, vp(2), vp(3), 0, m_xZ1, m_xZ2); |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3892 m_glfcns.glMatrixMode (GL_MODELVIEW); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3893 m_glfcns.glPushMatrix (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3894 m_glfcns.glLoadIdentity (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3895 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3896 #else |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3897 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3898 // This shouldn't happen because construction of opengl_renderer |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3899 // objects is supposed to be impossible if OpenGL is not available. |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3900 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3901 panic_impossible (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3902 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3903 #endif |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3904 } |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3905 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3906 void |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3907 opengl_renderer::restore_previous_coordinates (void) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3908 { |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3909 #if defined (HAVE_OPENGL) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3910 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3911 // Restore previous coordinate system |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3912 m_glfcns.glMatrixMode (GL_MODELVIEW); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3913 m_glfcns.glPopMatrix(); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3914 m_glfcns.glMatrixMode (GL_PROJECTION); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3915 m_glfcns.glPopMatrix(); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3916 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3917 #else |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3918 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3919 // This shouldn't happen because construction of opengl_renderer |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3920 // objects is supposed to be impossible if OpenGL is not available. |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3921 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3922 panic_impossible (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3923 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3924 #endif |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3925 } |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3926 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3927 void |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3928 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
|
3929 { |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3930 #if defined (HAVE_OPENGL) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3931 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
3932 if (props.get_string ().isempty () || props.color_is ("none")) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3933 return; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3934 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
3935 Matrix pos = m_xform.scale (props.get_data_position ()); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3936 |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3937 // Handle clipping manually when drawing text in ortho coordinates |
25951 | 3938 if (! props.is_clipping () |
25952 | 3939 || (clip_code (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0) == 0x40)) |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3940 { |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3941 set_clipping (false); |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3942 |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3943 draw_text_background (props); |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3944 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3945 set_font (props); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3946 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3947 render_text (props.get_pixels (), props.get_extent_matrix (), |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3948 pos(0), pos(1), pos(2), props.get_rotation ()); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3949 |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3950 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
|
3951 } |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3952 |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3953 #else |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3954 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3955 octave_unused_parameter (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3956 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3957 // 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
|
3958 // 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
|
3959 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3960 panic_impossible (); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3961 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
3962 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3963 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3964 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
3965 void |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3966 opengl_renderer::draw_text_background (const text::properties& props, |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3967 bool /*do_rotate*/) |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3968 { |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3969 #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
|
3970 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3971 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
|
3972 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
|
3973 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3974 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
|
3975 return; |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3976 |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3977 Matrix pos = props.get_data_position (); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3978 ColumnVector pixpos = get_transform ().transform (pos(0), pos(1), |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3979 pos(2), true); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3980 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3981 // Save current transform matrices and set orthogonal window coordinates |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3982 set_ortho_coordinates (); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3983 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3984 // Translate coordinates so that the text anchor is (0,0) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
3985 m_glfcns.glTranslated (pixpos(0), pixpos(1), -pixpos(2)); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3986 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3987 // 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
|
3988 // 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
|
3989 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
|
3990 |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
3991 m_glfcns.glRotated (-rotation, 0.0, 0.0, 1.0); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3992 |
28399
2a0e566a03e1
Don't scale text margin in printout (bug #58486)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28189
diff
changeset
|
3993 double m = points_to_pixels (props.get_margin ()); |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3994 const Matrix bbox = props.get_extent_matrix (); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3995 double x0 = bbox (0) / m_devpixratio - m; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3996 double x1 = x0 + bbox(2) / m_devpixratio + 2 * m; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3997 double y0 = -(bbox (1) / m_devpixratio - m); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
3998 double y1 = y0 - (bbox(3) / m_devpixratio + 2 * m); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
3999 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4000 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
|
4001 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4002 m_glfcns.glColor3f (bgcol(0), bgcol(1), bgcol(2)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4003 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4004 bool depth_test = m_glfcns.glIsEnabled (GL_DEPTH_TEST); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4005 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
|
4006 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
|
4007 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4008 m_glfcns.glBegin (GL_QUADS); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4009 m_glfcns.glVertex2d (x0, y0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4010 m_glfcns.glVertex2d (x1, y0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4011 m_glfcns.glVertex2d (x1, y1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4012 m_glfcns.glVertex2d (x0, y1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4013 m_glfcns.glEnd (); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4014 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4015 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
|
4016 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
|
4017 } |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4018 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4019 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
|
4020 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4021 m_glfcns.glColor3f (ecol(0), ecol(1), ecol(2)); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4022 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4023 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
|
4024 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
|
4025 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4026 m_glfcns.glBegin (GL_LINE_STRIP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4027 m_glfcns.glVertex2d (x0, y0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4028 m_glfcns.glVertex2d (x1, y0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4029 m_glfcns.glVertex2d (x1, y1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4030 m_glfcns.glVertex2d (x0, y1); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4031 m_glfcns.glVertex2d (x0, y0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4032 m_glfcns.glEnd (); |
25260
601cc3a063f5
Fix OpenGL line-stipple bug manifested as Nouveau driver crash (bug #53644)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
4033 |
601cc3a063f5
Fix OpenGL line-stipple bug manifested as Nouveau driver crash (bug #53644)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
4034 set_linestyle ("-"); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4035 } |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4036 |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4037 restore_previous_coordinates (); |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4038 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4039 #else |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4040 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4041 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
|
4042 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4043 // 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
|
4044 // 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
|
4045 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4046 panic_impossible (); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4047 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4048 #endif |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4049 } |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4050 |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24154
diff
changeset
|
4051 void |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4052 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
|
4053 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4054 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4055 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4056 octave_value cdata = props.get_color_data (); |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4057 Matrix x = props.get_xdata ().matrix_value (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4058 Matrix y = props.get_ydata ().matrix_value (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4059 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4060 draw_texture_image (cdata, x, y); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4061 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4062 #else |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4063 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4064 octave_unused_parameter (props); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4065 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4066 // This shouldn't happen because construction of opengl_renderer |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4067 // objects is supposed to be impossible if OpenGL is not available. |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4068 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4069 panic_impossible (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4070 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4071 #endif |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4072 } |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4073 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4074 void |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4075 opengl_renderer::draw_texture_image (const octave_value cdata, Matrix x, |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4076 Matrix y, bool ortho) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4077 { |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4078 #if defined (HAVE_OPENGL) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4079 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4080 dim_vector dv (cdata.dims ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4081 int h = dv(0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4082 int w = dv(1); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4083 double x0, x1, y0, y1; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4084 |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4085 double dx = 1.0; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4086 if (w > 1) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4087 dx = (x(1) - x(0)) / (w - 1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4088 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4089 x0 = x(0)-dx/2; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4090 x1 = x(1)+dx/2; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4091 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4092 double dy = 1.0; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4093 if (h > 1) |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4094 dy = (y(1) - y(0)) / (h - 1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4095 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4096 y0 = y(0)-dy/2; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26720
diff
changeset
|
4097 y1 = y(1)+dy/2; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4098 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4099 // Expect RGB data |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4100 if (dv.ndims () == 3 && (dv(2) == 3 || dv(2) == 4)) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4101 { |
26862
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4102 opengl_texture tex = opengl_texture::create (m_glfcns, cdata); |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4103 if (tex.is_valid ()) |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4104 { |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4105 m_glfcns.glColor4d (1.0, 1.0, 1.0, 1.0); |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4106 |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4107 m_glfcns.glEnable (GL_TEXTURE_2D); |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4108 |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4109 m_glfcns.glBegin (GL_QUADS); |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4110 |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4111 tex.tex_coord (0.0, 0.0); |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4112 if (ortho) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4113 m_glfcns.glVertex2d (x0, y0); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4114 else |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4115 m_glfcns.glVertex3d (x0, y0, 0.0); |
26862
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4116 |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4117 tex.tex_coord (1.0, 0.0); |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4118 if (ortho) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4119 m_glfcns.glVertex2d (x1, y0); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4120 else |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4121 m_glfcns.glVertex3d (x1, y0, 0.0); |
26862
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4122 |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4123 tex.tex_coord (1.0, 1.0); |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4124 if (ortho) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4125 m_glfcns.glVertex2d (x1, y1); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4126 else |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4127 m_glfcns.glVertex3d (x1, y1, 0.0); |
26862
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4128 |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4129 tex.tex_coord (0.0, 1.0); |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4130 if (ortho) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4131 m_glfcns.glVertex2d (x0, y1); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4132 else |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4133 m_glfcns.glVertex3d (x0, y1, 0.0); |
26862
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4134 |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4135 m_glfcns.glEnd (); |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4136 m_glfcns.glDisable (GL_TEXTURE_2D); |
ea4a36fd48b6
Warn when image can't be rendered due to OpenGL library limitation (bug #54680)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26858
diff
changeset
|
4137 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4138 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4139 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4140 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
|
4141 |
21353
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 |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4144 octave_unused_parameter (cdata); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4145 octave_unused_parameter (x); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4146 octave_unused_parameter (y); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4147 octave_unused_parameter (ortho); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4148 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4149 // 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
|
4150 // 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
|
4151 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4152 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4153 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4154 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4155 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4156 |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4157 void opengl_renderer::draw (const Matrix& hlist, bool toplevel) |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4158 { |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4159 int len = hlist.numel (); |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4160 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
4161 gh_manager& gh_mgr = __get_gh_manager__ (); |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4162 |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4163 for (int i = len-1; i >= 0; i--) |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4164 { |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4165 graphics_object obj = gh_mgr.get_object (hlist(i)); |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4166 |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4167 if (obj) |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4168 draw (obj, toplevel); |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4169 } |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4170 } |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
4171 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4172 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4173 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
|
4174 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4175 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4176 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4177 m_glfcns.glViewport (0, 0, w, h); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4178 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4179 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4180 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4181 octave_unused_parameter (w); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4182 octave_unused_parameter (h); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4183 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4184 // 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
|
4185 // 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
|
4186 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4187 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4188 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4189 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4190 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4191 |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4192 Matrix |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4193 opengl_renderer::get_viewport_scaled (void) const |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4194 { |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4195 Matrix retval (1, 4, 0.0); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4196 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4197 #if defined (HAVE_OPENGL) |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4198 #if defined (HAVE_FRAMEWORK_OPENGL) |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4199 GLint vp[4]; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4200 #else |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4201 int vp[4]; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4202 #endif |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4203 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4204 m_glfcns.glGetIntegerv (GL_VIEWPORT, vp); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4205 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4206 for (int i = 0; i < 4; i++) |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4207 retval(i) = static_cast<double> (vp[i]) / m_devpixratio; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4208 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4209 #else |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4210 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4211 // This shouldn't happen because construction of opengl_renderer |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4212 // objects is supposed to be impossible if OpenGL is not available. |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4213 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4214 panic_impossible (); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4215 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4216 #endif |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4217 |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4218 return retval; |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4219 } |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4220 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4221 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4222 opengl_renderer::set_color (const Matrix& c) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4223 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4224 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4225 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4226 m_glfcns.glColor3dv (c.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4227 |
26682
0780d3f4ecad
Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents:
26669
diff
changeset
|
4228 if (! c.isempty ()) |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4229 m_txt_renderer.set_color (c); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4230 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4231 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4232 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4233 octave_unused_parameter (c); |
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 // 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
|
4236 // 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
|
4237 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4238 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4239 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4240 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4241 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4242 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4243 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4244 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
|
4245 { |
26858
0adb232f93b9
Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26728
diff
changeset
|
4246 bool do_anti_alias = props.get ("fontsmoothing").string_value () == "on"; |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4247 m_txt_renderer.set_anti_aliasing (do_anti_alias); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4248 m_txt_renderer.set_font (props.get ("fontname").string_value (), |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4249 props.get ("fontweight").string_value (), |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4250 props.get ("fontangle").string_value (), |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4251 props.get ("__fontsize_points__").double_value () |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4252 * m_devpixratio); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4253 } |
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 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4256 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
|
4257 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4258 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4259 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4260 if (on) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4261 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4262 m_glfcns.glEnable (GL_POLYGON_OFFSET_FILL); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4263 m_glfcns.glEnable (GL_POLYGON_OFFSET_LINE); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4264 m_glfcns.glPolygonOffset (offset, offset); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4265 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4266 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4267 { |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4268 m_glfcns.glDisable (GL_POLYGON_OFFSET_FILL); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4269 m_glfcns.glDisable (GL_POLYGON_OFFSET_LINE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4270 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4271 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4272 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4273 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4274 octave_unused_parameter (on); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4275 octave_unused_parameter (offset); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4276 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4277 // 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
|
4278 // 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
|
4279 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4280 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4281 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4282 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4283 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4284 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4285 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4286 opengl_renderer::set_linewidth (float w) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4287 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4288 #if defined (HAVE_OPENGL) |
28189
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4289 // Measure LineWidth in points. See bug #53056. |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4290 m_glfcns.glLineWidth (points_to_pixels (w) * m_devpixratio); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4291 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4292 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4293 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4294 octave_unused_parameter (w); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4295 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4296 // 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
|
4297 // 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
|
4298 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4299 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4300 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4301 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4302 } |
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 void |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
4305 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
|
4306 double linewidth) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4307 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4308 #if defined (HAVE_OPENGL) |
28189
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4309 // Measure LineWidth in points. See bug #53056. |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4310 int factor = math::round (points_to_pixels (linewidth) * m_devpixratio); |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4311 if (factor < 1) |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4312 factor = 1; |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4313 |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4314 uint16_t pattern = 0xFFFF; |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4315 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4316 bool solid = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4317 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4318 if (s == "-") |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4319 solid = true; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4320 else if (s == ":") |
26688
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4321 { |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4322 if (factor > 1) |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4323 pattern = 0x5555; |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4324 else |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4325 pattern = 0x1111; |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4326 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4327 else if (s == "--") |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
4328 { |
26688
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4329 if (factor > 1) |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4330 pattern = 0x0F0F; |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4331 else |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4332 pattern = 0x01FF; |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
4333 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4334 else if (s == "-.") |
26688
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4335 { |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4336 if (factor > 1) |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4337 pattern = 0x6F6F; |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4338 else |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4339 pattern = 0x18FF; |
4b4881ff0dc9
Improve appearance of patterned lines at small LineWidths.
Rik <rik@octave.org>
parents:
26682
diff
changeset
|
4340 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4341 else |
26564
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4342 pattern = 0x0000; |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4343 |
c40b3b671513
Fixed dash pattern when figure "__device_pixel_ratio__" is not 1 (bug #55484)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26468
diff
changeset
|
4344 m_glfcns.glLineStipple (factor, pattern); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4345 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4346 if (solid && ! use_stipple) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4347 m_glfcns.glDisable (GL_LINE_STIPPLE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4348 else |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4349 m_glfcns.glEnable (GL_LINE_STIPPLE); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4350 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4351 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4352 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4353 octave_unused_parameter (s); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4354 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
|
4355 octave_unused_parameter (linewidth); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4356 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4357 // 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
|
4358 // 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
|
4359 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4360 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4361 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4362 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4363 } |
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 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4366 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
|
4367 double z1, double z2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4368 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4369 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4370 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4371 double dx = (x2-x1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4372 double dy = (y2-y1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4373 double dz = (z2-z1); |
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 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
|
4376 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
|
4377 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
|
4378 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4379 ColumnVector p (4, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4380 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4381 p(0) = -1; p(3) = x2; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4382 m_glfcns.glClipPlane (GL_CLIP_PLANE0, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4383 p(0) = 1; p(3) = -x1; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4384 m_glfcns.glClipPlane (GL_CLIP_PLANE1, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4385 p(0) = 0; p(1) = -1; p(3) = y2; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4386 m_glfcns.glClipPlane (GL_CLIP_PLANE2, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4387 p(1) = 1; p(3) = -y1; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4388 m_glfcns.glClipPlane (GL_CLIP_PLANE3, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4389 p(1) = 0; p(2) = -1; p(3) = z2; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4390 m_glfcns.glClipPlane (GL_CLIP_PLANE4, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4391 p(2) = 1; p(3) = -z1; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4392 m_glfcns.glClipPlane (GL_CLIP_PLANE5, p.data ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4393 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4394 m_xmin = x1; m_xmax = x2; |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4395 m_ymin = y1; m_ymax = y2; |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4396 m_zmin = z1; m_zmax = z2; |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4397 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4398 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4399 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4400 octave_unused_parameter (x1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4401 octave_unused_parameter (x2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4402 octave_unused_parameter (y1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4403 octave_unused_parameter (y2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4404 octave_unused_parameter (z1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4405 octave_unused_parameter (z2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4406 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4407 // 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
|
4408 // 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
|
4409 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4410 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4411 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4412 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4413 } |
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 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4416 opengl_renderer::set_clipping (bool enable) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4417 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4418 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4419 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4420 bool has_clipping = (m_glfcns.glIsEnabled (GL_CLIP_PLANE0) == GL_TRUE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4421 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4422 if (enable != has_clipping) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4423 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4424 if (enable) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4425 for (int i = 0; i < 6; i++) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4426 m_glfcns.glEnable (GL_CLIP_PLANE0+i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4427 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4428 for (int i = 0; i < 6; i++) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4429 m_glfcns.glDisable (GL_CLIP_PLANE0+i); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4430 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4431 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4432 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4433 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4434 octave_unused_parameter (enable); |
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 // 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
|
4437 // 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
|
4438 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4439 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4440 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4441 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4442 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4443 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4444 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4445 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
|
4446 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4447 #if defined (HAVE_OPENGL) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4448 m_glfcns.glMatrixMode (GL_PROJECTION); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4449 m_glfcns.glPushMatrix (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4450 m_glfcns.glLoadIdentity (); |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25871
diff
changeset
|
4451 |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25884
diff
changeset
|
4452 Matrix vp = get_viewport_scaled (); |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4453 m_glfcns.glOrtho (0, vp(2), vp(3), 0, m_xZ1, m_xZ2); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4454 m_glfcns.glMatrixMode (GL_MODELVIEW); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4455 m_glfcns.glPushMatrix (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4456 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4457 set_clipping (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4458 set_linewidth (width); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4459 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4460 m_marker_id = make_marker_list (m, size, false); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4461 m_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
|
4462 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4463 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4464 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4465 octave_unused_parameter (m); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4466 octave_unused_parameter (size); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4467 octave_unused_parameter (width); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4468 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4469 // 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
|
4470 // 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
|
4471 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4472 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4473 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4474 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4475 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4476 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4477 void |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4478 opengl_renderer::change_marker (const std::string& m, double size) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4479 { |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4480 #if defined (HAVE_OPENGL) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4481 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4482 m_marker_id = make_marker_list (m, size, false); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4483 m_filled_marker_id = make_marker_list (m, size, true); |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4484 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4485 #else |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4486 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4487 octave_unused_parameter (m); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4488 octave_unused_parameter (size); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4489 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4490 // This shouldn't happen because construction of opengl_renderer |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4491 // objects is supposed to be impossible if OpenGL is not available. |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4492 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4493 panic_impossible (); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4494 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4495 #endif |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4496 } |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4497 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4498 void |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4499 opengl_renderer::end_marker (void) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4500 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4501 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4502 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4503 m_glfcns.glDeleteLists (m_marker_id, 1); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4504 m_glfcns.glDeleteLists (m_filled_marker_id, 1); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4505 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4506 m_glfcns.glMatrixMode (GL_MODELVIEW); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4507 m_glfcns.glPopMatrix (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4508 m_glfcns.glMatrixMode (GL_PROJECTION); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4509 m_glfcns.glPopMatrix (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4510 set_linewidth (0.5f); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4511 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4512 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4513 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4514 // This shouldn't happen because construction of opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4515 // objects is supposed to be impossible if OpenGL is not available. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4516 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4517 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4518 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4519 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4520 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4521 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4522 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4523 opengl_renderer::draw_marker (double x, double y, double z, |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4524 const Matrix& lc, const Matrix& fc, |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4525 const double la, const double fa) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4526 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4527 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4528 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4529 ColumnVector tmp = m_xform.transform (x, y, z, false); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4530 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4531 m_glfcns.glLoadIdentity (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4532 m_glfcns.glTranslated (tmp(0), tmp(1), -tmp(2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4533 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4534 if (m_filled_marker_id > 0 && fc.numel () > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4535 { |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4536 m_glfcns.glColor4d (fc(0), fc(1), fc(2), fa); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4537 set_polygon_offset (true, -1.0); |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4538 m_glfcns.glCallList (m_filled_marker_id); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4539 if (lc.numel () > 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4540 { |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4541 m_glfcns.glColor4d (lc(0), lc(1), lc(2), la); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4542 m_glfcns.glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4543 m_glfcns.glEdgeFlag (GL_TRUE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4544 set_polygon_offset (true, -2.0); |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4545 m_glfcns.glCallList (m_filled_marker_id); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4546 m_glfcns.glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4547 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4548 set_polygon_offset (false); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4549 } |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4550 else if (m_marker_id > 0 && lc.numel () > 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4551 { |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4552 m_glfcns.glColor4d (lc(0), lc(1), lc(2), la); |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4553 m_glfcns.glCallList (m_marker_id); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4554 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4555 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4556 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4557 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4558 octave_unused_parameter (x); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4559 octave_unused_parameter (y); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4560 octave_unused_parameter (z); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4561 octave_unused_parameter (lc); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4562 octave_unused_parameter (fc); |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4563 octave_unused_parameter (la); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28189
diff
changeset
|
4564 octave_unused_parameter (fa); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4565 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4566 // 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
|
4567 // 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
|
4568 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4569 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4570 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4571 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4572 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4573 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4574 void |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4575 opengl_renderer::init_maxlights (void) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4576 { |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4577 #if defined (HAVE_OPENGL) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4578 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4579 // Check actual maximum number of lights possible |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4580 if (m_max_lights == 0) |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4581 { |
28558
c9f7d1d7a6e7
gl-render.cc: Fix enumeration error.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28399
diff
changeset
|
4582 GLint max_lights; |
c9f7d1d7a6e7
gl-render.cc: Fix enumeration error.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28399
diff
changeset
|
4583 m_glfcns.glGetIntegerv (GL_MAX_LIGHTS, &max_lights); |
c9f7d1d7a6e7
gl-render.cc: Fix enumeration error.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28399
diff
changeset
|
4584 m_max_lights = max_lights; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4585 } |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4586 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4587 #else |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4588 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4589 // This shouldn't happen because construction of opengl_renderer |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4590 // objects is supposed to be impossible if OpenGL is not available. |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4591 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4592 panic_impossible (); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4593 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4594 #endif |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4595 } |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4596 |
26417
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4597 std::string |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4598 opengl_renderer::get_string (unsigned int id) const |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4599 { |
25864
baeb93e9febc
allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents:
25863
diff
changeset
|
4600 #if defined (HAVE_OPENGL) |
baeb93e9febc
allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents:
25863
diff
changeset
|
4601 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4602 // This is kind of ugly, but glGetString returns a pointer to GLubyte |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4603 // and there is no std::string constructor that matches. Is there a |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4604 // better way? |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4605 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4606 std::ostringstream buf; |
25864
baeb93e9febc
allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents:
25863
diff
changeset
|
4607 |
26417
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4608 buf << m_glfcns.glGetString (static_cast<GLenum> (id)); |
25864
baeb93e9febc
allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents:
25863
diff
changeset
|
4609 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4610 return std::string (buf.str ()); |
26417
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4611 |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4612 #else |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4613 |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4614 octave_unused_parameter (id); |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4615 |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4616 // This shouldn't happen because construction of opengl_renderer |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4617 // objects is supposed to be impossible if OpenGL is not available. |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4618 |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4619 panic_impossible (); |
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4620 return std::string (); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4621 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4622 #endif |
26417
4166610a41bc
do not include private file oct-opengl.h in public headers (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
26407
diff
changeset
|
4623 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4624 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4625 void |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4626 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
|
4627 { |
21797
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4628 #if defined (HAVE_OPENGL) |
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4629 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4630 double x = n(j,i,0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4631 double y = n(j,i,1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4632 double z = n(j,i,2); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4633 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4634 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
|
4635 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4636 double dir = 1.0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4637 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4638 if (bfl_mode > 0) |
30121
5c9f5353eef3
maint: use "m_" prefix for member variables in file gl-render.cc
Rik <rik@octave.org>
parents:
30040
diff
changeset
|
4639 dir = ((x*m_view_vector(0) + y*m_view_vector(1) + z*m_view_vector(2) < 0) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4640 ? ((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
|
4641 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4642 m_glfcns.glNormal3d (dir*x/d, dir*y/d, dir*z/d); |
21797
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4643 |
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4644 #else |
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4645 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4646 octave_unused_parameter (bfl_mode); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4647 octave_unused_parameter (n); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4648 octave_unused_parameter (j); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4649 octave_unused_parameter (i); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4650 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4651 // 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
|
4652 // 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
|
4653 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4654 panic_impossible (); |
21797
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4655 |
e5f083f9704e
eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents:
21790
diff
changeset
|
4656 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4657 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4658 |
28189
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4659 double |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4660 opengl_renderer::points_to_pixels (const double val) const |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4661 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
4662 gh_manager& gh_mgr = __get_gh_manager__ (); |
28189
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4663 |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4664 // FIXME: Does making this static cause problems if figure is moved to a |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4665 // 2nd monitor with a different value for "screenpixelsperinch"? |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4666 static const double pix_per_pts = |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4667 gh_mgr.get_object (0).get ("screenpixelsperinch").double_value () / 72.0; |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4668 |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4669 double retval = val; |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4670 |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4671 if (! m_printing) |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4672 retval *= pix_per_pts; |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4673 |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4674 return retval; |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4675 } |
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4676 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4677 unsigned int |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4678 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
|
4679 bool filled) const |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4680 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4681 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4682 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4683 char c = marker[0]; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4684 |
30253
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4685 if (filled && (c == '+' || c == 'x' || c == '*' || c == '.' |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4686 || c == '|' || c == '_')) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4687 return 0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4688 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4689 unsigned int ID = m_glfcns.glGenLists (1); |
26720
9a678e0de658
Measure LineWidth in points, not pixels, for Matlab compatibility (bug #53056).
Rik <rik@octave.org>
parents:
26688
diff
changeset
|
4690 |
9a678e0de658
Measure LineWidth in points, not pixels, for Matlab compatibility (bug #53056).
Rik <rik@octave.org>
parents:
26688
diff
changeset
|
4691 // FIXME: See bug #53056 (measure LineWidth in points). |
28189
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28006
diff
changeset
|
4692 double sz = points_to_pixels (size); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4693 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4694 // constants for the * marker |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4695 const double sqrt2d4 = 0.35355339059327; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4696 double tt = sz*sqrt2d4; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4697 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4698 m_glfcns.glNewList (ID, GL_COMPILE); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4699 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4700 switch (marker[0]) |
7851
002b1d8460d2
added some more markers
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7846
diff
changeset
|
4701 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4702 case '+': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4703 m_glfcns.glBegin (GL_LINES); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4704 m_glfcns.glVertex2d (-sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4705 m_glfcns.glVertex2d (sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4706 m_glfcns.glVertex2d (0, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4707 m_glfcns.glVertex2d (0, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4708 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4709 break; |
30253
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4710 case '|': |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4711 m_glfcns.glBegin (GL_LINES); |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4712 m_glfcns.glVertex2d (0, -sz/2); |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4713 m_glfcns.glVertex2d (0, sz/2); |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4714 m_glfcns.glEnd (); |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4715 break; |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4716 case '_': |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4717 m_glfcns.glBegin (GL_LINES); |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4718 m_glfcns.glVertex2d (-sz/2, 0); |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4719 m_glfcns.glVertex2d (sz/2, 0); |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4720 m_glfcns.glEnd (); |
20fd3c03fd74
Add new plot marker styles '|' and '_' (bug #61350)
Rik <rik@octave.org>
parents:
30121
diff
changeset
|
4721 break; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4722 case 'x': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4723 m_glfcns.glBegin (GL_LINES); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4724 m_glfcns.glVertex2d (-sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4725 m_glfcns.glVertex2d (sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4726 m_glfcns.glVertex2d (-sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4727 m_glfcns.glVertex2d (sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4728 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4729 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4730 case '*': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4731 m_glfcns.glBegin (GL_LINES); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4732 m_glfcns.glVertex2d (-sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4733 m_glfcns.glVertex2d (sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4734 m_glfcns.glVertex2d (0, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4735 m_glfcns.glVertex2d (0, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4736 m_glfcns.glVertex2d (-tt, -tt); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4737 m_glfcns.glVertex2d (+tt, +tt); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4738 m_glfcns.glVertex2d (-tt, +tt); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4739 m_glfcns.glVertex2d (+tt, -tt); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4740 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4741 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4742 case '.': |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4743 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4744 // 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
|
4745 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4746 // 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
|
4747 if (sz > 0 && sz < 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4748 sz = 3; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4749 |
25688
b2917b7858ba
maint: Use Octave convention for spacing of C++ cast statements.
Rik <rik@octave.org>
parents:
25438
diff
changeset
|
4750 int div = static_cast<int> (M_PI * sz / 12); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4751 if (! (div % 2)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4752 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
|
4753 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
|
4754 double ang_step = M_PI / div; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4755 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4756 m_glfcns.glBegin (GL_POLYGON); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4757 for (double ang = 0; ang < 2*M_PI; ang += ang_step) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4758 m_glfcns.glVertex2d (sz/6*cos (ang), sz/6*sin (ang)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4759 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4760 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4761 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4762 case 's': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4763 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4764 m_glfcns.glVertex2d (-sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4765 m_glfcns.glVertex2d (-sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4766 m_glfcns.glVertex2d (sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4767 m_glfcns.glVertex2d (sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4768 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4769 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4770 case 'o': |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4771 { |
25688
b2917b7858ba
maint: Use Octave convention for spacing of C++ cast statements.
Rik <rik@octave.org>
parents:
25438
diff
changeset
|
4772 int div = static_cast<int> (M_PI * sz / 4); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4773 if (! (div % 2)) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4774 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
|
4775 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
|
4776 double ang_step = M_PI / div; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4777 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4778 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4779 for (double ang = 0; ang < 2*M_PI; ang += ang_step) |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4780 m_glfcns.glVertex2d (sz/2*cos (ang), sz/2*sin (ang)); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4781 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4782 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4783 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4784 case 'd': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4785 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4786 m_glfcns.glVertex2d (0, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4787 m_glfcns.glVertex2d (sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4788 m_glfcns.glVertex2d (0, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4789 m_glfcns.glVertex2d (-sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4790 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4791 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4792 case 'v': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4793 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4794 m_glfcns.glVertex2d (0, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4795 m_glfcns.glVertex2d (sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4796 m_glfcns.glVertex2d (-sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4797 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4798 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4799 case '^': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4800 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4801 m_glfcns.glVertex2d (0, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4802 m_glfcns.glVertex2d (-sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4803 m_glfcns.glVertex2d (sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4804 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4805 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4806 case '>': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4807 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4808 m_glfcns.glVertex2d (sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4809 m_glfcns.glVertex2d (-sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4810 m_glfcns.glVertex2d (-sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4811 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4812 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4813 case '<': |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4814 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4815 m_glfcns.glVertex2d (-sz/2, 0); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4816 m_glfcns.glVertex2d (sz/2, -sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4817 m_glfcns.glVertex2d (sz/2, sz/2); |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4818 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4819 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4820 case 'p': |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4821 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4822 double ang, r, dr; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4823 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
|
4824 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4825 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4826 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
|
4827 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4828 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
|
4829 r = 1.0 - (dr * fmod (double (i+1), 2.0)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4830 m_glfcns.glVertex2d (sz/2*r*cos (ang), sz/2*r*sin (ang)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4831 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4832 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4833 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4834 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4835 case 'h': |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4836 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4837 double ang, r, dr; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4838 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
|
4839 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4840 m_glfcns.glBegin (filled ? GL_POLYGON : GL_LINE_LOOP); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4841 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
|
4842 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4843 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
|
4844 r = 1.0 - (dr * fmod (double (i+1), 2.0)); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4845 m_glfcns.glVertex2d (sz/2*r*cos (ang), sz/2*r*sin (ang)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4846 } |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4847 m_glfcns.glEnd (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4848 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4849 break; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4850 default: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4851 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
|
4852 break; |
7851
002b1d8460d2
added some more markers
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7846
diff
changeset
|
4853 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4854 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25828
diff
changeset
|
4855 m_glfcns.glEndList (); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4856 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4857 return ID; |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4858 |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4859 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4860 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4861 octave_unused_parameter (marker); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4862 octave_unused_parameter (size); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4863 octave_unused_parameter (filled); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4864 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4865 // 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
|
4866 // 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
|
4867 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4868 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4869 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4870 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4871 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4872 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4873 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4874 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
|
4875 uint8NDArray& pixels, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4876 Matrix& bbox, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4877 int halign, int valign, double rotation) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4878 { |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4879 m_txt_renderer.text_to_pixels (txt, pixels, bbox, halign, valign, |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4880 rotation, m_interpreter); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4881 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4882 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4883 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4884 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
|
4885 std::list<text_renderer::string>& lst, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4886 Matrix& bbox, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4887 int halign, int valign, double rotation) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4888 { |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4889 m_txt_renderer.text_to_strlist (txt, lst, bbox, halign, valign, |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4890 rotation, m_interpreter); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4891 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4892 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4893 Matrix |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4894 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
|
4895 double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4896 int halign, int valign, double rotation) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4897 { |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4898 #if defined (HAVE_OPENGL) |
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4899 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4900 Matrix bbox (1, 4, 0.0); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4901 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4902 if (txt.empty ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4903 return bbox; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4904 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29435
diff
changeset
|
4905 if (m_txt_renderer.ok ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4906 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4907 uint8NDArray pixels; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4908 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
|
4909 |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4910 render_text (pixels, bbox, x, y, z, rotation); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4911 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4912 |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
4913 return bbox; |
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
4914 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4915 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4916 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4917 octave_unused_parameter (txt); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4918 octave_unused_parameter (x); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4919 octave_unused_parameter (y); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4920 octave_unused_parameter (z); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4921 octave_unused_parameter (halign); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4922 octave_unused_parameter (valign); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4923 octave_unused_parameter (rotation); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4924 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4925 // 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
|
4926 // 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
|
4927 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4928 panic_impossible (); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21689
diff
changeset
|
4929 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
4930 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
4931 } |
29433
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4932 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4933 void |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4934 opengl_renderer::render_text (uint8NDArray pixels, Matrix bbox, |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4935 double x, double y, double z, double rotation) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4936 { |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4937 #if defined (HAVE_OPENGL) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4938 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4939 // Transform data coordinates to screen pixel ortho coordinates |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4940 ColumnVector pixpos = get_transform ().transform (x, y, z, false); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4941 Matrix xdata(1, 2, bbox(0) / m_devpixratio); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4942 xdata(1) += (bbox(2) - 1) / m_devpixratio; |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4943 Matrix ydata(1, 2, -bbox(1) / m_devpixratio); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4944 ydata(1) -= (bbox(3) - 1) / m_devpixratio; |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4945 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4946 bool blend = m_glfcns.glIsEnabled (GL_BLEND); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4947 m_glfcns.glEnable (GL_BLEND); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4948 m_glfcns.glEnable (GL_ALPHA_TEST); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4949 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4950 set_ortho_coordinates (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4951 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4952 // Translate coordinates so that the text anchor is (0,0) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4953 m_glfcns.glTranslated (pixpos(0), pixpos(1), -pixpos(2)); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4954 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4955 m_glfcns.glRotated (-rotation, 0.0, 0.0, 1.0); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4956 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4957 // Permute pixels returned by freetype |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4958 Array<octave_idx_type> perm (dim_vector (3, 1)); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4959 perm(0) = 2; |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4960 perm(1) = 1; |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4961 perm(2) = 0; |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4962 draw_texture_image (pixels.permute (perm), |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4963 xdata, ydata, true); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4964 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4965 restore_previous_coordinates (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4966 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4967 m_glfcns.glDisable (GL_ALPHA_TEST); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4968 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4969 if (! blend) |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4970 m_glfcns.glDisable (GL_BLEND); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4971 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4972 #else |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4973 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4974 octave_unused_parameter (pixels); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4975 octave_unused_parameter (bbox); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4976 octave_unused_parameter (x); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4977 octave_unused_parameter (y); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4978 octave_unused_parameter (z); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4979 octave_unused_parameter (rotation); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4980 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4981 // This shouldn't happen because construction of opengl_renderer |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4982 // objects is supposed to be impossible if OpenGL is not available. |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4983 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4984 panic_impossible (); |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4985 |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4986 #endif |
8811d8274118
Allow arbitrary text rotation onscreen (bug #33118)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29427
diff
changeset
|
4987 } |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
4988 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
4989 OCTAVE_END_NAMESPACE(octave) |