annotate libinterp/corefcn/gl-render.cc @ 22755:3a2b891d0b33

maint: Standardize Copyright formatting. * Makefile.am, README, build-aux/check-subst-vars.in.sh, build-aux/find-files-with-tests.sh, build-aux/mk-builtins.sh, build-aux/mk-default-qt-settings.in.sh, build-aux/mk-f77-def.in.sh, build-aux/mk-hg-id.sh, build-aux/mk-mxarray-h.in.sh, build-aux/mk-octave-config-h.sh, build-aux/mk-opts.pl, build-aux/mk-version-h.in.sh, build-aux/subst-config-vals.in.sh, build-aux/subst-cross-config-vals.in.sh, build-aux/subst-default-vals.in.sh, build-aux/subst-f77-isnan-macro.in.sh, build-aux/subst-script-vals.in.sh, configure.ac, doc/interpreter/arith.txi, doc/interpreter/audio.txi, doc/interpreter/basics.txi, doc/interpreter/bugs.txi, doc/interpreter/container.txi, doc/interpreter/cp-idx.txi, doc/interpreter/data.txi, doc/interpreter/debug.txi, doc/interpreter/diagperm.txi, doc/interpreter/diffeq.txi, doc/interpreter/errors.txi, doc/interpreter/eval.txi, doc/interpreter/expr.txi, doc/interpreter/external.txi, doc/interpreter/fn-idx.txi, doc/interpreter/func.txi, doc/interpreter/genpropdoc.m, doc/interpreter/geometry.txi, doc/interpreter/geometryimages.m, doc/interpreter/grammar.txi, doc/interpreter/gui.txi, doc/interpreter/image.txi, doc/interpreter/install.txi, doc/interpreter/interp.txi, doc/interpreter/interpimages.m, doc/interpreter/intro.txi, doc/interpreter/io.txi, doc/interpreter/linalg.txi, doc/interpreter/macros.texi, doc/interpreter/matrix.txi, doc/interpreter/mk-doc-cache.pl, doc/interpreter/mkoctfile.1, doc/interpreter/nonlin.txi, doc/interpreter/numbers.txi, doc/interpreter/obsolete.txi, doc/interpreter/octave-cli.1, doc/interpreter/octave-config.1, doc/interpreter/octave.1, doc/interpreter/octave.css, doc/interpreter/octave.texi, doc/interpreter/oop.txi, doc/interpreter/op-idx.txi, doc/interpreter/optim.txi, doc/interpreter/package.txi, doc/interpreter/plot.txi, doc/interpreter/plotimages.m, doc/interpreter/poly.txi, doc/interpreter/preface.txi, doc/interpreter/quad.txi, doc/interpreter/set.txi, doc/interpreter/signal.txi, doc/interpreter/sparse.txi, doc/interpreter/sparseimages.m, doc/interpreter/splineimages.m, doc/interpreter/stats.txi, doc/interpreter/stmt.txi, doc/interpreter/strings.txi, doc/interpreter/system.txi, doc/interpreter/testfun.txi, doc/interpreter/var.txi, doc/interpreter/vectorize.txi, doc/liboctave/array.texi, doc/liboctave/bugs.texi, doc/liboctave/cp-idx.texi, doc/liboctave/dae.texi, doc/liboctave/diffeq.texi, doc/liboctave/error.texi, doc/liboctave/factor.texi, doc/liboctave/fn-idx.texi, doc/liboctave/gpl.texi, doc/liboctave/install.texi, doc/liboctave/intro.texi, doc/liboctave/liboctave.texi, doc/liboctave/matvec.texi, doc/liboctave/nleqn.texi, doc/liboctave/nlfunc.texi, doc/liboctave/ode.texi, doc/liboctave/optim.texi, doc/liboctave/preface.texi, doc/liboctave/quad.texi, doc/liboctave/range.texi, doc/refcard/refcard-a4.tex, doc/refcard/refcard-legal.tex, doc/refcard/refcard-letter.tex, doc/refcard/refcard.tex, etc/HACKING, etc/icons/octave.appdata.xml.in, libgui/graphics/Backend.cc, libgui/graphics/Backend.h, libgui/graphics/BaseControl.cc, libgui/graphics/BaseControl.h, libgui/graphics/ButtonControl.cc, libgui/graphics/ButtonControl.h, libgui/graphics/ButtonGroup.cc, libgui/graphics/ButtonGroup.h, libgui/graphics/Canvas.cc, libgui/graphics/Canvas.h, libgui/graphics/CheckBoxControl.cc, libgui/graphics/CheckBoxControl.h, libgui/graphics/Container.cc, libgui/graphics/Container.h, libgui/graphics/ContextMenu.cc, libgui/graphics/ContextMenu.h, libgui/graphics/EditControl.cc, libgui/graphics/EditControl.h, libgui/graphics/Figure.cc, libgui/graphics/Figure.h, libgui/graphics/FigureWindow.cc, libgui/graphics/FigureWindow.h, libgui/graphics/GLCanvas.cc, libgui/graphics/GLCanvas.h, libgui/graphics/GenericEventNotify.h, libgui/graphics/KeyMap.cc, libgui/graphics/KeyMap.h, libgui/graphics/ListBoxControl.cc, libgui/graphics/ListBoxControl.h, libgui/graphics/Logger.cc, libgui/graphics/Logger.h, libgui/graphics/Menu.cc, libgui/graphics/Menu.h, libgui/graphics/MenuContainer.h, libgui/graphics/MouseModeActionGroup.cc, libgui/graphics/MouseModeActionGroup.h, libgui/graphics/Object.cc, libgui/graphics/Object.h, libgui/graphics/ObjectFactory.cc, libgui/graphics/ObjectFactory.h, libgui/graphics/ObjectProxy.cc, libgui/graphics/ObjectProxy.h, libgui/graphics/Panel.cc, libgui/graphics/Panel.h, libgui/graphics/PopupMenuControl.cc, libgui/graphics/PopupMenuControl.h, libgui/graphics/PushButtonControl.cc, libgui/graphics/PushButtonControl.h, libgui/graphics/PushTool.cc, libgui/graphics/PushTool.h, libgui/graphics/QtHandlesUtils.cc, libgui/graphics/QtHandlesUtils.h, libgui/graphics/RadioButtonControl.cc, libgui/graphics/RadioButtonControl.h, libgui/graphics/SliderControl.cc, libgui/graphics/SliderControl.h, libgui/graphics/TextControl.cc, libgui/graphics/TextControl.h, libgui/graphics/TextEdit.cc, libgui/graphics/TextEdit.h, libgui/graphics/ToggleButtonControl.cc, libgui/graphics/ToggleButtonControl.h, libgui/graphics/ToggleTool.cc, libgui/graphics/ToggleTool.h, libgui/graphics/ToolBar.cc, libgui/graphics/ToolBar.h, libgui/graphics/ToolBarButton.cc, libgui/graphics/ToolBarButton.h, libgui/graphics/__init_qt__.cc, libgui/graphics/__init_qt__.h, libgui/graphics/annotation-dialog.cc, libgui/graphics/annotation-dialog.h, libgui/graphics/gl-select.cc, libgui/graphics/gl-select.h, libgui/src/color-picker.cc, libgui/src/color-picker.h, libgui/src/dialog.cc, libgui/src/dialog.h, libgui/src/documentation-dock-widget.cc, libgui/src/documentation-dock-widget.h, libgui/src/files-dock-widget.cc, libgui/src/files-dock-widget.h, libgui/src/find-files-dialog.cc, libgui/src/find-files-dialog.h, libgui/src/find-files-model.cc, libgui/src/find-files-model.h, libgui/src/history-dock-widget.cc, libgui/src/history-dock-widget.h, libgui/src/liboctgui-build-info.h, libgui/src/liboctgui-build-info.in.cc, libgui/src/m-editor/file-editor-interface.h, libgui/src/m-editor/file-editor-tab.cc, libgui/src/m-editor/file-editor-tab.h, libgui/src/m-editor/file-editor.cc, libgui/src/m-editor/file-editor.h, libgui/src/m-editor/find-dialog.cc, libgui/src/m-editor/find-dialog.h, libgui/src/m-editor/marker.cc, libgui/src/m-editor/marker.h, libgui/src/m-editor/octave-qscintilla.cc, libgui/src/m-editor/octave-qscintilla.h, libgui/src/m-editor/octave-txt-lexer.cc, libgui/src/m-editor/octave-txt-lexer.h, libgui/src/main-window.cc, libgui/src/main-window.h, libgui/src/octave-cmd.cc, libgui/src/octave-cmd.h, libgui/src/octave-dock-widget.cc, libgui/src/octave-dock-widget.h, libgui/src/octave-gui.cc, libgui/src/octave-gui.h, libgui/src/octave-interpreter.cc, libgui/src/octave-interpreter.h, libgui/src/octave-qt-link.cc, libgui/src/octave-qt-link.h, libgui/src/qtinfo/parser.cc, libgui/src/qtinfo/parser.h, libgui/src/qtinfo/webinfo.cc, libgui/src/qtinfo/webinfo.h, libgui/src/resource-manager.cc, libgui/src/resource-manager.h, libgui/src/settings-dialog.cc, libgui/src/settings-dialog.h, libgui/src/shortcut-manager.cc, libgui/src/shortcut-manager.h, libgui/src/terminal-dock-widget.cc, libgui/src/terminal-dock-widget.h, libgui/src/thread-manager.cc, libgui/src/thread-manager.h, libgui/src/welcome-wizard.cc, libgui/src/welcome-wizard.h, libgui/src/workspace-model.cc, libgui/src/workspace-model.h, libgui/src/workspace-view.cc, libgui/src/workspace-view.h, libinterp/build-env.h, libinterp/build-env.in.cc, libinterp/builtins.h, libinterp/corefcn/Cell.cc, libinterp/corefcn/Cell.h, libinterp/corefcn/__contourc__.cc, libinterp/corefcn/__dsearchn__.cc, libinterp/corefcn/__ichol__.cc, libinterp/corefcn/__ilu__.cc, libinterp/corefcn/__lin_interpn__.cc, libinterp/corefcn/__luinc__.cc, libinterp/corefcn/__magick_read__.cc, libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc, libinterp/corefcn/balance.cc, libinterp/corefcn/base-text-renderer.h, libinterp/corefcn/besselj.cc, libinterp/corefcn/betainc.cc, libinterp/corefcn/bitfcns.cc, libinterp/corefcn/bsxfun.cc, libinterp/corefcn/c-file-ptr-stream.cc, libinterp/corefcn/c-file-ptr-stream.h, libinterp/corefcn/call-stack.cc, libinterp/corefcn/call-stack.h, libinterp/corefcn/cdisplay.c, libinterp/corefcn/cdisplay.h, libinterp/corefcn/cellfun.cc, libinterp/corefcn/coct-hdf5-types.c, libinterp/corefcn/colloc.cc, libinterp/corefcn/comment-list.cc, libinterp/corefcn/comment-list.h, libinterp/corefcn/conv2.cc, libinterp/corefcn/daspk.cc, libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc, libinterp/corefcn/data.cc, libinterp/corefcn/data.h, libinterp/corefcn/debug.cc, libinterp/corefcn/debug.h, libinterp/corefcn/defaults.cc, libinterp/corefcn/defaults.in.h, libinterp/corefcn/defun-dld.h, libinterp/corefcn/defun-int.h, libinterp/corefcn/defun.cc, libinterp/corefcn/defun.h, libinterp/corefcn/det.cc, libinterp/corefcn/dirfns.cc, libinterp/corefcn/dirfns.h, libinterp/corefcn/display.cc, libinterp/corefcn/display.h, libinterp/corefcn/dlmread.cc, libinterp/corefcn/dot.cc, libinterp/corefcn/dynamic-ld.cc, libinterp/corefcn/dynamic-ld.h, libinterp/corefcn/eig.cc, libinterp/corefcn/ellipj.cc, libinterp/corefcn/error.cc, libinterp/corefcn/error.h, libinterp/corefcn/errwarn.cc, libinterp/corefcn/errwarn.h, libinterp/corefcn/event-queue.cc, libinterp/corefcn/event-queue.h, libinterp/corefcn/fft.cc, libinterp/corefcn/fft2.cc, libinterp/corefcn/fftn.cc, libinterp/corefcn/file-io.cc, libinterp/corefcn/file-io.h, libinterp/corefcn/filter.cc, libinterp/corefcn/find.cc, libinterp/corefcn/ft-text-renderer.cc, libinterp/corefcn/ft-text-renderer.h, libinterp/corefcn/gammainc.cc, libinterp/corefcn/gcd.cc, libinterp/corefcn/getgrent.cc, libinterp/corefcn/getpwent.cc, libinterp/corefcn/getrusage.cc, libinterp/corefcn/givens.cc, libinterp/corefcn/gl-render.cc, libinterp/corefcn/gl-render.h, libinterp/corefcn/gl2ps-print.cc, libinterp/corefcn/gl2ps-print.h, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/gripes.cc, libinterp/corefcn/gripes.h, libinterp/corefcn/gsvd.cc, libinterp/corefcn/hash.cc, libinterp/corefcn/help.cc, libinterp/corefcn/help.h, libinterp/corefcn/hess.cc, libinterp/corefcn/hex2num.cc, libinterp/corefcn/hook-fcn.cc, libinterp/corefcn/hook-fcn.h, libinterp/corefcn/input.cc, libinterp/corefcn/input.h, libinterp/corefcn/interpreter.cc, libinterp/corefcn/interpreter.h, libinterp/corefcn/inv.cc, libinterp/corefcn/jit-ir.cc, libinterp/corefcn/jit-ir.h, libinterp/corefcn/jit-typeinfo.cc, libinterp/corefcn/jit-typeinfo.h, libinterp/corefcn/jit-util.cc, libinterp/corefcn/jit-util.h, libinterp/corefcn/kron.cc, libinterp/corefcn/load-path.cc, libinterp/corefcn/load-path.h, libinterp/corefcn/load-save.cc, libinterp/corefcn/load-save.h, libinterp/corefcn/lookup.cc, libinterp/corefcn/ls-ascii-helper.cc, libinterp/corefcn/ls-ascii-helper.h, libinterp/corefcn/ls-hdf5.cc, libinterp/corefcn/ls-hdf5.h, libinterp/corefcn/ls-mat-ascii.cc, libinterp/corefcn/ls-mat-ascii.h, libinterp/corefcn/ls-mat4.cc, libinterp/corefcn/ls-mat4.h, libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/ls-mat5.h, libinterp/corefcn/ls-oct-binary.cc, libinterp/corefcn/ls-oct-binary.h, libinterp/corefcn/ls-oct-text.cc, libinterp/corefcn/ls-oct-text.h, libinterp/corefcn/ls-utils.cc, libinterp/corefcn/ls-utils.h, libinterp/corefcn/lsode.cc, libinterp/corefcn/lu.cc, libinterp/corefcn/mappers.cc, libinterp/corefcn/matrix_type.cc, libinterp/corefcn/max.cc, libinterp/corefcn/mex.cc, libinterp/corefcn/mex.h, libinterp/corefcn/mexproto.h, libinterp/corefcn/mgorth.cc, libinterp/corefcn/mxarray.in.h, libinterp/corefcn/nproc.cc, libinterp/corefcn/oct-errno.h, libinterp/corefcn/oct-errno.in.cc, libinterp/corefcn/oct-fstrm.cc, libinterp/corefcn/oct-fstrm.h, libinterp/corefcn/oct-handle.h, libinterp/corefcn/oct-hdf5-types.cc, libinterp/corefcn/oct-hdf5-types.h, libinterp/corefcn/oct-hdf5.h, libinterp/corefcn/oct-hist.cc, libinterp/corefcn/oct-hist.h, libinterp/corefcn/oct-iostrm.cc, libinterp/corefcn/oct-iostrm.h, libinterp/corefcn/oct-lvalue.cc, libinterp/corefcn/oct-lvalue.h, libinterp/corefcn/oct-map.cc, libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.h, libinterp/corefcn/oct-opengl.h, libinterp/corefcn/oct-prcstrm.cc, libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-procbuf.cc, libinterp/corefcn/oct-procbuf.h, libinterp/corefcn/oct-stdstrm.h, libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h, libinterp/corefcn/oct-strstrm.cc, libinterp/corefcn/oct-strstrm.h, libinterp/corefcn/oct-tex-lexer.in.ll, libinterp/corefcn/oct-tex-parser.in.yy, libinterp/corefcn/oct.h, libinterp/corefcn/octave-default-image.h, libinterp/corefcn/octave-link.cc, libinterp/corefcn/octave-link.h, libinterp/corefcn/octave-preserve-stream-state.h, libinterp/corefcn/ordschur.cc, libinterp/corefcn/pager.cc, libinterp/corefcn/pager.h, libinterp/corefcn/pinv.cc, libinterp/corefcn/pr-output.cc, libinterp/corefcn/pr-output.h, libinterp/corefcn/procstream.cc, libinterp/corefcn/procstream.h, libinterp/corefcn/profiler.cc, libinterp/corefcn/profiler.h, libinterp/corefcn/psi.cc, libinterp/corefcn/pt-jit.cc, libinterp/corefcn/pt-jit.h, libinterp/corefcn/quad.cc, libinterp/corefcn/quadcc.cc, libinterp/corefcn/qz.cc, libinterp/corefcn/rand.cc, libinterp/corefcn/rcond.cc, libinterp/corefcn/regexp.cc, libinterp/corefcn/schur.cc, libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sighandlers.h, libinterp/corefcn/sparse-xdiv.cc, libinterp/corefcn/sparse-xdiv.h, libinterp/corefcn/sparse-xpow.cc, libinterp/corefcn/sparse-xpow.h, libinterp/corefcn/sparse.cc, libinterp/corefcn/spparms.cc, libinterp/corefcn/sqrtm.cc, libinterp/corefcn/str2double.cc, libinterp/corefcn/strfind.cc, libinterp/corefcn/strfns.cc, libinterp/corefcn/sub2ind.cc, libinterp/corefcn/svd.cc, libinterp/corefcn/sylvester.cc, libinterp/corefcn/symtab.cc, libinterp/corefcn/symtab.h, libinterp/corefcn/syscalls.cc, libinterp/corefcn/sysdep.cc, libinterp/corefcn/sysdep.h, libinterp/corefcn/text-renderer.cc, libinterp/corefcn/text-renderer.h, libinterp/corefcn/time.cc, libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h, libinterp/corefcn/tril.cc, libinterp/corefcn/tsearch.cc, libinterp/corefcn/txt-eng.cc, libinterp/corefcn/txt-eng.h, libinterp/corefcn/typecast.cc, libinterp/corefcn/urlwrite.cc, libinterp/corefcn/utils.cc, libinterp/corefcn/utils.h, libinterp/corefcn/variables.cc, libinterp/corefcn/variables.h, libinterp/corefcn/workspace-element.h, libinterp/corefcn/xdiv.cc, libinterp/corefcn/xdiv.h, libinterp/corefcn/xnorm.cc, libinterp/corefcn/xnorm.h, libinterp/corefcn/xpow.cc, libinterp/corefcn/xpow.h, libinterp/corefcn/zfstream.cc, libinterp/corefcn/zfstream.h, libinterp/deprecated-config.h, libinterp/dldfcn/__delaunayn__.cc, libinterp/dldfcn/__eigs__.cc, libinterp/dldfcn/__fltk_uigetfile__.cc, libinterp/dldfcn/__glpk__.cc, libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__init_gnuplot__.cc, libinterp/dldfcn/__osmesa_print__.cc, libinterp/dldfcn/__voronoi__.cc, libinterp/dldfcn/amd.cc, libinterp/dldfcn/audiodevinfo.cc, libinterp/dldfcn/audioread.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/chol.cc, libinterp/dldfcn/colamd.cc, libinterp/dldfcn/convhulln.cc, libinterp/dldfcn/dmperm.cc, libinterp/dldfcn/fftw.cc, libinterp/dldfcn/gzip.cc, libinterp/dldfcn/oct-qhull.h, libinterp/dldfcn/qr.cc, libinterp/dldfcn/symbfact.cc, libinterp/dldfcn/symrcm.cc, libinterp/gendoc.pl, libinterp/genprops.awk, libinterp/liboctinterp-build-info.h, libinterp/liboctinterp-build-info.in.cc, libinterp/mk-errno-list, libinterp/mk-pkg-add, libinterp/mkops, libinterp/octave-value/ov-base-diag.cc, libinterp/octave-value/ov-base-diag.h, libinterp/octave-value/ov-base-int.cc, libinterp/octave-value/ov-base-int.h, libinterp/octave-value/ov-base-mat.cc, libinterp/octave-value/ov-base-mat.h, libinterp/octave-value/ov-base-scalar.cc, libinterp/octave-value/ov-base-scalar.h, libinterp/octave-value/ov-base-sparse.cc, libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.cc, libinterp/octave-value/ov-base.h, libinterp/octave-value/ov-bool-mat.cc, libinterp/octave-value/ov-bool-mat.h, libinterp/octave-value/ov-bool-sparse.cc, libinterp/octave-value/ov-bool-sparse.h, libinterp/octave-value/ov-bool.cc, libinterp/octave-value/ov-bool.h, libinterp/octave-value/ov-builtin.cc, libinterp/octave-value/ov-builtin.h, libinterp/octave-value/ov-cell.cc, libinterp/octave-value/ov-cell.h, libinterp/octave-value/ov-ch-mat.cc, libinterp/octave-value/ov-ch-mat.h, libinterp/octave-value/ov-class.cc, libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-classdef.cc, libinterp/octave-value/ov-classdef.h, libinterp/octave-value/ov-colon.cc, libinterp/octave-value/ov-colon.h, libinterp/octave-value/ov-complex.cc, libinterp/octave-value/ov-complex.h, libinterp/octave-value/ov-cs-list.cc, libinterp/octave-value/ov-cs-list.h, libinterp/octave-value/ov-cx-diag.cc, libinterp/octave-value/ov-cx-diag.h, libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-cx-mat.h, libinterp/octave-value/ov-cx-sparse.cc, libinterp/octave-value/ov-cx-sparse.h, libinterp/octave-value/ov-dld-fcn.cc, libinterp/octave-value/ov-dld-fcn.h, libinterp/octave-value/ov-fcn-handle.cc, libinterp/octave-value/ov-fcn-handle.h, libinterp/octave-value/ov-fcn-inline.cc, libinterp/octave-value/ov-fcn-inline.h, libinterp/octave-value/ov-fcn.cc, libinterp/octave-value/ov-fcn.h, libinterp/octave-value/ov-float.cc, libinterp/octave-value/ov-float.h, libinterp/octave-value/ov-flt-complex.cc, libinterp/octave-value/ov-flt-complex.h, libinterp/octave-value/ov-flt-cx-diag.cc, libinterp/octave-value/ov-flt-cx-diag.h, libinterp/octave-value/ov-flt-cx-mat.cc, libinterp/octave-value/ov-flt-cx-mat.h, libinterp/octave-value/ov-flt-re-diag.cc, libinterp/octave-value/ov-flt-re-diag.h, libinterp/octave-value/ov-flt-re-mat.cc, libinterp/octave-value/ov-flt-re-mat.h, libinterp/octave-value/ov-int-traits.h, libinterp/octave-value/ov-int16.cc, libinterp/octave-value/ov-int16.h, libinterp/octave-value/ov-int32.cc, libinterp/octave-value/ov-int32.h, libinterp/octave-value/ov-int64.cc, libinterp/octave-value/ov-int64.h, libinterp/octave-value/ov-int8.cc, libinterp/octave-value/ov-int8.h, libinterp/octave-value/ov-intx.h, libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-java.h, libinterp/octave-value/ov-lazy-idx.cc, libinterp/octave-value/ov-lazy-idx.h, libinterp/octave-value/ov-mex-fcn.cc, libinterp/octave-value/ov-mex-fcn.h, libinterp/octave-value/ov-null-mat.cc, libinterp/octave-value/ov-null-mat.h, libinterp/octave-value/ov-oncleanup.cc, libinterp/octave-value/ov-oncleanup.h, libinterp/octave-value/ov-perm.cc, libinterp/octave-value/ov-perm.h, libinterp/octave-value/ov-range.cc, libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-re-diag.cc, libinterp/octave-value/ov-re-diag.h, libinterp/octave-value/ov-re-mat.cc, libinterp/octave-value/ov-re-mat.h, libinterp/octave-value/ov-re-sparse.cc, libinterp/octave-value/ov-re-sparse.h, libinterp/octave-value/ov-scalar.cc, libinterp/octave-value/ov-scalar.h, libinterp/octave-value/ov-str-mat.cc, libinterp/octave-value/ov-str-mat.h, libinterp/octave-value/ov-struct.cc, libinterp/octave-value/ov-struct.h, libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-typeinfo.h, libinterp/octave-value/ov-uint16.cc, libinterp/octave-value/ov-uint16.h, libinterp/octave-value/ov-uint32.cc, libinterp/octave-value/ov-uint32.h, libinterp/octave-value/ov-uint64.cc, libinterp/octave-value/ov-uint64.h, libinterp/octave-value/ov-uint8.cc, libinterp/octave-value/ov-uint8.h, libinterp/octave-value/ov-usr-fcn.cc, libinterp/octave-value/ov-usr-fcn.h, libinterp/octave-value/ov.cc, libinterp/octave-value/ov.h, libinterp/octave-value/ovl.cc, libinterp/octave-value/ovl.h, libinterp/octave.cc, libinterp/octave.h, libinterp/op-kw-docs, libinterp/operators/op-b-b.cc, libinterp/operators/op-b-bm.cc, libinterp/operators/op-b-sbm.cc, libinterp/operators/op-bm-b.cc, libinterp/operators/op-bm-bm.cc, libinterp/operators/op-bm-sbm.cc, libinterp/operators/op-cdm-cdm.cc, libinterp/operators/op-cdm-cm.cc, libinterp/operators/op-cdm-cs.cc, libinterp/operators/op-cdm-dm.cc, libinterp/operators/op-cdm-m.cc, libinterp/operators/op-cdm-s.cc, libinterp/operators/op-cell.cc, libinterp/operators/op-chm.cc, libinterp/operators/op-class.cc, libinterp/operators/op-cm-cdm.cc, libinterp/operators/op-cm-cm.cc, libinterp/operators/op-cm-cs.cc, libinterp/operators/op-cm-dm.cc, libinterp/operators/op-cm-m.cc, libinterp/operators/op-cm-pm.cc, libinterp/operators/op-cm-s.cc, libinterp/operators/op-cm-scm.cc, libinterp/operators/op-cm-sm.cc, libinterp/operators/op-cs-cm.cc, libinterp/operators/op-cs-cs.cc, libinterp/operators/op-cs-m.cc, libinterp/operators/op-cs-s.cc, libinterp/operators/op-cs-scm.cc, libinterp/operators/op-cs-sm.cc, libinterp/operators/op-dm-cdm.cc, libinterp/operators/op-dm-cm.cc, libinterp/operators/op-dm-cs.cc, libinterp/operators/op-dm-dm.cc, libinterp/operators/op-dm-m.cc, libinterp/operators/op-dm-s.cc, libinterp/operators/op-dm-scm.cc, libinterp/operators/op-dm-sm.cc, libinterp/operators/op-dm-template.cc, libinterp/operators/op-dms-template.cc, libinterp/operators/op-fcdm-fcdm.cc, libinterp/operators/op-fcdm-fcm.cc, libinterp/operators/op-fcdm-fcs.cc, libinterp/operators/op-fcdm-fdm.cc, libinterp/operators/op-fcdm-fm.cc, libinterp/operators/op-fcdm-fs.cc, libinterp/operators/op-fcm-fcdm.cc, libinterp/operators/op-fcm-fcm.cc, libinterp/operators/op-fcm-fcs.cc, libinterp/operators/op-fcm-fdm.cc, libinterp/operators/op-fcm-fm.cc, libinterp/operators/op-fcm-fs.cc, libinterp/operators/op-fcm-pm.cc, libinterp/operators/op-fcn.cc, libinterp/operators/op-fcs-fcm.cc, libinterp/operators/op-fcs-fcs.cc, libinterp/operators/op-fcs-fm.cc, libinterp/operators/op-fcs-fs.cc, libinterp/operators/op-fdm-fcdm.cc, libinterp/operators/op-fdm-fcm.cc, libinterp/operators/op-fdm-fcs.cc, libinterp/operators/op-fdm-fdm.cc, libinterp/operators/op-fdm-fm.cc, libinterp/operators/op-fdm-fs.cc, libinterp/operators/op-fm-fcdm.cc, libinterp/operators/op-fm-fcm.cc, libinterp/operators/op-fm-fcs.cc, libinterp/operators/op-fm-fdm.cc, libinterp/operators/op-fm-fm.cc, libinterp/operators/op-fm-fs.cc, libinterp/operators/op-fm-pm.cc, libinterp/operators/op-fs-fcm.cc, libinterp/operators/op-fs-fcs.cc, libinterp/operators/op-fs-fm.cc, libinterp/operators/op-fs-fs.cc, libinterp/operators/op-i16-i16.cc, libinterp/operators/op-i32-i32.cc, libinterp/operators/op-i64-i64.cc, libinterp/operators/op-i8-i8.cc, libinterp/operators/op-int-concat.cc, libinterp/operators/op-int.h, libinterp/operators/op-m-cdm.cc, libinterp/operators/op-m-cm.cc, libinterp/operators/op-m-cs.cc, libinterp/operators/op-m-dm.cc, libinterp/operators/op-m-m.cc, libinterp/operators/op-m-pm.cc, libinterp/operators/op-m-s.cc, libinterp/operators/op-m-scm.cc, libinterp/operators/op-m-sm.cc, libinterp/operators/op-pm-cm.cc, libinterp/operators/op-pm-fcm.cc, libinterp/operators/op-pm-fm.cc, libinterp/operators/op-pm-m.cc, libinterp/operators/op-pm-pm.cc, libinterp/operators/op-pm-scm.cc, libinterp/operators/op-pm-sm.cc, libinterp/operators/op-pm-template.cc, libinterp/operators/op-range.cc, libinterp/operators/op-s-cm.cc, libinterp/operators/op-s-cs.cc, libinterp/operators/op-s-m.cc, libinterp/operators/op-s-s.cc, libinterp/operators/op-s-scm.cc, libinterp/operators/op-s-sm.cc, libinterp/operators/op-sbm-b.cc, libinterp/operators/op-sbm-bm.cc, libinterp/operators/op-sbm-sbm.cc, libinterp/operators/op-scm-cm.cc, libinterp/operators/op-scm-cs.cc, libinterp/operators/op-scm-m.cc, libinterp/operators/op-scm-s.cc, libinterp/operators/op-scm-scm.cc, libinterp/operators/op-scm-sm.cc, libinterp/operators/op-sm-cm.cc, libinterp/operators/op-sm-cs.cc, libinterp/operators/op-sm-m.cc, libinterp/operators/op-sm-s.cc, libinterp/operators/op-sm-scm.cc, libinterp/operators/op-sm-sm.cc, libinterp/operators/op-str-m.cc, libinterp/operators/op-str-s.cc, libinterp/operators/op-str-str.cc, libinterp/operators/op-struct.cc, libinterp/operators/op-ui16-ui16.cc, libinterp/operators/op-ui32-ui32.cc, libinterp/operators/op-ui64-ui64.cc, libinterp/operators/op-ui8-ui8.cc, libinterp/operators/ops.h, libinterp/options-usage.h, libinterp/parse-tree/lex.h, libinterp/parse-tree/lex.ll, libinterp/parse-tree/oct-parse.in.yy, libinterp/parse-tree/octave.gperf, libinterp/parse-tree/parse.h, libinterp/parse-tree/pt-all.h, libinterp/parse-tree/pt-arg-list.cc, libinterp/parse-tree/pt-arg-list.h, libinterp/parse-tree/pt-array-list.cc, libinterp/parse-tree/pt-array-list.h, libinterp/parse-tree/pt-assign.cc, libinterp/parse-tree/pt-assign.h, libinterp/parse-tree/pt-binop.cc, libinterp/parse-tree/pt-binop.h, libinterp/parse-tree/pt-bp.cc, libinterp/parse-tree/pt-bp.h, libinterp/parse-tree/pt-cbinop.cc, libinterp/parse-tree/pt-cbinop.h, libinterp/parse-tree/pt-cell.cc, libinterp/parse-tree/pt-cell.h, libinterp/parse-tree/pt-check.cc, libinterp/parse-tree/pt-check.h, libinterp/parse-tree/pt-classdef.cc, libinterp/parse-tree/pt-classdef.h, libinterp/parse-tree/pt-cmd.cc, libinterp/parse-tree/pt-cmd.h, libinterp/parse-tree/pt-colon.cc, libinterp/parse-tree/pt-colon.h, libinterp/parse-tree/pt-const.cc, libinterp/parse-tree/pt-const.h, libinterp/parse-tree/pt-decl.cc, libinterp/parse-tree/pt-decl.h, libinterp/parse-tree/pt-eval.cc, libinterp/parse-tree/pt-eval.h, libinterp/parse-tree/pt-except.cc, libinterp/parse-tree/pt-except.h, libinterp/parse-tree/pt-exp.cc, libinterp/parse-tree/pt-exp.h, libinterp/parse-tree/pt-fcn-handle.cc, libinterp/parse-tree/pt-fcn-handle.h, libinterp/parse-tree/pt-funcall.cc, libinterp/parse-tree/pt-funcall.h, libinterp/parse-tree/pt-id.cc, libinterp/parse-tree/pt-id.h, libinterp/parse-tree/pt-idx.cc, libinterp/parse-tree/pt-idx.h, libinterp/parse-tree/pt-jump.cc, libinterp/parse-tree/pt-jump.h, libinterp/parse-tree/pt-loop.cc, libinterp/parse-tree/pt-loop.h, libinterp/parse-tree/pt-mat.cc, libinterp/parse-tree/pt-mat.h, libinterp/parse-tree/pt-misc.cc, libinterp/parse-tree/pt-misc.h, libinterp/parse-tree/pt-pr-code.cc, libinterp/parse-tree/pt-pr-code.h, libinterp/parse-tree/pt-select.cc, libinterp/parse-tree/pt-select.h, libinterp/parse-tree/pt-stmt.cc, libinterp/parse-tree/pt-stmt.h, libinterp/parse-tree/pt-unop.cc, libinterp/parse-tree/pt-unop.h, libinterp/parse-tree/pt-walk.h, libinterp/parse-tree/pt.cc, libinterp/parse-tree/pt.h, libinterp/parse-tree/token.cc, libinterp/parse-tree/token.h, libinterp/template-inst/Array-jit.cc, libinterp/template-inst/Array-tc.cc, libinterp/version.cc, libinterp/version.in.h, liboctave/array/Array-C.cc, liboctave/array/Array-b.cc, liboctave/array/Array-ch.cc, liboctave/array/Array-d.cc, liboctave/array/Array-f.cc, liboctave/array/Array-fC.cc, liboctave/array/Array-i.cc, liboctave/array/Array-idx-vec.cc, liboctave/array/Array-s.cc, liboctave/array/Array-str.cc, liboctave/array/Array-util.cc, liboctave/array/Array-util.h, liboctave/array/Array-voidp.cc, liboctave/array/Array.cc, liboctave/array/Array.h, liboctave/array/CColVector.cc, liboctave/array/CColVector.h, liboctave/array/CDiagMatrix.cc, liboctave/array/CDiagMatrix.h, liboctave/array/CMatrix.cc, liboctave/array/CMatrix.h, liboctave/array/CNDArray.cc, liboctave/array/CNDArray.h, liboctave/array/CRowVector.cc, liboctave/array/CRowVector.h, liboctave/array/CSparse.cc, liboctave/array/CSparse.h, liboctave/array/DiagArray2.cc, liboctave/array/DiagArray2.h, liboctave/array/MArray-C.cc, liboctave/array/MArray-d.cc, liboctave/array/MArray-f.cc, liboctave/array/MArray-fC.cc, liboctave/array/MArray-i.cc, liboctave/array/MArray-s.cc, liboctave/array/MArray.cc, liboctave/array/MArray.h, liboctave/array/MDiagArray2.cc, liboctave/array/MDiagArray2.h, liboctave/array/MSparse-C.cc, liboctave/array/MSparse-d.cc, liboctave/array/MSparse.cc, liboctave/array/MSparse.h, liboctave/array/Matrix.h, liboctave/array/MatrixType.cc, liboctave/array/MatrixType.h, liboctave/array/PermMatrix.cc, liboctave/array/PermMatrix.h, liboctave/array/Range.cc, liboctave/array/Range.h, liboctave/array/Sparse-C.cc, liboctave/array/Sparse-b.cc, liboctave/array/Sparse-d.cc, liboctave/array/Sparse.cc, liboctave/array/Sparse.h, liboctave/array/boolMatrix.cc, liboctave/array/boolMatrix.h, liboctave/array/boolNDArray.cc, liboctave/array/boolNDArray.h, liboctave/array/boolSparse.cc, liboctave/array/boolSparse.h, liboctave/array/chMatrix.cc, liboctave/array/chMatrix.h, liboctave/array/chNDArray.cc, liboctave/array/chNDArray.h, liboctave/array/dColVector.cc, liboctave/array/dColVector.h, liboctave/array/dDiagMatrix.cc, liboctave/array/dDiagMatrix.h, liboctave/array/dMatrix.cc, liboctave/array/dMatrix.h, liboctave/array/dNDArray.cc, liboctave/array/dNDArray.h, liboctave/array/dRowVector.cc, liboctave/array/dRowVector.h, liboctave/array/dSparse.cc, liboctave/array/dSparse.h, liboctave/array/dim-vector.cc, liboctave/array/dim-vector.h, liboctave/array/fCColVector.cc, liboctave/array/fCColVector.h, liboctave/array/fCDiagMatrix.cc, liboctave/array/fCDiagMatrix.h, liboctave/array/fCMatrix.cc, liboctave/array/fCMatrix.h, liboctave/array/fCNDArray.cc, liboctave/array/fCNDArray.h, liboctave/array/fCRowVector.cc, liboctave/array/fCRowVector.h, liboctave/array/fColVector.cc, liboctave/array/fColVector.h, liboctave/array/fDiagMatrix.cc, liboctave/array/fDiagMatrix.h, liboctave/array/fMatrix.cc, liboctave/array/fMatrix.h, liboctave/array/fNDArray.cc, liboctave/array/fNDArray.h, liboctave/array/fRowVector.cc, liboctave/array/fRowVector.h, liboctave/array/idx-vector.cc, liboctave/array/idx-vector.h, liboctave/array/int16NDArray.cc, liboctave/array/int16NDArray.h, liboctave/array/int32NDArray.cc, liboctave/array/int32NDArray.h, liboctave/array/int64NDArray.cc, liboctave/array/int64NDArray.h, liboctave/array/int8NDArray.cc, liboctave/array/int8NDArray.h, liboctave/array/intNDArray.cc, liboctave/array/intNDArray.h, liboctave/array/uint16NDArray.cc, liboctave/array/uint16NDArray.h, liboctave/array/uint32NDArray.cc, liboctave/array/uint32NDArray.h, liboctave/array/uint64NDArray.cc, liboctave/array/uint64NDArray.h, liboctave/array/uint8NDArray.cc, liboctave/array/uint8NDArray.h, liboctave/cruft/misc/blaswrap.c, liboctave/cruft/misc/cquit.c, liboctave/cruft/misc/f77-extern.cc, liboctave/cruft/misc/f77-fcn.c, liboctave/cruft/misc/f77-fcn.h, liboctave/cruft/misc/lo-error.c, liboctave/cruft/misc/lo-error.h, liboctave/cruft/misc/quit.cc, liboctave/cruft/misc/quit.h, liboctave/liboctave-build-info.h, liboctave/liboctave-build-info.in.cc, liboctave/numeric/CollocWt.cc, liboctave/numeric/CollocWt.h, liboctave/numeric/DAE.h, liboctave/numeric/DAEFunc.h, liboctave/numeric/DAERT.h, liboctave/numeric/DAERTFunc.h, liboctave/numeric/DASPK-opts.in, liboctave/numeric/DASPK.cc, liboctave/numeric/DASPK.h, liboctave/numeric/DASRT-opts.in, liboctave/numeric/DASRT.cc, liboctave/numeric/DASRT.h, liboctave/numeric/DASSL-opts.in, liboctave/numeric/DASSL.cc, liboctave/numeric/DASSL.h, liboctave/numeric/DET.h, liboctave/numeric/EIG.cc, liboctave/numeric/EIG.h, liboctave/numeric/LSODE-opts.in, liboctave/numeric/LSODE.cc, liboctave/numeric/LSODE.h, liboctave/numeric/ODE.h, liboctave/numeric/ODEFunc.h, liboctave/numeric/ODES.cc, liboctave/numeric/ODES.h, liboctave/numeric/ODESFunc.h, liboctave/numeric/Quad-opts.in, liboctave/numeric/Quad.cc, liboctave/numeric/Quad.h, liboctave/numeric/aepbalance.cc, liboctave/numeric/aepbalance.h, liboctave/numeric/base-dae.h, liboctave/numeric/base-de.h, liboctave/numeric/base-min.h, liboctave/numeric/bsxfun-decl.h, liboctave/numeric/bsxfun-defs.cc, liboctave/numeric/bsxfun.h, liboctave/numeric/chol.cc, liboctave/numeric/chol.h, liboctave/numeric/eigs-base.cc, liboctave/numeric/eigs-base.h, liboctave/numeric/fEIG.cc, liboctave/numeric/fEIG.h, liboctave/numeric/gepbalance.cc, liboctave/numeric/gepbalance.h, liboctave/numeric/gsvd.cc, liboctave/numeric/gsvd.h, liboctave/numeric/hess.cc, liboctave/numeric/hess.h, liboctave/numeric/lo-amos-proto.h, liboctave/numeric/lo-arpack-proto.h, liboctave/numeric/lo-blas-proto.h, liboctave/numeric/lo-fftpack-proto.h, liboctave/numeric/lo-lapack-proto.h, liboctave/numeric/lo-mappers.cc, liboctave/numeric/lo-mappers.h, liboctave/numeric/lo-qrupdate-proto.h, liboctave/numeric/lo-ranlib-proto.h, liboctave/numeric/lo-slatec-proto.h, liboctave/numeric/lo-specfun.cc, liboctave/numeric/lo-specfun.h, liboctave/numeric/lu.cc, liboctave/numeric/lu.h, liboctave/numeric/oct-convn.cc, liboctave/numeric/oct-convn.h, liboctave/numeric/oct-fftw.cc, liboctave/numeric/oct-fftw.h, liboctave/numeric/oct-norm.cc, liboctave/numeric/oct-norm.h, liboctave/numeric/oct-rand.cc, liboctave/numeric/oct-rand.h, liboctave/numeric/oct-spparms.cc, liboctave/numeric/oct-spparms.h, liboctave/numeric/qr.cc, liboctave/numeric/qr.h, liboctave/numeric/qrp.cc, liboctave/numeric/qrp.h, liboctave/numeric/randgamma.cc, liboctave/numeric/randgamma.h, liboctave/numeric/randmtzig.cc, liboctave/numeric/randmtzig.h, liboctave/numeric/randpoisson.cc, liboctave/numeric/randpoisson.h, liboctave/numeric/schur.cc, liboctave/numeric/schur.h, liboctave/numeric/sparse-chol.cc, liboctave/numeric/sparse-chol.h, liboctave/numeric/sparse-dmsolve.cc, liboctave/numeric/sparse-dmsolve.h, liboctave/numeric/sparse-lu.cc, liboctave/numeric/sparse-lu.h, liboctave/numeric/sparse-qr.cc, liboctave/numeric/sparse-qr.h, liboctave/numeric/svd.cc, liboctave/numeric/svd.h, liboctave/operators/Sparse-diag-op-defs.h, liboctave/operators/Sparse-op-decls.h, liboctave/operators/Sparse-op-defs.h, liboctave/operators/Sparse-perm-op-defs.h, liboctave/operators/mk-ops.awk, liboctave/operators/mx-base.h, liboctave/operators/mx-defs.h, liboctave/operators/mx-ext.h, liboctave/operators/mx-inlines.cc, liboctave/operators/mx-op-decl.h, liboctave/operators/mx-op-defs.h, liboctave/operators/mx-ops, liboctave/operators/smx-ops, liboctave/operators/vx-ops, liboctave/system/child-list.cc, liboctave/system/child-list.h, liboctave/system/dir-ops.cc, liboctave/system/dir-ops.h, liboctave/system/file-ops.cc, liboctave/system/file-ops.h, liboctave/system/file-stat.cc, liboctave/system/file-stat.h, liboctave/system/lo-sysdep.cc, liboctave/system/lo-sysdep.h, liboctave/system/mach-info.cc, liboctave/system/mach-info.h, liboctave/system/oct-env.cc, liboctave/system/oct-env.h, liboctave/system/oct-group.cc, liboctave/system/oct-group.h, liboctave/system/oct-passwd.cc, liboctave/system/oct-passwd.h, liboctave/system/oct-syscalls.cc, liboctave/system/oct-syscalls.h, liboctave/system/oct-time.cc, liboctave/system/oct-time.h, liboctave/system/oct-uname.cc, liboctave/system/oct-uname.h, liboctave/util/action-container.h, liboctave/util/base-list.h, liboctave/util/byte-swap.h, liboctave/util/caseless-str.h, liboctave/util/cmd-edit.cc, liboctave/util/cmd-edit.h, liboctave/util/cmd-hist.cc, liboctave/util/cmd-hist.h, liboctave/util/data-conv.cc, liboctave/util/data-conv.h, liboctave/util/f2c-main.c, liboctave/util/functor.h, liboctave/util/glob-match.cc, liboctave/util/glob-match.h, liboctave/util/kpse.cc, liboctave/util/kpse.h, liboctave/util/lo-array-errwarn.cc, liboctave/util/lo-array-errwarn.h, liboctave/util/lo-array-gripes.cc, liboctave/util/lo-array-gripes.h, liboctave/util/lo-cutils.c, liboctave/util/lo-cutils.h, liboctave/util/lo-hash.cc, liboctave/util/lo-hash.h, liboctave/util/lo-ieee.cc, liboctave/util/lo-ieee.h, liboctave/util/lo-macros.h, liboctave/util/lo-math.h, liboctave/util/lo-regexp.cc, liboctave/util/lo-regexp.h, liboctave/util/lo-traits.h, liboctave/util/lo-utils.cc, liboctave/util/lo-utils.h, liboctave/util/oct-alloc.h, liboctave/util/oct-base64.cc, liboctave/util/oct-base64.h, liboctave/util/oct-binmap.h, liboctave/util/oct-cmplx.h, liboctave/util/oct-glob.cc, liboctave/util/oct-glob.h, liboctave/util/oct-inttypes-fwd.h, liboctave/util/oct-inttypes.cc, liboctave/util/oct-inttypes.h, liboctave/util/oct-locbuf.cc, liboctave/util/oct-locbuf.h, liboctave/util/oct-mutex.cc, liboctave/util/oct-mutex.h, liboctave/util/oct-refcount.h, liboctave/util/oct-rl-edit.c, liboctave/util/oct-rl-edit.h, liboctave/util/oct-rl-hist.c, liboctave/util/oct-rl-hist.h, liboctave/util/oct-shlib.cc, liboctave/util/oct-shlib.h, liboctave/util/oct-sort.cc, liboctave/util/oct-sort.h, liboctave/util/oct-sparse.h, liboctave/util/oct-string.cc, liboctave/util/oct-string.h, liboctave/util/pathsearch.cc, liboctave/util/pathsearch.h, liboctave/util/singleton-cleanup.cc, liboctave/util/sparse-sort.cc, liboctave/util/sparse-sort.h, liboctave/util/sparse-util.cc, liboctave/util/sparse-util.h, liboctave/util/str-vec.cc, liboctave/util/str-vec.h, liboctave/util/sun-utils.h, liboctave/util/unwind-prot.cc, liboctave/util/unwind-prot.h, liboctave/util/url-transfer.cc, liboctave/util/url-transfer.h, liboctave/wrappers/areadlink-wrapper.c, liboctave/wrappers/areadlink-wrapper.h, liboctave/wrappers/async-system-wrapper.c, liboctave/wrappers/async-system-wrapper.h, liboctave/wrappers/base64-wrappers.c, liboctave/wrappers/base64-wrappers.h, liboctave/wrappers/canonicalize-file-name-wrapper.c, liboctave/wrappers/canonicalize-file-name-wrapper.h, liboctave/wrappers/dirent-wrappers.c, liboctave/wrappers/dirent-wrappers.h, liboctave/wrappers/fcntl-wrappers.c, liboctave/wrappers/fcntl-wrappers.h, liboctave/wrappers/filepos-wrappers.c, liboctave/wrappers/filepos-wrappers.h, liboctave/wrappers/fpucw-wrappers.c, liboctave/wrappers/fpucw-wrappers.h, liboctave/wrappers/gen-tempname-wrapper.c, liboctave/wrappers/gen-tempname-wrapper.h, liboctave/wrappers/getopt-wrapper.c, liboctave/wrappers/getopt-wrapper.h, liboctave/wrappers/glob-wrappers.c, liboctave/wrappers/glob-wrappers.h, liboctave/wrappers/hash-wrappers.c, liboctave/wrappers/hash-wrappers.h, liboctave/wrappers/math-wrappers.c, liboctave/wrappers/math-wrappers.h, liboctave/wrappers/mkostemp-wrapper.c, liboctave/wrappers/mkostemp-wrapper.h, liboctave/wrappers/nanosleep-wrapper.c, liboctave/wrappers/nanosleep-wrapper.h, liboctave/wrappers/nproc-wrapper.c, liboctave/wrappers/nproc-wrapper.h, liboctave/wrappers/octave-popen2.c, liboctave/wrappers/octave-popen2.h, liboctave/wrappers/putenv-wrapper.c, liboctave/wrappers/putenv-wrapper.h, liboctave/wrappers/set-program-name-wrapper.c, liboctave/wrappers/set-program-name-wrapper.h, liboctave/wrappers/signal-wrappers.c, liboctave/wrappers/signal-wrappers.h, liboctave/wrappers/stat-wrappers.c, liboctave/wrappers/stat-wrappers.h, liboctave/wrappers/strdup-wrapper.c, liboctave/wrappers/strdup-wrapper.h, liboctave/wrappers/strftime-wrapper.c, liboctave/wrappers/strftime-wrapper.h, liboctave/wrappers/strmode-wrapper.c, liboctave/wrappers/strmode-wrapper.h, liboctave/wrappers/strptime-wrapper.c, liboctave/wrappers/strptime-wrapper.h, liboctave/wrappers/time-wrappers.c, liboctave/wrappers/time-wrappers.h, liboctave/wrappers/tmpfile-wrapper.c, liboctave/wrappers/tmpfile-wrapper.h, liboctave/wrappers/uname-wrapper.c, liboctave/wrappers/uname-wrapper.h, liboctave/wrappers/unistd-wrappers.c, liboctave/wrappers/unistd-wrappers.h, liboctave/wrappers/unsetenv-wrapper.c, liboctave/wrappers/unsetenv-wrapper.h, liboctave/wrappers/vasprintf-wrapper.c, liboctave/wrappers/vasprintf-wrapper.h, liboctave/wrappers/wait-for-input.c, liboctave/wrappers/wait-for-input.h, liboctave/wrappers/wait-wrappers.c, liboctave/wrappers/wait-wrappers.h, m4/acinclude.m4, oct-conf-post.in.h, run-octave.in, scripts/@ftp/ascii.m, scripts/@ftp/binary.m, scripts/@ftp/cd.m, scripts/@ftp/close.m, scripts/@ftp/delete.m, scripts/@ftp/dir.m, scripts/@ftp/display.m, scripts/@ftp/ftp.m, scripts/@ftp/loadobj.m, scripts/@ftp/mget.m, scripts/@ftp/mkdir.m, scripts/@ftp/mput.m, scripts/@ftp/rename.m, scripts/@ftp/rmdir.m, scripts/@ftp/saveobj.m, scripts/audio/@audioplayer/__get_properties__.m, scripts/audio/@audioplayer/audioplayer.m, scripts/audio/@audioplayer/display.m, scripts/audio/@audioplayer/get.m, scripts/audio/@audioplayer/isplaying.m, scripts/audio/@audioplayer/pause.m, scripts/audio/@audioplayer/play.m, scripts/audio/@audioplayer/playblocking.m, scripts/audio/@audioplayer/resume.m, scripts/audio/@audioplayer/set.m, scripts/audio/@audioplayer/stop.m, scripts/audio/@audioplayer/subsasgn.m, scripts/audio/@audioplayer/subsref.m, scripts/audio/@audiorecorder/__get_properties__.m, scripts/audio/@audiorecorder/audiorecorder.m, scripts/audio/@audiorecorder/display.m, scripts/audio/@audiorecorder/get.m, scripts/audio/@audiorecorder/getaudiodata.m, scripts/audio/@audiorecorder/getplayer.m, scripts/audio/@audiorecorder/isrecording.m, scripts/audio/@audiorecorder/pause.m, scripts/audio/@audiorecorder/play.m, scripts/audio/@audiorecorder/record.m, scripts/audio/@audiorecorder/recordblocking.m, scripts/audio/@audiorecorder/resume.m, scripts/audio/@audiorecorder/set.m, scripts/audio/@audiorecorder/stop.m, scripts/audio/@audiorecorder/subsasgn.m, scripts/audio/@audiorecorder/subsref.m, scripts/audio/lin2mu.m, scripts/audio/mu2lin.m, scripts/audio/record.m, scripts/audio/sound.m, scripts/audio/soundsc.m, scripts/deprecated/bitmax.m, scripts/deprecated/comma.m, scripts/deprecated/isstr.m, scripts/deprecated/mahalanobis.m, scripts/deprecated/md5sum.m, scripts/deprecated/octave_config_info.m, scripts/deprecated/onenormest.m, scripts/deprecated/paren.m, scripts/deprecated/semicolon.m, scripts/deprecated/sleep.m, scripts/deprecated/usleep.m, scripts/deprecated/wavread.m, scripts/deprecated/wavwrite.m, scripts/elfun/acosd.m, scripts/elfun/acot.m, scripts/elfun/acotd.m, scripts/elfun/acoth.m, scripts/elfun/acsc.m, scripts/elfun/acscd.m, scripts/elfun/acsch.m, scripts/elfun/asec.m, scripts/elfun/asecd.m, scripts/elfun/asech.m, scripts/elfun/asind.m, scripts/elfun/atan2d.m, scripts/elfun/atand.m, scripts/elfun/cosd.m, scripts/elfun/cot.m, scripts/elfun/cotd.m, scripts/elfun/coth.m, scripts/elfun/csc.m, scripts/elfun/cscd.m, scripts/elfun/csch.m, scripts/elfun/sec.m, scripts/elfun/secd.m, scripts/elfun/sech.m, scripts/elfun/sind.m, scripts/elfun/tand.m, scripts/general/accumarray.m, scripts/general/accumdim.m, scripts/general/bincoeff.m, scripts/general/bitcmp.m, scripts/general/bitget.m, scripts/general/bitset.m, scripts/general/blkdiag.m, scripts/general/cart2pol.m, scripts/general/cart2sph.m, scripts/general/cell2mat.m, scripts/general/celldisp.m, scripts/general/chop.m, scripts/general/circshift.m, scripts/general/common_size.m, scripts/general/cplxpair.m, scripts/general/cumtrapz.m, scripts/general/curl.m, scripts/general/dblquad.m, scripts/general/deal.m, scripts/general/deg2rad.m, scripts/general/del2.m, scripts/general/display.m, scripts/general/divergence.m, scripts/general/fieldnames.m, scripts/general/flip.m, scripts/general/flipdim.m, scripts/general/fliplr.m, scripts/general/flipud.m, scripts/general/grabcode.m, scripts/general/gradient.m, scripts/general/idivide.m, scripts/general/inputParser.m, scripts/general/int2str.m, scripts/general/interp1.m, scripts/general/interp2.m, scripts/general/interp3.m, scripts/general/interpft.m, scripts/general/interpn.m, scripts/general/isdir.m, scripts/general/isequal.m, scripts/general/isequaln.m, scripts/general/loadobj.m, scripts/general/logspace.m, scripts/general/methods.m, scripts/general/nargchk.m, scripts/general/narginchk.m, scripts/general/nargoutchk.m, scripts/general/nextpow2.m, scripts/general/nthargout.m, scripts/general/num2str.m, scripts/general/pol2cart.m, scripts/general/polyarea.m, scripts/general/postpad.m, scripts/general/prepad.m, scripts/general/private/__isequal__.m, scripts/general/private/__splinen__.m, scripts/general/publish.m, scripts/general/quadgk.m, scripts/general/quadl.m, scripts/general/quadv.m, scripts/general/rad2deg.m, scripts/general/randi.m, scripts/general/rat.m, scripts/general/repmat.m, scripts/general/rot90.m, scripts/general/rotdim.m, scripts/general/saveobj.m, scripts/general/shift.m, scripts/general/shiftdim.m, scripts/general/sortrows.m, scripts/general/sph2cart.m, scripts/general/structfun.m, scripts/general/subsindex.m, scripts/general/trapz.m, scripts/general/triplequad.m, scripts/general/validateattributes.m, scripts/geometry/convhull.m, scripts/geometry/delaunay.m, scripts/geometry/delaunayn.m, scripts/geometry/dsearch.m, scripts/geometry/dsearchn.m, scripts/geometry/griddata.m, scripts/geometry/griddata3.m, scripts/geometry/griddatan.m, scripts/geometry/inpolygon.m, scripts/geometry/rectint.m, scripts/geometry/tsearchn.m, scripts/geometry/voronoi.m, scripts/geometry/voronoin.m, scripts/gui/dialog.m, scripts/gui/errordlg.m, scripts/gui/guidata.m, scripts/gui/guihandles.m, scripts/gui/helpdlg.m, scripts/gui/inputdlg.m, scripts/gui/listdlg.m, scripts/gui/msgbox.m, scripts/gui/private/__file_filter__.m, scripts/gui/private/__fltk_file_filter__.m, scripts/gui/private/__get_funcname__.m, scripts/gui/private/__is_function__.m, scripts/gui/private/__uigetdir_fltk__.m, scripts/gui/private/__uigetfile_fltk__.m, scripts/gui/private/__uiobject_split_args__.m, scripts/gui/private/__uiputfile_fltk__.m, scripts/gui/questdlg.m, scripts/gui/uibuttongroup.m, scripts/gui/uicontextmenu.m, scripts/gui/uicontrol.m, scripts/gui/uigetdir.m, scripts/gui/uigetfile.m, scripts/gui/uimenu.m, scripts/gui/uipanel.m, scripts/gui/uipushtool.m, scripts/gui/uiputfile.m, scripts/gui/uiresume.m, scripts/gui/uitoggletool.m, scripts/gui/uitoolbar.m, scripts/gui/uiwait.m, scripts/gui/waitbar.m, scripts/gui/waitforbuttonpress.m, scripts/gui/warndlg.m, scripts/help/__gripe_missing_component__.m, scripts/help/__makeinfo__.m, scripts/help/__unimplemented__.m, scripts/help/ans.m, scripts/help/doc.m, scripts/help/doc_cache_create.m, scripts/help/error_ids.m, scripts/help/get_first_help_sentence.m, scripts/help/help.m, scripts/help/lookfor.m, scripts/help/print_usage.m, scripts/help/private/__additional_help_message__.m, scripts/help/private/__strip_html_tags__.m, scripts/help/type.m, scripts/help/warning_ids.m, scripts/help/which.m, scripts/image/autumn.m, scripts/image/bone.m, scripts/image/brighten.m, scripts/image/cmpermute.m, scripts/image/cmunique.m, scripts/image/colorcube.m, scripts/image/colormap.m, scripts/image/contrast.m, scripts/image/cool.m, scripts/image/copper.m, scripts/image/cubehelix.m, scripts/image/flag.m, scripts/image/gray.m, scripts/image/gray2ind.m, scripts/image/hot.m, scripts/image/hsv.m, scripts/image/hsv2rgb.m, scripts/image/im2double.m, scripts/image/image.m, scripts/image/imagesc.m, scripts/image/imfinfo.m, scripts/image/imformats.m, scripts/image/imread.m, scripts/image/imshow.m, scripts/image/imwrite.m, scripts/image/ind2gray.m, scripts/image/ind2rgb.m, scripts/image/iscolormap.m, scripts/image/jet.m, scripts/image/lines.m, scripts/image/ntsc2rgb.m, scripts/image/ocean.m, scripts/image/pink.m, scripts/image/prism.m, scripts/image/private/__imfinfo__.m, scripts/image/private/__imread__.m, scripts/image/private/__imwrite__.m, scripts/image/private/colorspace_conversion_input_check.m, scripts/image/private/colorspace_conversion_revert.m, scripts/image/private/imageIO.m, scripts/image/private/imwrite_filename.m, scripts/image/private/ind2x.m, scripts/image/rainbow.m, scripts/image/rgb2hsv.m, scripts/image/rgb2ind.m, scripts/image/rgb2ntsc.m, scripts/image/rgbplot.m, scripts/image/spinmap.m, scripts/image/spring.m, scripts/image/summer.m, scripts/image/viridis.m, scripts/image/white.m, scripts/image/winter.m, scripts/io/beep.m, scripts/io/csvread.m, scripts/io/csvwrite.m, scripts/io/dlmwrite.m, scripts/io/fileread.m, scripts/io/importdata.m, scripts/io/is_valid_file_id.m, scripts/io/strread.m, scripts/io/textread.m, scripts/java/javaArray.m, scripts/java/java_get.m, scripts/java/java_set.m, scripts/java/javaaddpath.m, scripts/java/javachk.m, scripts/java/javaclasspath.m, scripts/java/javamem.m, scripts/java/javarmpath.m, scripts/java/org/octave/ClassHelper.java, scripts/java/org/octave/Matrix.java, scripts/java/org/octave/OctClassLoader.java, scripts/java/org/octave/Octave.java, scripts/java/org/octave/OctaveReference.java, scripts/java/usejava.m, scripts/linear-algebra/bandwidth.m, scripts/linear-algebra/commutation_matrix.m, scripts/linear-algebra/cond.m, scripts/linear-algebra/condeig.m, scripts/linear-algebra/condest.m, scripts/linear-algebra/cross.m, scripts/linear-algebra/duplication_matrix.m, scripts/linear-algebra/expm.m, scripts/linear-algebra/housh.m, scripts/linear-algebra/isbanded.m, scripts/linear-algebra/isdefinite.m, scripts/linear-algebra/isdiag.m, scripts/linear-algebra/ishermitian.m, scripts/linear-algebra/issymmetric.m, scripts/linear-algebra/istril.m, scripts/linear-algebra/istriu.m, scripts/linear-algebra/krylov.m, scripts/linear-algebra/linsolve.m, scripts/linear-algebra/logm.m, scripts/linear-algebra/normest.m, scripts/linear-algebra/normest1.m, scripts/linear-algebra/null.m, scripts/linear-algebra/orth.m, scripts/linear-algebra/planerot.m, scripts/linear-algebra/qzhess.m, scripts/linear-algebra/rank.m, scripts/linear-algebra/rref.m, scripts/linear-algebra/subspace.m, scripts/linear-algebra/trace.m, scripts/linear-algebra/vech.m, scripts/miscellaneous/bug_report.m, scripts/miscellaneous/bunzip2.m, scripts/miscellaneous/cast.m, scripts/miscellaneous/citation.m, scripts/miscellaneous/compare_versions.m, scripts/miscellaneous/computer.m, scripts/miscellaneous/copyfile.m, scripts/miscellaneous/debug.m, scripts/miscellaneous/delete.m, scripts/miscellaneous/desktop.m, scripts/miscellaneous/dir.m, scripts/miscellaneous/dos.m, scripts/miscellaneous/edit.m, scripts/miscellaneous/fact.m, scripts/miscellaneous/fileattrib.m, scripts/miscellaneous/fileparts.m, scripts/miscellaneous/fullfile.m, scripts/miscellaneous/genvarname.m, scripts/miscellaneous/getappdata.m, scripts/miscellaneous/getfield.m, scripts/miscellaneous/gunzip.m, scripts/miscellaneous/info.m, scripts/miscellaneous/inputname.m, scripts/miscellaneous/isappdata.m, scripts/miscellaneous/isdeployed.m, scripts/miscellaneous/ismac.m, scripts/miscellaneous/ispc.m, scripts/miscellaneous/isunix.m, scripts/miscellaneous/license.m, scripts/miscellaneous/list_primes.m, scripts/miscellaneous/ls.m, scripts/miscellaneous/ls_command.m, scripts/miscellaneous/menu.m, scripts/miscellaneous/mex.m, scripts/miscellaneous/mexext.m, scripts/miscellaneous/mkdir.m, scripts/miscellaneous/mkoctfile.m, scripts/miscellaneous/movefile.m, scripts/miscellaneous/namelengthmax.m, scripts/miscellaneous/news.m, scripts/miscellaneous/open.m, scripts/miscellaneous/orderfields.m, scripts/miscellaneous/pack.m, scripts/miscellaneous/parseparams.m, scripts/miscellaneous/perl.m, scripts/miscellaneous/private/__w2mpth__.m, scripts/miscellaneous/private/display_info_file.m, scripts/miscellaneous/python.m, scripts/miscellaneous/recycle.m, scripts/miscellaneous/rmappdata.m, scripts/miscellaneous/run.m, scripts/miscellaneous/setappdata.m, scripts/miscellaneous/setfield.m, scripts/miscellaneous/substruct.m, scripts/miscellaneous/swapbytes.m, scripts/miscellaneous/symvar.m, scripts/miscellaneous/tar.m, scripts/miscellaneous/tempdir.m, scripts/miscellaneous/tmpnam.m, scripts/miscellaneous/unix.m, scripts/miscellaneous/unpack.m, scripts/miscellaneous/untar.m, scripts/miscellaneous/unzip.m, scripts/miscellaneous/ver.m, scripts/miscellaneous/version.m, scripts/miscellaneous/what.m, scripts/miscellaneous/xor.m, scripts/miscellaneous/zip.m, scripts/mk-pkg-add, scripts/mkdoc.pl, scripts/ode/ode23.m, scripts/ode/ode45.m, scripts/ode/odeget.m, scripts/ode/odeplot.m, scripts/ode/odeset.m, scripts/ode/private/AbsRel_norm.m, scripts/ode/private/integrate_adaptive.m, scripts/ode/private/kahan.m, scripts/ode/private/ode_event_handler.m, scripts/ode/private/odedefaults.m, scripts/ode/private/odemergeopts.m, scripts/ode/private/runge_kutta_23.m, scripts/ode/private/runge_kutta_45_dorpri.m, scripts/ode/private/runge_kutta_interpolate.m, scripts/ode/private/starting_stepsize.m, scripts/optimization/__all_opts__.m, scripts/optimization/fminbnd.m, scripts/optimization/fminsearch.m, scripts/optimization/fminunc.m, scripts/optimization/fsolve.m, scripts/optimization/fzero.m, scripts/optimization/glpk.m, scripts/optimization/lsqnonneg.m, scripts/optimization/optimget.m, scripts/optimization/optimset.m, scripts/optimization/pqpnonneg.m, scripts/optimization/private/__fdjac__.m, scripts/optimization/qp.m, scripts/optimization/sqp.m, scripts/path/matlabroot.m, scripts/path/pathdef.m, scripts/path/private/getsavepath.m, scripts/path/savepath.m, scripts/pkg/pkg.m, scripts/pkg/private/build.m, scripts/pkg/private/configure_make.m, scripts/pkg/private/default_prefix.m, scripts/pkg/private/describe.m, scripts/pkg/private/dirempty.m, scripts/pkg/private/get_description.m, scripts/pkg/private/get_forge_download.m, scripts/pkg/private/get_forge_pkg.m, scripts/pkg/private/get_unsatisfied_deps.m, scripts/pkg/private/getarch.m, scripts/pkg/private/getarchdir.m, scripts/pkg/private/install.m, scripts/pkg/private/installed_packages.m, scripts/pkg/private/list_forge_packages.m, scripts/pkg/private/load_packages.m, scripts/pkg/private/load_packages_and_dependencies.m, scripts/pkg/private/rebuild.m, scripts/pkg/private/save_order.m, scripts/pkg/private/uninstall.m, scripts/pkg/private/unload_packages.m, scripts/plot/appearance/__clabel__.m, scripts/plot/appearance/__getlegenddata__.m, scripts/plot/appearance/annotation.m, scripts/plot/appearance/axis.m, scripts/plot/appearance/box.m, scripts/plot/appearance/caxis.m, scripts/plot/appearance/clabel.m, scripts/plot/appearance/daspect.m, scripts/plot/appearance/datetick.m, scripts/plot/appearance/diffuse.m, scripts/plot/appearance/grid.m, scripts/plot/appearance/gtext.m, scripts/plot/appearance/hidden.m, scripts/plot/appearance/legend.m, scripts/plot/appearance/lighting.m, scripts/plot/appearance/material.m, scripts/plot/appearance/orient.m, scripts/plot/appearance/pbaspect.m, scripts/plot/appearance/private/__axis_label__.m, scripts/plot/appearance/private/__axis_limits__.m, scripts/plot/appearance/shading.m, scripts/plot/appearance/specular.m, scripts/plot/appearance/text.m, scripts/plot/appearance/title.m, scripts/plot/appearance/view.m, scripts/plot/appearance/whitebg.m, scripts/plot/appearance/xlabel.m, scripts/plot/appearance/xlim.m, scripts/plot/appearance/ylabel.m, scripts/plot/appearance/ylim.m, scripts/plot/appearance/zlabel.m, scripts/plot/appearance/zlim.m, scripts/plot/draw/area.m, scripts/plot/draw/bar.m, scripts/plot/draw/barh.m, scripts/plot/draw/camlight.m, scripts/plot/draw/colorbar.m, scripts/plot/draw/comet.m, scripts/plot/draw/comet3.m, scripts/plot/draw/compass.m, scripts/plot/draw/contour.m, scripts/plot/draw/contour3.m, scripts/plot/draw/contourc.m, scripts/plot/draw/contourf.m, scripts/plot/draw/cylinder.m, scripts/plot/draw/ellipsoid.m, scripts/plot/draw/errorbar.m, scripts/plot/draw/ezcontour.m, scripts/plot/draw/ezcontourf.m, scripts/plot/draw/ezmesh.m, scripts/plot/draw/ezmeshc.m, scripts/plot/draw/ezplot.m, scripts/plot/draw/ezplot3.m, scripts/plot/draw/ezpolar.m, scripts/plot/draw/ezsurf.m, scripts/plot/draw/ezsurfc.m, scripts/plot/draw/feather.m, scripts/plot/draw/fill.m, scripts/plot/draw/fplot.m, scripts/plot/draw/hist.m, scripts/plot/draw/isocaps.m, scripts/plot/draw/isocolors.m, scripts/plot/draw/isonormals.m, scripts/plot/draw/isosurface.m, scripts/plot/draw/light.m, scripts/plot/draw/line.m, scripts/plot/draw/loglog.m, scripts/plot/draw/loglogerr.m, scripts/plot/draw/mesh.m, scripts/plot/draw/meshc.m, scripts/plot/draw/meshz.m, scripts/plot/draw/pareto.m, scripts/plot/draw/patch.m, scripts/plot/draw/pcolor.m, scripts/plot/draw/peaks.m, scripts/plot/draw/pie.m, scripts/plot/draw/pie3.m, scripts/plot/draw/plot.m, scripts/plot/draw/plot3.m, scripts/plot/draw/plotmatrix.m, scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m, scripts/plot/draw/private/__add_datasource__.m, scripts/plot/draw/private/__bar__.m, scripts/plot/draw/private/__calc_isovalue_from_data__.m, scripts/plot/draw/private/__contour__.m, scripts/plot/draw/private/__errplot__.m, scripts/plot/draw/private/__ezplot__.m, scripts/plot/draw/private/__interp_cube__.m, scripts/plot/draw/private/__line__.m, scripts/plot/draw/private/__marching_cube__.m, scripts/plot/draw/private/__patch__.m, scripts/plot/draw/private/__pie__.m, scripts/plot/draw/private/__plt__.m, scripts/plot/draw/private/__quiver__.m, scripts/plot/draw/private/__rotate_around_axis__.m, scripts/plot/draw/private/__scatter__.m, scripts/plot/draw/private/__stem__.m, scripts/plot/draw/private/__unite_shared_vertices__.m, scripts/plot/draw/quiver.m, scripts/plot/draw/quiver3.m, scripts/plot/draw/rectangle.m, scripts/plot/draw/reducepatch.m, scripts/plot/draw/reducevolume.m, scripts/plot/draw/ribbon.m, scripts/plot/draw/rose.m, scripts/plot/draw/scatter.m, scripts/plot/draw/scatter3.m, scripts/plot/draw/semilogx.m, scripts/plot/draw/semilogxerr.m, scripts/plot/draw/semilogy.m, scripts/plot/draw/semilogyerr.m, scripts/plot/draw/shrinkfaces.m, scripts/plot/draw/slice.m, scripts/plot/draw/smooth3.m, scripts/plot/draw/sombrero.m, scripts/plot/draw/sphere.m, scripts/plot/draw/stairs.m, scripts/plot/draw/stem.m, scripts/plot/draw/stem3.m, scripts/plot/draw/stemleaf.m, scripts/plot/draw/surf.m, scripts/plot/draw/surface.m, scripts/plot/draw/surfc.m, scripts/plot/draw/surfl.m, scripts/plot/draw/surfnorm.m, scripts/plot/draw/tetramesh.m, scripts/plot/draw/trimesh.m, scripts/plot/draw/triplot.m, scripts/plot/draw/trisurf.m, scripts/plot/draw/waterfall.m, scripts/plot/util/__actual_axis_position__.m, scripts/plot/util/__default_plot_options__.m, scripts/plot/util/__gnuplot_drawnow__.m, scripts/plot/util/__next_line_color__.m, scripts/plot/util/__next_line_style__.m, scripts/plot/util/__opengl_info__.m, scripts/plot/util/__plt_get_axis_arg__.m, scripts/plot/util/__pltopt__.m, scripts/plot/util/allchild.m, scripts/plot/util/ancestor.m, scripts/plot/util/axes.m, scripts/plot/util/cla.m, scripts/plot/util/clf.m, scripts/plot/util/close.m, scripts/plot/util/closereq.m, scripts/plot/util/colstyle.m, scripts/plot/util/copyobj.m, scripts/plot/util/figure.m, scripts/plot/util/findall.m, scripts/plot/util/findfigs.m, scripts/plot/util/findobj.m, scripts/plot/util/frame2im.m, scripts/plot/util/gca.m, scripts/plot/util/gcbf.m, scripts/plot/util/gcbo.m, scripts/plot/util/gcf.m, scripts/plot/util/gco.m, scripts/plot/util/ginput.m, scripts/plot/util/gnuplot_binary.in.m, scripts/plot/util/graphics_toolkit.m, scripts/plot/util/hdl2struct.m, scripts/plot/util/hggroup.m, scripts/plot/util/hgload.m, scripts/plot/util/hgsave.m, scripts/plot/util/hold.m, scripts/plot/util/im2frame.m, scripts/plot/util/isaxes.m, scripts/plot/util/isfigure.m, scripts/plot/util/ishghandle.m, scripts/plot/util/ishold.m, scripts/plot/util/isprop.m, scripts/plot/util/linkaxes.m, scripts/plot/util/linkprop.m, scripts/plot/util/meshgrid.m, scripts/plot/util/ndgrid.m, scripts/plot/util/newplot.m, scripts/plot/util/pan.m, scripts/plot/util/print.m, scripts/plot/util/printd.m, scripts/plot/util/private/__add_default_menu__.m, scripts/plot/util/private/__ghostscript__.m, scripts/plot/util/private/__gnuplot_draw_axes__.m, scripts/plot/util/private/__gnuplot_draw_figure__.m, scripts/plot/util/private/__gnuplot_get_var__.m, scripts/plot/util/private/__gnuplot_ginput__.m, scripts/plot/util/private/__gnuplot_has_feature__.m, scripts/plot/util/private/__gnuplot_has_terminal__.m, scripts/plot/util/private/__gnuplot_open_stream__.m, scripts/plot/util/private/__gnuplot_print__.m, scripts/plot/util/private/__gnuplot_version__.m, scripts/plot/util/private/__opengl_print__.m, scripts/plot/util/private/__print_parse_opts__.m, scripts/plot/util/refresh.m, scripts/plot/util/refreshdata.m, scripts/plot/util/rotate.m, scripts/plot/util/rotate3d.m, scripts/plot/util/saveas.m, scripts/plot/util/shg.m, scripts/plot/util/struct2hdl.m, scripts/plot/util/subplot.m, scripts/plot/util/zoom.m, scripts/polynomial/compan.m, scripts/polynomial/conv.m, scripts/polynomial/deconv.m, scripts/polynomial/mkpp.m, scripts/polynomial/mpoles.m, scripts/polynomial/padecoef.m, scripts/polynomial/pchip.m, scripts/polynomial/poly.m, scripts/polynomial/polyaffine.m, scripts/polynomial/polyder.m, scripts/polynomial/polyeig.m, scripts/polynomial/polyfit.m, scripts/polynomial/polygcd.m, scripts/polynomial/polyint.m, scripts/polynomial/polyout.m, scripts/polynomial/polyreduce.m, scripts/polynomial/polyval.m, scripts/polynomial/polyvalm.m, scripts/polynomial/ppder.m, scripts/polynomial/ppint.m, scripts/polynomial/ppjumps.m, scripts/polynomial/ppval.m, scripts/polynomial/residue.m, scripts/polynomial/roots.m, scripts/polynomial/spline.m, scripts/polynomial/splinefit.m, scripts/polynomial/unmkpp.m, scripts/prefs/addpref.m, scripts/prefs/getpref.m, scripts/prefs/ispref.m, scripts/prefs/prefdir.m, scripts/prefs/preferences.m, scripts/prefs/private/loadprefs.m, scripts/prefs/private/prefsfile.m, scripts/prefs/private/saveprefs.m, scripts/prefs/rmpref.m, scripts/prefs/setpref.m, scripts/profiler/html/style.css, scripts/profiler/profexplore.m, scripts/profiler/profexport.m, scripts/profiler/profile.m, scripts/profiler/profshow.m, scripts/set/intersect.m, scripts/set/ismember.m, scripts/set/powerset.m, scripts/set/private/validsetargs.m, scripts/set/setdiff.m, scripts/set/setxor.m, scripts/set/union.m, scripts/set/unique.m, scripts/signal/arch_fit.m, scripts/signal/arch_rnd.m, scripts/signal/arch_test.m, scripts/signal/arma_rnd.m, scripts/signal/autoreg_matrix.m, scripts/signal/bartlett.m, scripts/signal/blackman.m, scripts/signal/detrend.m, scripts/signal/diffpara.m, scripts/signal/durbinlevinson.m, scripts/signal/fftconv.m, scripts/signal/fftfilt.m, scripts/signal/fftshift.m, scripts/signal/filter2.m, scripts/signal/fractdiff.m, scripts/signal/freqz.m, scripts/signal/freqz_plot.m, scripts/signal/hamming.m, scripts/signal/hanning.m, scripts/signal/hurst.m, scripts/signal/ifftshift.m, scripts/signal/periodogram.m, scripts/signal/private/rectangle_lw.m, scripts/signal/private/rectangle_sw.m, scripts/signal/private/triangle_lw.m, scripts/signal/private/triangle_sw.m, scripts/signal/sinc.m, scripts/signal/sinetone.m, scripts/signal/sinewave.m, scripts/signal/spectral_adf.m, scripts/signal/spectral_xdf.m, scripts/signal/spencer.m, scripts/signal/stft.m, scripts/signal/synthesis.m, scripts/signal/unwrap.m, scripts/signal/yulewalker.m, scripts/sparse/bicg.m, scripts/sparse/bicgstab.m, scripts/sparse/cgs.m, scripts/sparse/colperm.m, scripts/sparse/eigs.m, scripts/sparse/etreeplot.m, scripts/sparse/gmres.m, scripts/sparse/gplot.m, scripts/sparse/ichol.m, scripts/sparse/ilu.m, scripts/sparse/nonzeros.m, scripts/sparse/pcg.m, scripts/sparse/pcr.m, scripts/sparse/private/__sprand__.m, scripts/sparse/qmr.m, scripts/sparse/spaugment.m, scripts/sparse/spconvert.m, scripts/sparse/spdiags.m, scripts/sparse/speye.m, scripts/sparse/spfun.m, scripts/sparse/spones.m, scripts/sparse/sprand.m, scripts/sparse/sprandn.m, scripts/sparse/sprandsym.m, scripts/sparse/spstats.m, scripts/sparse/spy.m, scripts/sparse/svds.m, scripts/sparse/treelayout.m, scripts/sparse/treeplot.m, scripts/specfun/bessel.m, scripts/specfun/beta.m, scripts/specfun/betaln.m, scripts/specfun/ellipke.m, scripts/specfun/expint.m, scripts/specfun/factor.m, scripts/specfun/factorial.m, scripts/specfun/isprime.m, scripts/specfun/lcm.m, scripts/specfun/legendre.m, scripts/specfun/nchoosek.m, scripts/specfun/nthroot.m, scripts/specfun/perms.m, scripts/specfun/pow2.m, scripts/specfun/primes.m, scripts/specfun/reallog.m, scripts/specfun/realpow.m, scripts/specfun/realsqrt.m, scripts/special-matrix/gallery.m, scripts/special-matrix/hadamard.m, scripts/special-matrix/hankel.m, scripts/special-matrix/hilb.m, scripts/special-matrix/invhilb.m, scripts/special-matrix/magic.m, scripts/special-matrix/pascal.m, scripts/special-matrix/rosser.m, scripts/special-matrix/toeplitz.m, scripts/special-matrix/vander.m, scripts/special-matrix/wilkinson.m, scripts/startup/__finish__.m, scripts/statistics/base/center.m, scripts/statistics/base/cloglog.m, scripts/statistics/base/corr.m, scripts/statistics/base/cov.m, scripts/statistics/base/gls.m, scripts/statistics/base/histc.m, scripts/statistics/base/iqr.m, scripts/statistics/base/kendall.m, scripts/statistics/base/kurtosis.m, scripts/statistics/base/logit.m, scripts/statistics/base/lscov.m, scripts/statistics/base/mean.m, scripts/statistics/base/meansq.m, scripts/statistics/base/median.m, scripts/statistics/base/mode.m, scripts/statistics/base/moment.m, scripts/statistics/base/ols.m, scripts/statistics/base/ppplot.m, scripts/statistics/base/prctile.m, scripts/statistics/base/probit.m, scripts/statistics/base/qqplot.m, scripts/statistics/base/quantile.m, scripts/statistics/base/range.m, scripts/statistics/base/ranks.m, scripts/statistics/base/run_count.m, scripts/statistics/base/runlength.m, scripts/statistics/base/skewness.m, scripts/statistics/base/spearman.m, scripts/statistics/base/statistics.m, scripts/statistics/base/std.m, scripts/statistics/base/table.m, scripts/statistics/base/var.m, scripts/statistics/base/zscore.m, scripts/statistics/distributions/betacdf.m, scripts/statistics/distributions/betainv.m, scripts/statistics/distributions/betapdf.m, scripts/statistics/distributions/betarnd.m, scripts/statistics/distributions/binocdf.m, scripts/statistics/distributions/binoinv.m, scripts/statistics/distributions/binopdf.m, scripts/statistics/distributions/binornd.m, scripts/statistics/distributions/cauchy_cdf.m, scripts/statistics/distributions/cauchy_inv.m, scripts/statistics/distributions/cauchy_pdf.m, scripts/statistics/distributions/cauchy_rnd.m, scripts/statistics/distributions/chi2cdf.m, scripts/statistics/distributions/chi2inv.m, scripts/statistics/distributions/chi2pdf.m, scripts/statistics/distributions/chi2rnd.m, scripts/statistics/distributions/discrete_cdf.m, scripts/statistics/distributions/discrete_inv.m, scripts/statistics/distributions/discrete_pdf.m, scripts/statistics/distributions/discrete_rnd.m, scripts/statistics/distributions/empirical_cdf.m, scripts/statistics/distributions/empirical_inv.m, scripts/statistics/distributions/empirical_pdf.m, scripts/statistics/distributions/empirical_rnd.m, scripts/statistics/distributions/expcdf.m, scripts/statistics/distributions/expinv.m, scripts/statistics/distributions/exppdf.m, scripts/statistics/distributions/exprnd.m, scripts/statistics/distributions/fcdf.m, scripts/statistics/distributions/finv.m, scripts/statistics/distributions/fpdf.m, scripts/statistics/distributions/frnd.m, scripts/statistics/distributions/gamcdf.m, scripts/statistics/distributions/gaminv.m, scripts/statistics/distributions/gampdf.m, scripts/statistics/distributions/gamrnd.m, scripts/statistics/distributions/geocdf.m, scripts/statistics/distributions/geoinv.m, scripts/statistics/distributions/geopdf.m, scripts/statistics/distributions/geornd.m, scripts/statistics/distributions/hygecdf.m, scripts/statistics/distributions/hygeinv.m, scripts/statistics/distributions/hygepdf.m, scripts/statistics/distributions/hygernd.m, scripts/statistics/distributions/kolmogorov_smirnov_cdf.m, scripts/statistics/distributions/laplace_cdf.m, scripts/statistics/distributions/laplace_inv.m, scripts/statistics/distributions/laplace_pdf.m, scripts/statistics/distributions/laplace_rnd.m, scripts/statistics/distributions/logistic_cdf.m, scripts/statistics/distributions/logistic_inv.m, scripts/statistics/distributions/logistic_pdf.m, scripts/statistics/distributions/logistic_rnd.m, scripts/statistics/distributions/logncdf.m, scripts/statistics/distributions/logninv.m, scripts/statistics/distributions/lognpdf.m, scripts/statistics/distributions/lognrnd.m, scripts/statistics/distributions/nbincdf.m, scripts/statistics/distributions/nbininv.m, scripts/statistics/distributions/nbinpdf.m, scripts/statistics/distributions/nbinrnd.m, scripts/statistics/distributions/normcdf.m, scripts/statistics/distributions/norminv.m, scripts/statistics/distributions/normpdf.m, scripts/statistics/distributions/normrnd.m, scripts/statistics/distributions/poisscdf.m, scripts/statistics/distributions/poissinv.m, scripts/statistics/distributions/poisspdf.m, scripts/statistics/distributions/poissrnd.m, scripts/statistics/distributions/stdnormal_cdf.m, scripts/statistics/distributions/stdnormal_inv.m, scripts/statistics/distributions/stdnormal_pdf.m, scripts/statistics/distributions/stdnormal_rnd.m, scripts/statistics/distributions/tcdf.m, scripts/statistics/distributions/tinv.m, scripts/statistics/distributions/tpdf.m, scripts/statistics/distributions/trnd.m, scripts/statistics/distributions/unidcdf.m, scripts/statistics/distributions/unidinv.m, scripts/statistics/distributions/unidpdf.m, scripts/statistics/distributions/unidrnd.m, scripts/statistics/distributions/unifcdf.m, scripts/statistics/distributions/unifinv.m, scripts/statistics/distributions/unifpdf.m, scripts/statistics/distributions/unifrnd.m, scripts/statistics/distributions/wblcdf.m, scripts/statistics/distributions/wblinv.m, scripts/statistics/distributions/wblpdf.m, scripts/statistics/distributions/wblrnd.m, scripts/statistics/distributions/wienrnd.m, scripts/statistics/models/logistic_regression.m, scripts/statistics/models/private/logistic_regression_derivatives.m, scripts/statistics/models/private/logistic_regression_likelihood.m, scripts/statistics/tests/anova.m, scripts/statistics/tests/bartlett_test.m, scripts/statistics/tests/chisquare_test_homogeneity.m, scripts/statistics/tests/chisquare_test_independence.m, scripts/statistics/tests/cor_test.m, scripts/statistics/tests/f_test_regression.m, scripts/statistics/tests/hotelling_test.m, scripts/statistics/tests/hotelling_test_2.m, scripts/statistics/tests/kolmogorov_smirnov_test.m, scripts/statistics/tests/kolmogorov_smirnov_test_2.m, scripts/statistics/tests/kruskal_wallis_test.m, scripts/statistics/tests/manova.m, scripts/statistics/tests/mcnemar_test.m, scripts/statistics/tests/prop_test_2.m, scripts/statistics/tests/run_test.m, scripts/statistics/tests/sign_test.m, scripts/statistics/tests/t_test.m, scripts/statistics/tests/t_test_2.m, scripts/statistics/tests/t_test_regression.m, scripts/statistics/tests/u_test.m, scripts/statistics/tests/var_test.m, scripts/statistics/tests/welch_test.m, scripts/statistics/tests/wilcoxon_test.m, scripts/statistics/tests/z_test.m, scripts/statistics/tests/z_test_2.m, scripts/strings/base2dec.m, scripts/strings/bin2dec.m, scripts/strings/blanks.m, scripts/strings/cstrcat.m, scripts/strings/deblank.m, scripts/strings/dec2base.m, scripts/strings/dec2bin.m, scripts/strings/dec2hex.m, scripts/strings/findstr.m, scripts/strings/hex2dec.m, scripts/strings/index.m, scripts/strings/isletter.m, scripts/strings/isstrprop.m, scripts/strings/mat2str.m, scripts/strings/ostrsplit.m, scripts/strings/regexptranslate.m, scripts/strings/rindex.m, scripts/strings/str2num.m, scripts/strings/strcat.m, scripts/strings/strchr.m, scripts/strings/strjoin.m, scripts/strings/strjust.m, scripts/strings/strmatch.m, scripts/strings/strsplit.m, scripts/strings/strtok.m, scripts/strings/strtrim.m, scripts/strings/strtrunc.m, scripts/strings/substr.m, scripts/strings/untabify.m, scripts/strings/validatestring.m, scripts/testfun/__have_feature__.m, scripts/testfun/__printf_assert__.m, scripts/testfun/__prog_output_assert__.m, scripts/testfun/__run_test_suite__.m, scripts/testfun/assert.m, scripts/testfun/demo.m, scripts/testfun/example.m, scripts/testfun/fail.m, scripts/testfun/private/compare_plot_demos.m, scripts/testfun/private/dump_demos.m, scripts/testfun/private/html_compare_plot_demos.m, scripts/testfun/rundemos.m, scripts/testfun/runtests.m, scripts/testfun/speed.m, scripts/testfun/test.m, scripts/time/addtodate.m, scripts/time/asctime.m, scripts/time/calendar.m, scripts/time/clock.m, scripts/time/ctime.m, scripts/time/date.m, scripts/time/datenum.m, scripts/time/datestr.m, scripts/time/datevec.m, scripts/time/eomday.m, scripts/time/etime.m, scripts/time/is_leap_year.m, scripts/time/now.m, scripts/time/weekday.m, src/display-available.c, src/display-available.h, src/main-cli.cc, src/main-gui.cc, src/main.in.cc, src/mkoctfile.in.cc, src/octave-build-info.h, src/octave-build-info.in.cc, src/octave-config.in.cc, src/shared-fcns.h, test/args.tst, test/classdef/classdef.tst, test/classes/classes.tst, test/colormaps.tst, test/complex.tst, test/ctor-vs-method/ctor-vs-method.tst, test/diag-perm.tst, test/error.tst, test/eval-catch.tst, test/fcn-handle-derived-resolution/fcn-handle-derived-resolution.tst, test/fntests.m, test/for.tst, test/func.tst, test/global.tst, test/if.tst, test/index.tst, test/io.tst, test/jit.tst, test/line-continue.tst, test/logical-index.tst, test/nest/nest.tst, test/null-assign.tst, test/parser.tst, test/prefer.tst, test/range.tst, test/recursion.tst, test/return.tst, test/slice.tst, test/struct.tst, test/switch.tst, test/system.tst, test/transpose.tst, test/try.tst, test/unwind.tst, test/while.tst: Use the same Copyright formatting throughout Octave.
author Rik <rik@octave.org>
date Sun, 13 Nov 2016 20:33:47 -0800
parents 3b2a30e9e49f
children 39f39eb4e476
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
1 /*
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
2
22323
bac0d6f07a3e maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents: 22268
diff changeset
3 Copyright (C) 2008-2016 Michael Goffioul
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
4
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
5 This file is part of Octave.
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
6
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22740
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22740
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22740
diff changeset
10 (at your option) any later version.
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22740
diff changeset
11
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22740
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22740
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22740
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22740
diff changeset
15 GNU General Public License for more details.
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
16
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
20
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
21 */
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
22
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21691
diff changeset
23 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21209
diff changeset
24 # include "config.h"
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
25 #endif
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
26
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
27 #include <iostream>
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
28
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21691
diff changeset
29 #if defined (HAVE_WINDOWS_H)
21200
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21198
diff changeset
30 # define WIN32_LEAN_AND_MEAN
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21198
diff changeset
31 # include <windows.h>
21196
bd96c2efd4fe move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents: 21115
diff changeset
32 #endif
bd96c2efd4fe move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents: 21115
diff changeset
33
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
34 #include <lo-mappers.h>
8377
25bc2d31e1bf improve OCTAVE_LOCAL_BUFFER
Jaroslav Hajek <highegg@gmail.com>
parents: 8263
diff changeset
35 #include "oct-locbuf.h"
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13961
diff changeset
36 #include "oct-refcount.h"
21115
629643522cc0 include errwarn.h in all files that use gripe_disabled_feature
John W. Eaton <jwe@octave.org>
parents: 21109
diff changeset
37
629643522cc0 include errwarn.h in all files that use gripe_disabled_feature
John W. Eaton <jwe@octave.org>
parents: 21109
diff changeset
38 #include "errwarn.h"
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
39 #include "gl-render.h"
21196
bd96c2efd4fe move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents: 21115
diff changeset
40 #include "oct-opengl.h"
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
41 #include "text-renderer.h"
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
42
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
43 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
44
22326
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
45 static int
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
46 next_power_of_2 (int n)
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
47 {
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
48 int m = 1;
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
49
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
50 while (m < n && m < std::numeric_limits<int>::max ())
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
51 m <<= 1;
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
52
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
53 return m;
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
54 }
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
55
22393
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
56 #endif
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
57
22326
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
58 namespace octave
71dd9d5a5ecd move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
59 {
22393
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
60 #if defined (HAVE_OPENGL)
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
61
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7825
diff changeset
62 #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
63
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
64 // Use symbolic names for axes
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
65 enum
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
66 {
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
67 X_AXIS,
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
68 Y_AXIS,
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
69 Z_AXIS
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
70 };
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
71
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
72 // Use symbolic names for color mode
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
73 enum
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
74 {
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
75 UNIFORM,
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
76 FLAT,
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
77 INTERP,
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
78 TEXTURE
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
79 };
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
80
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
81 // Use symbolic names for lighting
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
82 enum
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
83 {
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
84 NONE,
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
85 //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
86 GOURAUD = 2
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
87 };
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
88
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
89 // Win32 API requires the CALLBACK attributes for
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
90 // 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
91 // other platforms.
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21691
diff changeset
92 #if ! defined (CALLBACK)
21200
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21198
diff changeset
93 # 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
94 #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
95
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
96 class
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
97 opengl_texture
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
98 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
99 protected:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
100 class texture_rep
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
101 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
102 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
103 texture_rep (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
104 : id (), w (), h (), tw (), th (), tx (), ty (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
105 valid (false), count (1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
106 { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
107
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
108 texture_rep (GLuint id_arg, int w_arg, int h_arg, int tw_arg, int th_arg)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
109 : id (id_arg), w (w_arg), h (h_arg), tw (tw_arg), th (th_arg),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
110 tx (double(w)/tw), ty (double(h)/th), valid (true),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
111 count (1) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
112
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
113 ~texture_rep (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
114 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
115 if (valid)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
116 glDeleteTextures (1, &id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
117 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
118
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
119 void bind (int mode) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
120 { if (valid) glBindTexture (mode, id); }
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 tex_coord (double q, double r) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
123 { if (valid) glTexCoord2d (q*tx, r*ty); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
124
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
125 GLuint id;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
126 int w, h;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
127 int tw, th;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
128 double tx, ty;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
129 bool valid;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
130 octave_refcount<int> count;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
131 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
132
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
133 texture_rep *rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
134
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
135 private:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
136 opengl_texture (texture_rep *_rep) : rep (_rep) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
137
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
138 public:
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
139 opengl_texture (void) : rep (new texture_rep ()) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
140
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
141 opengl_texture (const opengl_texture& tx)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
142 : rep (tx.rep)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
143 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
144 rep->count++;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
145 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
146
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
147 ~opengl_texture (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
148 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
149 if (--rep->count == 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
150 delete rep;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
151 }
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
152
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
153 opengl_texture& operator = (const opengl_texture& tx)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
154 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
155 if (--rep->count == 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
156 delete rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
157
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
158 rep = tx.rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
159 rep->count++;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
160
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
161 return *this;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
162 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
163
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
164 static opengl_texture create (const octave_value& data);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
165
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
166 void bind (int mode = GL_TEXTURE_2D) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
167 { rep->bind (mode); }
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
168
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
169 void tex_coord (double q, double r) const
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
170 { rep->tex_coord (q, r); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
171
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
172 bool is_valid (void) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
173 { return rep->valid; }
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
174 };
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
175
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
176 opengl_texture
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
177 opengl_texture::create (const octave_value& data)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
178 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
179 opengl_texture retval;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
180
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
181 dim_vector dv (data.dims ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
182
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
183 // Expect RGB data
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
184 if (dv.ndims () == 3 && dv(2) == 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
185 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
186 // 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
187 // 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
188 int h, w, tw, th;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
189 h = dv(0), w = dv(1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
190 GLuint id;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
191 bool ok = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
192
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
193 tw = next_power_of_2 (w);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
194 th = next_power_of_2 (h);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
195
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
196 glGenTextures (1, &id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
197 glBindTexture (GL_TEXTURE_2D, id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
198
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
199 if (data.is_double_type ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
200 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
201 const NDArray xdata = data.array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
202
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
203 OCTAVE_LOCAL_BUFFER (float, a, (3*tw*th));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
204
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
205 for (int i = 0; i < h; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
206 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
207 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
208 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
209 a[idx] = xdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
210 a[idx+1] = xdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
211 a[idx+2] = xdata(i,j,2);
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
214
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
215 glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB, GL_FLOAT, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
216 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
217 else if (data.is_uint8_type ())
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 const uint8NDArray xdata = data.uint8_array_value ();
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 OCTAVE_LOCAL_BUFFER (octave_uint8, a, (3*tw*th));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
222
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
223 for (int i = 0; i < h; i++)
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 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
226 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
227 a[idx] = xdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
228 a[idx+1] = xdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
229 a[idx+2] = xdata(i,j,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
230 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
231 }
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 glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
234 GL_RGB, GL_UNSIGNED_BYTE, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
235 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
236 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
237 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
238 ok = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
239 warning ("opengl_texture::create: invalid texture data type (double or uint8 required)");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
240 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
241
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
242 if (ok)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
243 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
244 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
245 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
246
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
247 if (glGetError () != GL_NO_ERROR)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
248 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
249 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
250 retval = opengl_texture (new texture_rep (id, w, h, tw, th));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
251 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
252 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
253 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
254 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
255
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
256 return retval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
257 }
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
258
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
259 class
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
260 opengl_tesselator
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
261 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
262 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
263 #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
264 typedef GLvoid (CALLBACK *fcn) (...);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
265 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
266 typedef void (CALLBACK *fcn) (void);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
267 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
268
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
269 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
270
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
271 opengl_tesselator (void) : glu_tess (0), fill () { init (); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
272
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
273 virtual ~opengl_tesselator (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
274 { if (glu_tess) gluDeleteTess (glu_tess); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
275
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
276 void begin_polygon (bool filled = true)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
277 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
278 gluTessProperty (glu_tess, GLU_TESS_BOUNDARY_ONLY,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
279 (filled ? GL_FALSE : GL_TRUE));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
280 fill = filled;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
281 gluTessBeginPolygon (glu_tess, this);
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
284 void end_polygon (void) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
285 { gluTessEndPolygon (glu_tess); }
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 void begin_contour (void) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
288 { gluTessBeginContour (glu_tess); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
289
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
290 void end_contour (void) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
291 { gluTessEndContour (glu_tess); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
292
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
293 void add_vertex (double *loc, void *data) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
294 { gluTessVertex (glu_tess, loc, data); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
295
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
296 protected:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
297 virtual void begin (GLenum /*type*/) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
298
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
299 virtual void end (void) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
300
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
301 virtual void vertex (void * /*data*/) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
302
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
303 virtual void combine (GLdouble [3] /*c*/, void * [4] /*data*/,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
304 GLfloat [4] /*w*/, void ** /*out_data*/) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
305
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
306 virtual void edge_flag (GLboolean /*flag*/) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
307
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
308 virtual void error (GLenum err)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
309 { ::error ("OpenGL tesselation error (%d)", err); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
310
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
311 virtual void init (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
312 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
313 glu_tess = gluNewTess ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
314
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
315 gluTessCallback (glu_tess, GLU_TESS_BEGIN_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
316 reinterpret_cast<fcn> (tess_begin));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
317 gluTessCallback (glu_tess, GLU_TESS_END_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
318 reinterpret_cast<fcn> (tess_end));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
319 gluTessCallback (glu_tess, GLU_TESS_VERTEX_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
320 reinterpret_cast<fcn> (tess_vertex));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
321 gluTessCallback (glu_tess, GLU_TESS_COMBINE_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
322 reinterpret_cast<fcn> (tess_combine));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
323 gluTessCallback (glu_tess, GLU_TESS_EDGE_FLAG_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
324 reinterpret_cast<fcn> (tess_edge_flag));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
325 gluTessCallback (glu_tess, GLU_TESS_ERROR_DATA,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
326 reinterpret_cast<fcn> (tess_error));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
327 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
328
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
329 bool is_filled (void) const { return fill; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
330
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
331 private:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
332 static void CALLBACK tess_begin (GLenum type, void *t)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
333 { reinterpret_cast<opengl_tesselator *> (t)->begin (type); }
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 static void CALLBACK tess_end (void *t)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
336 { reinterpret_cast<opengl_tesselator *> (t)->end (); }
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 static void CALLBACK tess_vertex (void *v, void *t)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
339 { reinterpret_cast<opengl_tesselator *> (t)->vertex (v); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
340
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
341 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
342 void **out, void *t)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
343 { reinterpret_cast<opengl_tesselator *> (t)->combine (c, v, w, out); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
344
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
345 static void CALLBACK tess_edge_flag (GLboolean flag, void *t)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
346 { reinterpret_cast<opengl_tesselator *> (t)->edge_flag (flag); }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
347
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
348 static void CALLBACK tess_error (GLenum err, void *t)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
349 { reinterpret_cast<opengl_tesselator *> (t)->error (err); }
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 private:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
352
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
353 // No copying!
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
354
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
355 opengl_tesselator (const opengl_tesselator&);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
356
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
357 opengl_tesselator operator = (const opengl_tesselator&);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
358
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
359 GLUtesselator *glu_tess;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
360 bool fill;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
361 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
362
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
363 class
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
364 vertex_data
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
365 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
366 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
367 class vertex_data_rep
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
368 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
369 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
370 Matrix coords;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
371 Matrix color;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
372 Matrix normal;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
373 double alpha;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
374 float ambient;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
375 float diffuse;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
376 float specular;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
377 float specular_exp;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
378 float specular_color_refl;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
379
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
380 // reference counter
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
381 octave_refcount<int> count;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
382
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
383 vertex_data_rep (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
384 : coords (), color (), normal (), alpha (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
385 ambient (), diffuse (), specular (), specular_exp (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
386 specular_color_refl (), count (1) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
387
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
388 vertex_data_rep (const Matrix& c, const Matrix& col, const Matrix& n,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
389 double a, float as, float ds, float ss, float se,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
390 float scr)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
391 : coords (c), color (col), normal (n), alpha (a),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
392 ambient (as), diffuse (ds), specular (ss), specular_exp (se),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
393 specular_color_refl (scr), count (1) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
394 };
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 private:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
397 vertex_data_rep *rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
398
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
399 vertex_data_rep *nil_rep (void) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
400 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
401 static vertex_data_rep *nr = new vertex_data_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
402
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
403 return nr;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
404 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
405
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
406 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
407 vertex_data (void) : rep (nil_rep ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
408 { rep->count++; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
409
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
410 vertex_data (const vertex_data& v) : rep (v.rep)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
411 { rep->count++; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
412
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
413 vertex_data (const Matrix& c, const Matrix& col, const Matrix& n,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
414 double a, float as, float ds, float ss, float se,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
415 float scr)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
416 : rep (new vertex_data_rep (c, col, n, a, as, ds, ss, se, scr))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
417 { }
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 vertex_data (vertex_data_rep *new_rep)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
420 : rep (new_rep) { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
421
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
422 ~vertex_data (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
423 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
424 if (--rep->count == 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
425 delete rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
426 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
427
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
428 vertex_data& operator = (const vertex_data& v)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
429 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
430 if (--rep->count == 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
431 delete rep;
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 rep = v.rep;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
434 rep->count++;
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 return *this;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
437 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
438
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
439 vertex_data_rep *get_rep (void) const { return rep; }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
440 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
441
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
442 class
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
443 opengl_renderer::patch_tesselator : public opengl_tesselator
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
444 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
445 public:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
446 patch_tesselator (opengl_renderer *r, int cmode, int lmode, float idx = 0.0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
447 : opengl_tesselator (), renderer (r),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
448 color_mode (cmode), light_mode (lmode), index (idx),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
449 first (true), tmp_vdata ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
450 { }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
451
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
452 protected:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
453 void begin (GLenum type)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
454 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
455 //printf ("patch_tesselator::begin (%d)\n", type);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
456 first = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
457
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
458 if (color_mode == INTERP || light_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
459 glShadeModel (GL_SMOOTH);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
460 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
461 glShadeModel (GL_FLAT);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
462
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
463 if (is_filled ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
464 renderer->set_polygon_offset (true, index);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
465
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
466 glBegin (type);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
467 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
468
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
469 void end (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
470 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
471 //printf ("patch_tesselator::end\n");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
472 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
473 renderer->set_polygon_offset (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
474 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
475
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
476 void vertex (void *data)
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 vertex_data::vertex_data_rep *v
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
479 = reinterpret_cast<vertex_data::vertex_data_rep *> (data);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
480 //printf ("patch_tesselator::vertex (%g, %g, %g)\n", v->coords(0), v->coords(1), v->coords(2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
481
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
482 // 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
483 // 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
484
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
485 if (color_mode == INTERP || (color_mode == FLAT && ! is_filled ()))
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
486 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
487 Matrix col = v->color;
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 if (col.numel () == 3)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
490 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
491 glColor3dv (col.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
492 if (light_mode > 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
493 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
494 float buf[4] = { 0, 0, 0, 1 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
495
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
496 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
497 buf[k] = (v->ambient * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
498 glMaterialfv (LIGHT_MODE, GL_AMBIENT, buf);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
499
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
500 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
501 buf[k] = (v->diffuse * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
502 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, buf);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
503
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
504 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
505 buf[k] = v->specular * (v->specular_color_refl +
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
506 (1 - v->specular_color_refl) * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
507 glMaterialfv (LIGHT_MODE, GL_SPECULAR, buf);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
508
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
509 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
510 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
511 }
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 if (light_mode > 0 && (first || light_mode == GOURAUD))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
514 glNormal3dv (v->normal.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
515
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
516 glVertex3dv (v->coords.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
517
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
518 first = false;
7831
c7925666f0bf Add OpenGL texture wrapper class (not complete yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
519 }
22331
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 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
522 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
523 //printf ("patch_tesselator::combine\n");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
524
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
525 vertex_data::vertex_data_rep *v[4];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
526 int vmax = 4;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
527
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
528 for (int i = 0; i < 4; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
529 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
530 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
531
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
532 if (vmax == 4 && ! v[i])
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
533 vmax = i;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
534 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
535
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
536 Matrix vv (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
537 Matrix cc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
538 Matrix nn (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
539 double aa = 0.0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
540
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
541 vv(0) = xyz[0];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
542 vv(1) = xyz[1];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
543 vv(2) = xyz[2];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
544
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
545 if (v[0]->color.numel ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
546 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
547 cc.resize (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
548 for (int ic = 0; ic < 3; ic++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
549 for (int iv = 0; iv < vmax; iv++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
550 cc(ic) += (w[iv] * v[iv]->color (ic));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
551 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
552
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
553 if (v[0]->normal.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
554 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
555 for (int in = 0; in < 3; in++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
556 for (int iv = 0; iv < vmax; iv++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
557 nn(in) += (w[iv] * v[iv]->normal (in));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
558 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
559
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
560 for (int iv = 0; iv < vmax; iv++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
561 aa += (w[iv] * v[iv]->alpha);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
562
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
563 vertex_data new_v (vv, cc, nn, aa, v[0]->ambient, v[0]->diffuse,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
564 v[0]->specular, v[0]->specular_exp, v[0]->specular_color_refl);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
565 tmp_vdata.push_back (new_v);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
566
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
567 *out_data = new_v.get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
568 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
569
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
570 private:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
571
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
572 // No copying!
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
573
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
574 patch_tesselator (const patch_tesselator&);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
575
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
576 patch_tesselator& operator = (const patch_tesselator&);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
577
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
578 opengl_renderer *renderer;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
579 int color_mode;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
580 int light_mode;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
581 int index;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
582 bool first;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
583 std::list<vertex_data> tmp_vdata;
7833
8ff92634982d Add initial support for patch rendering through GLU tessellation (no transparency, no border, no markers yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7831
diff changeset
584 };
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
585
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
586 #else
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
587
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
588 class
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
589 opengl_renderer::patch_tesselator
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
590 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
591 // Dummy class.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
592 };
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
593
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
594 #endif
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
595
22393
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
596 }
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
597
22258
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
598 #if defined (HAVE_OPENGL)
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
599
22393
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
600 static int
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
601 get_maxlights (void)
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
602 {
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
603
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
604 static int max_lights = 0;
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
605
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
606 // Check actual maximum number of lights possible
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
607 if (max_lights == 0)
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
608 {
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
609 for (max_lights = 0; max_lights < GL_MAX_LIGHTS; max_lights++)
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
610 {
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
611 glDisable (GL_LIGHT0 + max_lights);
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
612 if (glGetError ())
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
613 break;
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
614 }
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
615 }
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
616
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
617 return max_lights;
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
618
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
619 }
22192
20b225a3ebf8 Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22105
diff changeset
620
20b225a3ebf8 Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22105
diff changeset
621 #endif
20b225a3ebf8 Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22105
diff changeset
622
22393
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
623 namespace octave
026067ffcf66 fix build with minimal dependencies
John W. Eaton <jwe@octave.org>
parents: 22391
diff changeset
624 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
625 opengl_renderer::opengl_renderer (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
626 : toolkit (), xform (), xmin (), xmax (), ymin (), ymax (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
627 zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
628 camera_pos (), camera_dir (), interpreter ("none"), txt_renderer ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
629 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
630 // 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
631 // 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
632 // OpenGL types.
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
633
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
634 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
635
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
636 // 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
637 // FIXME: should we check signed vs. unsigned?
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
638
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
639 static bool ok = (sizeof (int) <= sizeof (GLsizei));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
640
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
641 if (! ok)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
642 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
643
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
644 #else
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
645
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
646 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
647
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
648 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
649 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
650
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
651 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
652 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
653 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
654 if (! go.valid_object ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
655 return;
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 const base_properties& props = go.get_properties ();
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 if (! toolkit)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
660 toolkit = props.get_toolkit ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
661
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
662 if (go.isa ("figure"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
663 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
664 else if (go.isa ("axes"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
665 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
666 else if (go.isa ("line"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
667 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
668 else if (go.isa ("surface"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
669 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
670 else if (go.isa ("patch"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
671 draw_patch (dynamic_cast<const patch::properties&> (props));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
672 else if (go.isa ("light"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
673 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
674 else if (go.isa ("hggroup"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
675 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
676 else if (go.isa ("text"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
677 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
678 else if (go.isa ("image"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
679 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
680 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
681 || go.isa ("uicontextmenu") || go.isa ("uitoolbar")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
682 || go.isa ("uipushtool") || go.isa ("uitoggletool"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
683 ; // SKIP
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
684 else if (go.isa ("uipanel"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
685 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
686 if (toplevel)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
687 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
688 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
689 else if (go.isa ("uibuttongroup"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
690 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
691 if (toplevel)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
692 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
693 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
694 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
695 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
696 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
697 props.graphics_object_name ().c_str ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
698 }
22494
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
699
22500
1d3b71530539 fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents: 22494
diff changeset
700 #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
701
22494
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
702 GLenum gl_error = glGetError ();
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
703 if (gl_error)
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
704 warning ("opengl_renderer: Error %d occurred drawing '%s' object",
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
705 gl_error, props.graphics_object_name ().c_str ());
22500
1d3b71530539 fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents: 22494
diff changeset
706
1d3b71530539 fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents: 22494
diff changeset
707 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
708 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
709
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
710 #if defined (HAVE_OPENGL)
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 static std::string
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
713 gl_get_string (GLenum id)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
714 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
715 // This is kind of ugly, but glGetString returns a pointer to GLubyte
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
716 // and there is no std::string constructor that matches. Is there a
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
717 // better way?
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 std::ostringstream buf;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
720 buf << glGetString (id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
721 return std::string (buf.str ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
722 }
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 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
725
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
726 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
727 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
728 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
729 // Initialize OpenGL context
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
730
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
731 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
732
21689
9467549bd5ff * gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents: 21684
diff changeset
733 #if defined (HAVE_OPENGL)
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
734
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
735 props.set___gl_extensions__ (gl_get_string (GL_EXTENSIONS));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
736 props.set___gl_renderer__ (gl_get_string (GL_RENDERER));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
737 props.set___gl_vendor__ (gl_get_string (GL_VENDOR));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
738 props.set___gl_version__ (gl_get_string (GL_VERSION));
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
739
21689
9467549bd5ff * gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents: 21684
diff changeset
740 #endif
21684
1449e3b98941 store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents: 21660
diff changeset
741
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
742 // Draw children
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
743
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
744 draw (props.get_all_children (), false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
745 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
746
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
747 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
748 opengl_renderer::draw_uipanel (const uipanel::properties& props,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
749 const graphics_object& go)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
750 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
751 graphics_object fig = go.get_ancestor ("figure");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
752 const figure::properties& figProps =
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
753 dynamic_cast<const figure::properties&> (fig.get_properties ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
754
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
755 // Initialize OpenGL context
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
756
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
757 init_gl_context (figProps.is_graphicssmoothing (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
758 props.get_backgroundcolor_rgb ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
759
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
760 // Draw children
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
761
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
762 draw (props.get_all_children (), false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
763 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
764
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
765 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
766 opengl_renderer::draw_uibuttongroup (const uibuttongroup::properties& props,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
767 const graphics_object& go)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
768 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
769 graphics_object fig = go.get_ancestor ("figure");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
770 const figure::properties& figProps =
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
771 dynamic_cast<const figure::properties&> (fig.get_properties ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
772
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
773 // Initialize OpenGL context
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 init_gl_context (figProps.is_graphicssmoothing (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
776 props.get_backgroundcolor_rgb ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
777
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
778 // Draw children
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
779
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
780 draw (props.get_all_children (), false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
781 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
782
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
783 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
784 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
785 {
21689
9467549bd5ff * gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents: 21684
diff changeset
786 #if defined (HAVE_OPENGL)
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
787
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
788 // Initialize OpenGL context
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
789
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
790 glEnable (GL_DEPTH_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
791 glDepthFunc (GL_LEQUAL);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
792 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
793 glAlphaFunc (GL_GREATER, 0.0f);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
794 glEnable (GL_NORMALIZE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
795
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
796 if (enhanced)
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 glEnable (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
799 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
800 bool has_multisample = false;
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
801 if (! glGetError ())
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
802 {
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
803 GLint iMultiSample, iNumSamples;
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
804 glGetIntegerv (GL_SAMPLE_BUFFERS, &iMultiSample);
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
805 glGetIntegerv (GL_SAMPLES, &iNumSamples);
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
806 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
807 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
808 }
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
809
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
810 if (! has_multisample)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
811 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
812 // MultiSample not implemented. Use old-style anti-aliasing
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
813 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
814 // 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
815 // implemented. Thus, call glGetError to reset the error state.
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
816 glGetError ();
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
817
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
818 glEnable (GL_LINE_SMOOTH);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
819 glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
820 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
821 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
822 else
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 glDisable (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
825 glDisable (GL_LINE_SMOOTH);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
826 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
827
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
828 // Clear background
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
829
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
830 if (c.numel () >= 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
831 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
832 glClearColor (c(0), c(1), c(2), 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
833 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
834 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
835
22494
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
836 GLenum gl_error = glGetError ();
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
837 if (gl_error)
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
838 warning ("opengl_renderer: Error %d occurred in init_gl_context",
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
839 gl_error);
3564b6b6b8d1 Query OpenGL errors on initialization of GL context (bug #45542).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22407
diff changeset
840
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
841 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
842
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
843 octave_unused_parameter (enhanced);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
844 octave_unused_parameter (c);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
845
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
846 // 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
847 // 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
848
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
849 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
850
21689
9467549bd5ff * gl-render.cc: Allow compilation without OPENGL.
John W. Eaton <jwe@octave.org>
parents: 21684
diff changeset
851 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
852 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
853
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
854 void
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
855 opengl_renderer::render_grid (const double linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
856 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
857 const Matrix& gridcolor, const double gridalpha,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
858 const Matrix& ticks, double lim1, double lim2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
859 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
860 int xyz, bool is_3D)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
861 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
862 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
863
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
864 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
865 set_linestyle (gridstyle, true, linewidth);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
866 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
867 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
868 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
869 double val = ticks(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
870 if (lim1 <= val && val <= lim2)
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 if (xyz == X_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
873 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
874 glVertex3d (val, p1N, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
875 glVertex3d (val, p1, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
876 if (is_3D)
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 glVertex3d (val, p1, p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
879 glVertex3d (val, p1, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
880 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
881 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
882 else if (xyz == Y_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
883 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
884 glVertex3d (p1N, val, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
885 glVertex3d (p1, val, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
886 if (is_3D)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
887 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
888 glVertex3d (p1, val, p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
889 glVertex3d (p1, val, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
890 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
891 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
892 else if (xyz == Z_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
893 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
894 glVertex3d (p1N, p2, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
895 glVertex3d (p1, p2, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
896 glVertex3d (p1, p2N, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
897 glVertex3d (p1, p2, val);
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
900 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
901 glEnd ();
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
902 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
903 double black[3] = {0, 0, 0};
2b1612cf38e4 gl-render.cc/.h: (minor)gridcolor and (minor)gridalpha for OpenGL toolkits (bug #48429)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22331
diff changeset
904 glColor3dv (black);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
905
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
906 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
907
22500
1d3b71530539 fix compilation of gl-render.cc if OpenGL is missing
John W. Eaton <jwe@octave.org>
parents: 22494
diff changeset
908 octave_unused_parameter (linewidth);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
909 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
910 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
911 octave_unused_parameter (gridalpha);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
912 octave_unused_parameter (ticks);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
913 octave_unused_parameter (lim1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
914 octave_unused_parameter (lim2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
915 octave_unused_parameter (p1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
916 octave_unused_parameter (p1N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
917 octave_unused_parameter (p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
918 octave_unused_parameter (p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
919 octave_unused_parameter (xyz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
920 octave_unused_parameter (is_3D);
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 // 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
923 // 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
924
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
925 panic_impossible ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
926
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
927 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
928 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
929
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
930 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
931 opengl_renderer::render_tickmarks (const Matrix& ticks,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
932 double lim1, double lim2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
933 double p1, double p1N,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
934 double p2, double p2N,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
935 double dx, double dy, double dz,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
936 int xyz, bool mirror)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
937 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
938 #if defined (HAVE_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
939
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
940 glBegin (GL_LINES);
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 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
943 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
944 double val = ticks(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
945
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
946 if (lim1 <= val && val <= lim2)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
947 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
948 if (xyz == X_AXIS)
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 glVertex3d (val, p1, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
951 glVertex3d (val, p1+dy, p2+dz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
952 if (mirror)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
953 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
954 glVertex3d (val, p1N, p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
955 glVertex3d (val, p1N-dy, p2N-dz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
956 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
957 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
958 else if (xyz == Y_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
959 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
960 glVertex3d (p1, val, p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
961 glVertex3d (p1+dx, val, p2+dz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
962 if (mirror)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
963 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
964 glVertex3d (p1N, val, p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
965 glVertex3d (p1N-dx, val, p2N-dz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
966 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
967 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
968 else if (xyz == Z_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
969 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
970 glVertex3d (p1, p2, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
971 glVertex3d (p1+dx, p2+dy, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
972 if (mirror)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
973 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
974 glVertex3d (p1N, p2N, val);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
975 glVertex3d (p1N-dx, p2N-dy, val);
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 }
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
981 glEnd ();
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
982
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
983 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
984
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
985 octave_unused_parameter (ticks);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
986 octave_unused_parameter (lim1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
987 octave_unused_parameter (lim2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
988 octave_unused_parameter (p1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
989 octave_unused_parameter (p1N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
990 octave_unused_parameter (p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
991 octave_unused_parameter (p2N);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
992 octave_unused_parameter (dx);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
993 octave_unused_parameter (dy);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
994 octave_unused_parameter (dz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
995 octave_unused_parameter (xyz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
996 octave_unused_parameter (mirror);
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 // 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
999 // 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
1000
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1001 panic_impossible ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1002
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1003 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1004 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1005
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1006 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1007 opengl_renderer::render_ticktexts (const Matrix& ticks,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1008 const string_vector& ticklabels,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1009 double lim1, double lim2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1010 double p1, double p2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1011 int xyz, int ha, int va,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1012 int& wmax, int& hmax)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1013 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1014 #if defined (HAVE_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1015
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1016 int nticks = ticks.numel ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1017 int nlabels = ticklabels.numel ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1018
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1019 if (nlabels == 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1020 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1021
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1022 for (int i = 0; i < nticks; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1023 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1024 double val = ticks(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1025
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1026 if (lim1 <= val && val <= lim2)
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 Matrix b;
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 std::string label (ticklabels(i % nlabels));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1031 label.erase (0, label.find_first_not_of (" "));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1032 label = label.substr (0, label.find_last_not_of (" ")+1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1033
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1034 // 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
1035 // drawn after axes object, for correct rendering?
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1036 if (xyz == X_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1037 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1038 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
1039 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1040 else if (xyz == Y_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1041 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1042 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
1043 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1044 else if (xyz == Z_AXIS)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1045 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1046 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
1047 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1048
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1049 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
1050 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
1051 }
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1054 #else
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 octave_unused_parameter (ticks);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1057 octave_unused_parameter (ticklabels);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1058 octave_unused_parameter (lim1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1059 octave_unused_parameter (lim2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1060 octave_unused_parameter (p1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1061 octave_unused_parameter (p2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1062 octave_unused_parameter (xyz);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1063 octave_unused_parameter (ha);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1064 octave_unused_parameter (va);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1065 octave_unused_parameter (wmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1066 octave_unused_parameter (hmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1067
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1068 // 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
1069 // 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
1070
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1071 panic_impossible ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1072
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1073 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1074 }
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 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1077 opengl_renderer::finish (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1078 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1079 #if defined (HAVE_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1080
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1081 glFinish ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1082
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1083 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1084
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1085 // 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
1086 // 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
1087
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1088 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1089
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1090 #endif
22331
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1093 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1094 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
1095 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1096 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1097
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1098 // setup OpenGL transformation
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1099
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1100 Matrix x_zlim = props.get_transform_zlim ();
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 xZ1 = x_zlim(0)-(x_zlim(1)-x_zlim(0))/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1103 xZ2 = x_zlim(1)+(x_zlim(1)-x_zlim(0))/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1104
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1105 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
1106 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
1107
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1108 #if defined (HAVE_FRAMEWORK_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1109 GLint vw[4];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1110 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1111 int vw[4];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1112 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1113
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1114 glGetIntegerv (GL_VIEWPORT, vw);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1115
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1116 glMatrixMode (GL_MODELVIEW);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1117 glLoadIdentity ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1118 glScaled (1, 1, -1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1119 glMultMatrixd (x_mat1.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1120 glMatrixMode (GL_PROJECTION);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1121 glLoadIdentity ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1122 glOrtho (0, vw[2], vw[3], 0, xZ1, xZ2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1123 glMultMatrixd (x_mat2.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1124 glMatrixMode (GL_MODELVIEW);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1125
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1126 glClear (GL_DEPTH_BUFFER_BIT);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1127
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1128 // store axes transformation data
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1129
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1130 xform = props.get_transform ();
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1131
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1132 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1133
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1134 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1135
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1136 // 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
1137 // 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
1138
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1139 panic_impossible ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1140
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1141 #endif
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1142 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1143
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1144 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1145 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
1146 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1147 #if defined (HAVE_OPENGL)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1148
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1149 Matrix axe_color = props.get_color_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1150 if (axe_color.is_empty () || ! props.is_visible ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1151 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1152
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1153 double xPlane = props.get_xPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1154 double yPlane = props.get_yPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1155 double zPlane = props.get_zPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1156 double xPlaneN = props.get_xPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1157 double yPlaneN = props.get_yPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1158 double zPlaneN = props.get_zPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1159 bool is2d = props.get_is2D ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1160
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1161 // Axes planes
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1162 set_color (axe_color);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1163 set_polygon_offset (true, 2.5);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1164
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1165 glBegin (GL_QUADS);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1166
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1167 if (! is2d)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1168 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1169 // X plane
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1170 glVertex3d (xPlane, yPlaneN, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1171 glVertex3d (xPlane, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1172 glVertex3d (xPlane, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1173 glVertex3d (xPlane, yPlaneN, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1174
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1175 // Y plane
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1176 glVertex3d (xPlaneN, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1177 glVertex3d (xPlane, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1178 glVertex3d (xPlane, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1179 glVertex3d (xPlaneN, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1180 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1181
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1182 // Z plane
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1183 glVertex3d (xPlaneN, yPlaneN, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1184 glVertex3d (xPlane, yPlaneN, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1185 glVertex3d (xPlane, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1186 glVertex3d (xPlaneN, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1187
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1188 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1189
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1190 set_polygon_offset (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1191
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1192 #else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1193
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1194 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1195
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1196 // 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
1197 // 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
1198
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1199 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1200
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1201 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1202 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1203
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1204 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1205 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
1206 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1207 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1208
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1209 if (! props.is_visible ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1210 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1211
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1212 bool xySym = props.get_xySym ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1213 bool layer2Dtop = props.get_layer2Dtop ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1214 bool is2d = props.get_is2D ();
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1215 bool isXOrigin = props.xaxislocation_is ("origin");
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1216 bool isYOrigin = props.yaxislocation_is ("origin");
22363
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1217 bool boxFull = (props.get_boxstyle () == "full");
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1218 double linewidth = props.get_linewidth ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1219 double xPlane = props.get_xPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1220 double yPlane = props.get_yPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1221 double zPlane = props.get_zPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1222 double xPlaneN = props.get_xPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1223 double yPlaneN = props.get_yPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1224 double zPlaneN = props.get_zPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1225 double xpTick = props.get_xpTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1226 double ypTick = props.get_ypTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1227 double zpTick = props.get_zpTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1228 double xpTickN = props.get_xpTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1229 double ypTickN = props.get_ypTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1230 double zpTickN = props.get_zpTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1231
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1232 bool plotyy = (props.has_property ("__plotyy_axes__"));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1233
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1234 // Axes box
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1235
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1236 set_linestyle ("-", true, linewidth);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1237
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1238 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1239
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1240 if (layer2Dtop)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1241 std::swap (zpTick, zpTickN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1242
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1243 // X box
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1244 set_color (props.get_xcolor_rgb ());
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1245
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1246 if (! isXOrigin || props.is_box() || ! is2d)
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1247 {
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1248 glVertex3d (xPlaneN, ypTick, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1249 glVertex3d (xPlane, ypTick, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1250 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1251
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1252 if (props.is_box ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1253 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1254 glVertex3d (xPlaneN, ypTickN, zpTick);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1255 glVertex3d (xPlane, ypTickN, zpTick);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1256 if (! is2d)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1257 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1258 glVertex3d (xPlaneN, ypTickN, zpTickN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1259 glVertex3d (xPlane, ypTickN, zpTickN);
22363
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1260 if (boxFull)
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1261 {
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1262 glVertex3d (xPlaneN, ypTick, zpTickN);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1263 glVertex3d (xPlane, ypTick, zpTickN);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1264 }
22331
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1267
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1268 // Y box
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1269 set_color (props.get_ycolor_rgb ());
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1270 if (! isYOrigin || props.is_box() || ! is2d)
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1271 {
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1272 glVertex3d (xpTick, yPlaneN, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1273 glVertex3d (xpTick, yPlane, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1274 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1275
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1276 if (props.is_box () && ! plotyy)
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 glVertex3d (xpTickN, yPlaneN, zpTick);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1279 glVertex3d (xpTickN, yPlane, zpTick);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1280
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1281 if (! is2d)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1282 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1283 glVertex3d (xpTickN, yPlaneN, zpTickN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1284 glVertex3d (xpTickN, yPlane, zpTickN);
22363
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1285 if (boxFull)
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1286 {
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1287 glVertex3d (xpTick, yPlaneN, zpTickN);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1288 glVertex3d (xpTick, yPlane, zpTickN);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1289 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1290 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1291 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1292
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1293 // Z box
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1294 if (! is2d)
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 set_color (props.get_zcolor_rgb ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1297
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1298 if (xySym)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1299 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1300 glVertex3d (xPlaneN, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1301 glVertex3d (xPlaneN, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1302 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1303 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1304 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1305 glVertex3d (xPlane, yPlaneN, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1306 glVertex3d (xPlane, yPlaneN, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1307 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1308
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1309 if (props.is_box ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1310 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1311 glVertex3d (xPlane, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1312 glVertex3d (xPlane, yPlane, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1313
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1314 if (xySym)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1315 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1316 glVertex3d (xPlane, yPlaneN, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1317 glVertex3d (xPlane, yPlaneN, zPlane);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1318 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1319 else
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 glVertex3d (xPlaneN, yPlane, zPlaneN);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1322 glVertex3d (xPlaneN, yPlane, zPlane);
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
22363
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1325 if (boxFull)
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1326 {
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1327 glVertex3d (xPlaneN, yPlaneN, zPlaneN);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1328 glVertex3d (xPlaneN, yPlaneN, zPlane);
0ca341841198 Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents: 22362
diff changeset
1329 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1330 }
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1333 glEnd ();
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1334
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1335 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1336
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1337 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1338
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1339 // 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
1340 // 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
1341
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1342 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1343
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1344 #endif
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1347 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1348 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
1349 {
22740
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1350 #if defined (HAVE_OPENGL)
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1351
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1352 int xstate = props.get_xstate ();
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 if (props.is_visible () && xstate != AXE_DEPTH_DIR)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1355 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1356 int zstate = props.get_zstate ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1357 bool x2Dtop = props.get_x2Dtop ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1358 bool layer2Dtop = props.get_layer2Dtop ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1359 bool xyzSym = props.get_xyzSym ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1360 bool nearhoriz = props.get_nearhoriz ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1361 double xticklen = props.get_xticklen ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1362 double xtickoffset = props.get_xtickoffset ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1363 double fy = props.get_fy ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1364 double fz = props.get_fz ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1365 double x_min = props.get_x_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1366 double x_max = props.get_x_max ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1367 double yPlane = props.get_yPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1368 double yPlaneN = props.get_yPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1369 double ypTick = props.get_ypTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1370 double ypTickN = props.get_ypTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1371 double zPlane = props.get_zPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1372 double zPlaneN = props.get_zPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1373 double zpTick = props.get_zpTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1374 double zpTickN = props.get_zpTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1375
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1376 // X grid
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1377
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1378 double linewidth = props.get_linewidth ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1379 std::string gridstyle = props.get_gridlinestyle ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1380 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
1381 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
1382 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
1383 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
1384 double minorgridalpha = props.get_minorgridalpha ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1385 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
1386 bool do_xminorgrid = (props.is_xminorgrid ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1387 && (minorgridstyle != "none"));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1388 bool do_xminortick = props.is_xminortick ();
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1389 bool is_origin = props.xaxislocation_is ("origin") && props.get_is2D ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1390 Matrix xticks = xform.xscale (props.get_xtick ().matrix_value ());
22623
76f1164d2135 Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents: 22622
diff changeset
1391 Matrix xmticks = xform.xscale (props.get_xminortickvalues ().matrix_value ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1392 string_vector xticklabels = props.get_xticklabel ().string_vector_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1393 int wmax = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1394 int hmax = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1395 bool tick_along_z = nearhoriz || octave::math::isinf (fy);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1396 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
1397
22528
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1398 if (props.xcolormode_is ("manual"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1399 {
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1400 // use axis color for (minor)gridcolor
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1401 if (props.gridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1402 gridcolor = props.get_xcolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1403 if (props.minorgridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1404 minorgridcolor = props.get_xcolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1405 }
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1406
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
1407 // 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
1408 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
1409 {
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
1410 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
1411 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
1412 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
1413 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
1414 }
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
1415
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1416 // minor grid lines
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1417 if (do_xminorgrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1418 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1419 minorgridstyle, minorgridcolor, minorgridalpha,
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1420 xmticks, x_min, x_max,
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1421 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1422 0, (zstate != AXE_DEPTH_DIR));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1423
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1424 // grid lines
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1425 if (do_xgrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1426 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1427 gridstyle, gridcolor, gridalpha,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1428 xticks, x_min, x_max,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1429 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1430 0, (zstate != AXE_DEPTH_DIR));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1431
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1432 set_color (props.get_xcolor_rgb ());
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1433
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1434 // axis line
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1435 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
1436 {
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1437 glBegin (GL_LINES);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1438 glVertex3d (x_min, 0, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1439 glVertex3d (x_max, 0, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1440 glEnd ();
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1441 }
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1442
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1443 // minor tick marks
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1444 if (do_xminortick)
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1445 {
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1446 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
1447 render_tickmarks (xmticks, x_min, x_max,
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1448 (is_origin ? 0. : ypTick), ypTick,
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1449 zpTick, zpTickN, 0., 0.,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1450 octave::math::signum (zpTick-zpTickN)*fz*xticklen/2,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1451 0, mirror);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1452 else
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1453 render_tickmarks (xmticks, x_min, x_max,
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1454 (is_origin ? 0. : ypTick), ypTickN,
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1455 zpTick, zpTick, 0.,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1456 octave::math::signum (ypTick-ypTickN)*fy*xticklen/2,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1457 0., 0, mirror);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1458 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1459
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1460 // tick marks
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1461 if (tick_along_z)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1462 {
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1463 render_tickmarks (xticks, x_min, x_max,
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1464 (is_origin ? 0. : ypTick), ypTick,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1465 zpTick, zpTickN, 0., 0.,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1466 octave::math::signum (zpTick-zpTickN)*fz*xticklen,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1467 0, mirror);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1468 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1469 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1470 {
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1471 render_tickmarks (xticks, x_min, x_max,
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1472 (is_origin ? 0. : ypTick), ypTickN,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1473 zpTick, zpTick, 0.,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1474 octave::math::signum (ypTick-ypTickN)*fy*xticklen,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1475 0., 0, mirror);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1476 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1477
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1478 // tick texts
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1479 if (xticklabels.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1480 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1481 int halign = (xstate == AXE_HORZ_DIR ? 1 : (xyzSym ? 0 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1482 int valign = (xstate == AXE_VERT_DIR ? 1 : (x2Dtop ? 0 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1483
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1484 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
1485 render_ticktexts (xticks, xticklabels, x_min, x_max,
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1486 (is_origin ? 0. : ypTick),
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1487 zpTick+octave::math::signum (zpTick-zpTickN)*fz*xtickoffset,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1488 0, halign, valign, wmax, hmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1489 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1490 render_ticktexts (xticks, xticklabels, x_min, x_max,
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1491 (is_origin ? 0. : ypTick) + octave::math::signum (ypTick-ypTickN)*fy*xtickoffset,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1492 zpTick, 0, halign, valign, wmax, hmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1493 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1494
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1495 gh_manager::get_object (props.get_xlabel ()).set ("visible", "on");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1496 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1497 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1498 gh_manager::get_object (props.get_xlabel ()).set ("visible", "off");
22740
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1499
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1500 #else
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1501
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1502 octave_unused_parameter (props);
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1503
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1504 // 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
1505 // 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
1506
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1507 panic_impossible ();
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1508
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1509 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1510 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1511
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1512 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1513 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
1514 {
22740
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1515 #if defined (HAVE_OPENGL)
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1516
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1517 int ystate = props.get_ystate ();
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 if (ystate != AXE_DEPTH_DIR && props.is_visible ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1520 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1521 int zstate = props.get_zstate ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1522 bool y2Dright = props.get_y2Dright ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1523 bool layer2Dtop = props.get_layer2Dtop ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1524 bool xyzSym = props.get_xyzSym ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1525 bool nearhoriz = props.get_nearhoriz ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1526 double yticklen = props.get_yticklen ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1527 double ytickoffset = props.get_ytickoffset ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1528 double fx = props.get_fx ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1529 double fz = props.get_fz ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1530 double xPlane = props.get_xPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1531 double xPlaneN = props.get_xPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1532 double xpTick = props.get_xpTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1533 double xpTickN = props.get_xpTickN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1534 double y_min = props.get_y_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1535 double y_max = props.get_y_max ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1536 double zPlane = props.get_zPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1537 double zPlaneN = props.get_zPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1538 double zpTick = props.get_zpTick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1539 double zpTickN = props.get_zpTickN ();
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 // Y grid
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1542
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1543 double linewidth = props.get_linewidth ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1544 std::string gridstyle = props.get_gridlinestyle ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1545 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
1546 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
1547 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
1548 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
1549 double minorgridalpha = props.get_minorgridalpha ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1550 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
1551 bool do_yminorgrid = (props.is_yminorgrid ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1552 && (minorgridstyle != "none"));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1553 bool do_yminortick = props.is_yminortick ();
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1554 bool is_origin = props.yaxislocation_is ("origin") && props.get_is2D ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1555 Matrix yticks = xform.yscale (props.get_ytick ().matrix_value ());
22623
76f1164d2135 Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents: 22622
diff changeset
1556 Matrix ymticks = xform.yscale (props.get_yminortickvalues ().matrix_value ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1557 string_vector yticklabels = props.get_yticklabel ().string_vector_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1558 int wmax = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1559 int hmax = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1560 bool tick_along_z = nearhoriz || octave::math::isinf (fx);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1561 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
1562 && (! props.has_property ("__plotyy_axes__"));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1563
22528
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1564 if (props.ycolormode_is ("manual"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1565 {
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1566 // use axis color for (minor)gridcolor
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1567 if (props.gridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1568 gridcolor = props.get_ycolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1569 if (props.minorgridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1570 minorgridcolor = props.get_ycolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1571 }
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1572
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
1573 // 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
1574 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
1575 {
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
1576 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
1577 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
1578 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
1579 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
1580 }
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
1581
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1582 // minor grid lines
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1583 if (do_yminorgrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1584 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1585 minorgridstyle, minorgridcolor, minorgridalpha,
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1586 ymticks, y_min, y_max,
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1587 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1588 1, (zstate != AXE_DEPTH_DIR));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1589
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1590 // grid lines
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1591 if (do_ygrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1592 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1593 gridstyle, gridcolor, gridalpha,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1594 yticks, y_min, y_max,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1595 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1596 1, (zstate != AXE_DEPTH_DIR));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1597
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1598 set_color (props.get_ycolor_rgb ());
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1599
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1600 // axis line
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1601 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
1602 {
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1603 glBegin (GL_LINES);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1604 glVertex3d (0., y_min, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1605 glVertex3d (0., y_max, zpTick);
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1606 glEnd ();
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1607 }
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1608
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1609 // minor tick marks
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1610 if (do_yminortick)
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1611 {
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1612 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
1613 render_tickmarks (ymticks, y_min, y_max,
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1614 (is_origin ? 0. : xpTick), xpTick,
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1615 zpTick, zpTickN, 0., 0.,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1616 octave::math::signum (zpTick-zpTickN)*fz*yticklen/2,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1617 1, mirror);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1618 else
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1619 render_tickmarks (ymticks, y_min, y_max,
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1620 (is_origin ? 0. : xpTick), xpTickN,
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1621 zpTick, zpTick,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1622 octave::math::signum (xpTick-xpTickN)*fx*yticklen/2,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1623 0., 0., 1, mirror);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1624 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1625
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1626 // tick marks
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1627 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
1628 render_tickmarks (yticks, y_min, y_max,
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1629 (is_origin ? 0. : xpTick), xpTick,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1630 zpTick, zpTickN, 0., 0.,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1631 octave::math::signum (zpTick-zpTickN)*fz*yticklen,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1632 1, mirror);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1633 else
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1634 render_tickmarks (yticks, y_min, y_max,
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1635 (is_origin ? 0. : xpTick), xpTickN,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1636 zpTick, zpTick,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1637 octave::math::signum (xPlaneN-xPlane)*fx*yticklen,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1638 0., 0., 1, mirror);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1639
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1640 // tick texts
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1641 if (yticklabels.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1642 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1643 int halign = (ystate == AXE_HORZ_DIR
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1644 ? 1 : (! xyzSym || y2Dright ? 0 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1645 int valign = (ystate == AXE_VERT_DIR ? 1 : 2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1646
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1647 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
1648 render_ticktexts (yticks, yticklabels, y_min, y_max,
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1649 (is_origin ? 0. : xpTick),
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1650 zpTick+octave::math::signum (zpTick-zpTickN)*fz*ytickoffset,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1651 1, halign, valign, wmax, hmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1652 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1653 render_ticktexts (yticks, yticklabels, y_min, y_max,
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1654 (is_origin ? 0. : xpTick) + octave::math::signum (xpTick-xpTickN)*fx*ytickoffset,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1655 zpTick, 1, halign, valign, wmax, hmax);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1656 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1657
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1658 gh_manager::get_object (props.get_ylabel ()).set ("visible", "on");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1659 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1660 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1661 gh_manager::get_object (props.get_ylabel ()).set ("visible", "off");
22740
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1662
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1663 #else
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1664
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1665 octave_unused_parameter (props);
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1666
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1667 // 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
1668 // 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
1669
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1670 panic_impossible ();
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1671
3b2a30e9e49f build: Fix building when '--without-opengl' option given (bug #49561).
Rik <rik@octave.org>
parents: 22711
diff changeset
1672 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1673 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1674
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1675 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1676 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
1677 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1678 int zstate = props.get_zstate ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1679
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1680 if (zstate != AXE_DEPTH_DIR && props.is_visible ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1681 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1682 bool xySym = props.get_xySym ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1683 bool zSign = props.get_zSign ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1684 double zticklen = props.get_zticklen ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1685 double ztickoffset = props.get_ztickoffset ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1686 double fx = props.get_fx ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1687 double fy = props.get_fy ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1688 double xPlane = props.get_xPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1689 double xPlaneN = props.get_xPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1690 double yPlane = props.get_yPlane ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1691 double yPlaneN = props.get_yPlaneN ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1692 double z_min = props.get_z_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1693 double z_max = props.get_z_max ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1694
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1695 // Z Grid
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1696
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1697 double linewidth = props.get_linewidth ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1698 std::string gridstyle = props.get_gridlinestyle ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1699 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
1700 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
1701 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
1702 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
1703 double minorgridalpha = props.get_minorgridalpha ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1704 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
1705 bool do_zminorgrid = (props.is_zminorgrid ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1706 && (minorgridstyle != "none"));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1707 bool do_zminortick = props.is_zminortick ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1708 Matrix zticks = xform.zscale (props.get_ztick ().matrix_value ());
22623
76f1164d2135 Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents: 22622
diff changeset
1709 Matrix zmticks = xform.zscale (props.get_zminortickvalues ().matrix_value ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1710 string_vector zticklabels = props.get_zticklabel ().string_vector_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1711 int wmax = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1712 int hmax = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1713 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
1714
22528
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1715 if (props.zcolormode_is ("manual"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1716 {
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1717 // use axis color for (minor)gridcolor
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1718 if (props.gridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1719 gridcolor = props.get_zcolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1720 if (props.minorgridcolormode_is ("auto"))
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1721 minorgridcolor = props.get_zcolor_rgb ();
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1722 }
5a1167e15c0e Fix color of (minor) grid (bug #48429).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22500
diff changeset
1723
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
1724 // 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
1725 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
1726 {
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
1727 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
1728 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
1729 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
1730 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
1731 }
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
1732
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1733 // minor grid lines
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1734 if (do_zminorgrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1735 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1736 minorgridstyle, minorgridcolor, minorgridalpha,
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1737 zmticks, z_min, z_max,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1738 xPlane, xPlaneN, yPlane, yPlaneN, 2, true);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1739
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1740 // grid lines
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1741 if (do_zgrid)
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1742 render_grid (linewidth,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1743 gridstyle, gridcolor, gridalpha,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
1744 zticks, z_min, z_max,
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1745 xPlane, xPlaneN, yPlane, yPlaneN, 2, true);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1746
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1747 set_color (props.get_zcolor_rgb ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1748
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1749 // minor tick marks
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1750 if (do_zminortick)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1751 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1752 if (xySym)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1753 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1754 if (octave::math::isinf (fy))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1755 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
1756 yPlane, yPlane,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1757 octave::math::signum (xPlaneN-xPlane)*fx*zticklen/2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1758 0., 0., 2, mirror);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1759 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1760 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
1761 yPlane, yPlane, 0.,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1762 octave::math::signum (yPlane-yPlaneN)*fy*zticklen/2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1763 0., 2, false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1764 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1765 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1766 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1767 if (octave::math::isinf (fx))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1768 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
1769 yPlaneN, yPlane, 0.,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1770 octave::math::signum (yPlaneN-yPlane)*fy*zticklen/2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1771 0., 2, mirror);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1772 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1773 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
1774 yPlaneN, yPlaneN,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1775 octave::math::signum (xPlane-xPlaneN)*fx*zticklen/2,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1776 0., 0., 2, false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1777 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1778 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1779
22362
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1780 // tick marks
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1781 if (xySym)
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1782 {
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1783 if (octave::math::isinf (fy))
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1784 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
1785 yPlane, yPlane,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1786 octave::math::signum (xPlaneN-xPlane)*fx*zticklen,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1787 0., 0., 2, mirror);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1788 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1789 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
1790 yPlane, yPlane, 0.,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1791 octave::math::signum (yPlane-yPlaneN)*fy*zticklen,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1792 0., 2, false);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1793 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1794 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1795 {
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1796 if (octave::math::isinf (fx))
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1797 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
1798 yPlaneN, yPlane, 0.,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1799 octave::math::signum (yPlaneN-yPlane)*fy*zticklen,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1800 0., 2, mirror);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1801 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1802 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
1803 yPlaneN, yPlane,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1804 octave::math::signum (xPlane-xPlaneN)*fx*zticklen,
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1805 0., 0., 2, false);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1806 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1807
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1808 // tick texts
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1809 if (zticklabels.numel () > 0)
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1810 {
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1811 int halign = 2;
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1812 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
1813
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1814 if (xySym)
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1815 {
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1816 if (octave::math::isinf (fy))
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1817 render_ticktexts (zticks, zticklabels, z_min, z_max,
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1818 xPlaneN + octave::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
1819 yPlane, 2, halign, valign, wmax, hmax);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1820 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1821 render_ticktexts (zticks, zticklabels, z_min, z_max, xPlaneN,
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1822 yPlane + octave::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
1823 2, halign, valign, wmax, hmax);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1824 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1825 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1826 {
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1827 if (octave::math::isinf (fx))
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1828 render_ticktexts (zticks, zticklabels, z_min, z_max, xPlane,
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1829 yPlaneN + octave::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
1830 2, halign, valign, wmax, hmax);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1831 else
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1832 render_ticktexts (zticks, zticklabels, z_min, z_max,
22711
074765d5c83b Add support in opengl for "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22623
diff changeset
1833 xPlane + octave::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
1834 yPlaneN, 2, halign, valign, wmax, hmax);
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1835 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1836 }
f3ce0015dd42 Draw tick marks in appropriate axes color (OpenGL renderers).
Rik <rik@octave.org>
parents: 22358
diff changeset
1837
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1838 gh_manager::get_object (props.get_zlabel ()).set ("visible", "on");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1839 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1840 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1841 gh_manager::get_object (props.get_zlabel ()).set ("visible", "off");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1842 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1843
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1844 void
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
1845 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
1846 std::list<graphics_object>& obj_list)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1847 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1848 #if defined (HAVE_OPENGL)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1849 Matrix children = props.get_all_children ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1850
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1851 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
1852 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1853 graphics_object go = gh_manager::get_object (children(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1854
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1855 if (go.get_properties ().is_visible ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1856 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1857 if (go.isa ("light"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1858 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1859 if (num_lights < max_lights)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1860 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1861 current_light = GL_LIGHT0 + num_lights;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1862 set_clipping (go.get_properties ().is_clipping ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1863 draw (go);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1864 num_lights++;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1865 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1866 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1867 warning_with_id ("Octave:max-lights-exceeded",
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1868 "light: Maximum number of lights (%d) in these axes is "
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1869 "exceeded.", max_lights);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1870 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1871 else if (go.isa ("hggroup"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1872 draw_all_lights (go.get_properties (), obj_list);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1873 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1874 obj_list.push_back (go);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1875 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1876 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1877 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1878
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1879 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1880 octave_unused_parameter (obj_list);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1881
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1882 // 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
1883 // 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
1884
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1885 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1886
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1887 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1888 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1889
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1890 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1891 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
1892 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1893 #if defined (HAVE_OPENGL)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1894 // list for non-light child objects
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1895 std::list<graphics_object> obj_list;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1896 std::list<graphics_object>::iterator it;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1897
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1898 // 1st pass: draw light objects
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1899
22349
2aac9ec7df29 Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22348
diff changeset
1900 // 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
1901 // 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
1902 // 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
1903 // 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
1904 // Check actual maximum number of lights possible
2aac9ec7df29 Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22348
diff changeset
1905 max_lights = get_maxlights ();
2aac9ec7df29 Do not call GL functions before window is open. (bug #48669)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22348
diff changeset
1906
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1907 // 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
1908 // 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
1909
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1910 num_lights = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1911 draw_all_lights (props, obj_list);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1912
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1913 // disable other OpenGL lights
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1914 for (int i = num_lights; i < max_lights; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1915 glDisable (GL_LIGHT0 + i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1916
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1917 // 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
1918 // other objects
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1919 view_vector = props.get_cameraposition ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1920
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1921 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
1922 ColumnVector ambient_color = props.get_ambientlightcolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1923 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1924 cb[i] = ambient_color(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1925 glLightfv (GL_LIGHT0, GL_AMBIENT, cb);
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 // 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
1928
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1929 it = obj_list.begin ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1930 while (it != obj_list.end ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1931 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1932 graphics_object go = (*it);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1933
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1934 // 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
1935 // to "data"
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1936 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
1937 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1938 set_clipping (go.get_properties ().is_clipping ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1939 draw (go);
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 it = obj_list.erase (it);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1942 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1943 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1944 it++;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1945 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1946
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1947 // 3rd pass: draw remaining objects
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1948
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1949 glDisable (GL_DEPTH_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1950
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1951 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
1952 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1953 graphics_object go = (*it);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1954
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1955 set_clipping (go.get_properties ().is_clipping ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1956 draw (go);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1957 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1958
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1959 glEnable (GL_DEPTH_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1960
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1961 set_clipping (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1962
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1963 // FIXME: finalize rendering (transparency processing)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1964 // 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
1965
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1966 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1967
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1968 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1969
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1970 // 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
1971 // 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
1972
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1973 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
1974
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1975 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1976 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1977
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1978 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1979 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
1980 {
22258
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
1981 #if defined (HAVE_OPENGL)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1982
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1983 // 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
1984 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
1985 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1986
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1987 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
1988
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1989 double x_min = props.get_x_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1990 double x_max = props.get_x_max ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1991 double y_min = props.get_y_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1992 double y_max = props.get_y_max ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1993 double z_min = props.get_z_min ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1994 double z_max = props.get_z_max ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1995
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1996 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
1997 || 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
1998 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1999 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
2000 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2001 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2002
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2003 setup_opengl_transformation (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2004
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2005 // Disable line smoothing for axes
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2006 GLboolean antialias;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2007 glGetBooleanv (GL_LINE_SMOOTH, &antialias);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2008 if (antialias == GL_TRUE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2009 glDisable (GL_LINE_SMOOTH);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2010
22357
8f23b5b23235 Avoid grid overlaying axes box (bug #48842)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22349
diff changeset
2011 set_font (props);
8f23b5b23235 Avoid grid overlaying axes box (bug #48842)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22349
diff changeset
2012 set_interpreter (props.get_ticklabelinterpreter ());
22358
dc73bbd66363 Make sure all lines associated with axes respect axes linewidth property.
Rik <rik@octave.org>
parents: 22357
diff changeset
2013 set_linewidth (props.get_linewidth ());
22357
8f23b5b23235 Avoid grid overlaying axes box (bug #48842)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22349
diff changeset
2014
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2015 // draw axes object
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2016 draw_axes_planes (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2017
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2018 draw_axes_x_grid (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2019 draw_axes_y_grid (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2020 draw_axes_z_grid (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2021
22357
8f23b5b23235 Avoid grid overlaying axes box (bug #48842)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22349
diff changeset
2022 if (props.get_tag () != "legend" || props.get_box () != "off")
8f23b5b23235 Avoid grid overlaying axes box (bug #48842)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22349
diff changeset
2023 draw_axes_boxes (props);
8f23b5b23235 Avoid grid overlaying axes box (bug #48842)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22349
diff changeset
2024
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
2025 set_linestyle ("-"); // Disable LineStipple
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2026
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2027 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
2028
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2029 // Re-enable line smoothing for children
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2030 if (antialias == GL_TRUE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2031 glEnable (GL_LINE_SMOOTH);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2032
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2033 draw_axes_children (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2034
22258
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
2035 #else
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
2036
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2037 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2038
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2039 // 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
2040 // 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
2041
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2042 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
2043
553490ffc203 Fix compile error and warning with '--without-opengl' (bug #48724)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22192
diff changeset
2044 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2045 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2046
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2047 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2048 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
2049 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2050 #if defined (HAVE_OPENGL)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2051
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2052 Matrix x = xform.xscale (props.get_xdata ().matrix_value ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2053 Matrix y = xform.yscale (props.get_ydata ().matrix_value ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2054 Matrix z = xform.zscale (props.get_zdata ().matrix_value ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2055
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2056 bool has_z = (z.numel () > 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2057 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
2058 (has_z ? z.numel ()
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2059 : std::numeric_limits<int>::max ())));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2060 octave_uint8 clip_mask = (props.is_clipping () ? 0x7F : 0x40), clip_ok (0x40);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2061
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2062 std::vector<octave_uint8> clip (n);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2063
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2064 if (has_z)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2065 for (int i = 0; i < n; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2066 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
2067 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2068 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2069 double z_mid = (zmin+zmax)/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2070
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2071 for (int i = 0; i < n; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2072 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
2073 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2074
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2075 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
2076 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2077 set_color (props.get_color_rgb ());
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
2078 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
2079 set_linewidth (props.get_linewidth ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2080
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2081 if (has_z)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2082 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2083 bool flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2084
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2085 for (int i = 1; i < n; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2086 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2087 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
2088 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2089 if (! flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2090 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2091 flag = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2092 glBegin (GL_LINE_STRIP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2093 glVertex3d (x(i-1), y(i-1), z(i-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2094 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2095 glVertex3d (x(i), y(i), z(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2096 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2097 else if (flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2098 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2099 flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2100 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2101 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2102 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2103
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2104 if (flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2105 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2106 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2107 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2108 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2109 bool flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2110
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2111 for (int i = 1; i < n; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2112 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2113 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
2114 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2115 if (! flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2116 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2117 flag = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2118 glBegin (GL_LINE_STRIP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2119 glVertex2d (x(i-1), y(i-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2120 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2121 glVertex2d (x(i), y(i));
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 if (flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2124 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2125 flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2126 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2127 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2128 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2129
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2130 if (flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2131 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2132 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2133
22358
dc73bbd66363 Make sure all lines associated with axes respect axes linewidth property.
Rik <rik@octave.org>
parents: 22357
diff changeset
2134 set_linewidth (0.5f);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2135 set_linestyle ("-");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2136 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2137
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2138 set_clipping (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2139
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2140 if (! props.marker_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2141 && ! (props.markeredgecolor_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2142 && props.markerfacecolor_is ("none")))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2143 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2144 Matrix lc, fc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2145
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2146 if (props.markeredgecolor_is ("auto"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2147 lc = props.get_color_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2148 else if (! props.markeredgecolor_is ("none"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2149 lc = props.get_markeredgecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2150
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2151 if (props.markerfacecolor_is ("auto"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2152 fc = props.get_color_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2153 else if (! props.markerfacecolor_is ("none"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2154 fc = props.get_markerfacecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2155
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2156 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
2157 props.get_linewidth ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2158
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2159 for (int i = 0; i < n; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2160 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2161 if (clip[i] == clip_ok)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2162 draw_marker (x(i), y(i),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2163 has_z ? z(i) : 0.0,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2164 lc, fc);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2165 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2166
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2167 end_marker ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2168 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2169
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2170 set_clipping (props.is_clipping ());
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2171
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2172 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
2173
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2174 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2175
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2176 // 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
2177 // 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
2178
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2179 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
2180
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2181 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2182 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2183
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2184 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2185 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
2186 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2187 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2188
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2189 const Matrix x = xform.xscale (props.get_xdata ().matrix_value ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2190 const Matrix y = xform.yscale (props.get_ydata ().matrix_value ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2191 const Matrix z = xform.zscale (props.get_zdata ().matrix_value ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2192
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2193 int zr = z.rows ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2194 int zc = z.columns ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2195
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2196 NDArray c;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2197 const NDArray n = props.get_vertexnormals ().array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2198
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2199 // FIXME: handle transparency
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2200 Matrix a;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2201
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2202 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
2203 (props.facecolor_is ("flat") ? 1 :
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2204 (props.facecolor_is ("interp") ? 2 :
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2205 (props.facecolor_is ("texturemap") ? 3 : -1))));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2206 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
2207 (props.facelighting_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2208 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
2209 (props.facealpha_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2210 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
2211 (props.edgecolor_is ("flat") ? 1 :
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2212 (props.edgecolor_is ("interp") ? 2 : -1)));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2213 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
2214 (props.edgelighting_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2215 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
2216 (props.edgealpha_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2217 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
2218 (props.backfacelighting_is ("reverselit") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2219
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2220 Matrix fcolor = (fc_mode == TEXTURE ? Matrix (1, 3, 1.0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2221 : props.get_facecolor_rgb ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2222 Matrix ecolor = props.get_edgecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2223
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2224 float as = props.get_ambientstrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2225 float ds = props.get_diffusestrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2226 float ss = props.get_specularstrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2227 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
2228 float scr = props.get_specularcolorreflectance ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2229 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
2230
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2231 opengl_texture tex;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2232
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2233 int i1, i2, j1, j2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2234 bool x_mat = (x.rows () == z.rows ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2235 bool y_mat = (y.columns () == z.columns ());
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 i1 = i2 = j1 = j2 = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2238
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2239 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
2240 c = props.get_color_data ().array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2241
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2242 boolMatrix clip (z.dims (), false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2243
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2244 for (int i = 0; i < zr; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2245 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2246 if (x_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2247 i1 = i;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2248
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2249 for (int j = 0; j < zc; j++)
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 if (y_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2252 j1 = j;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2253
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2254 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
2255 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2256 }
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 if (fa_mode > 0 || ea_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2259 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2260 // FIXME: implement alphadata conversion
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2261 //a = props.get_alpha_data ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2262 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2263
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2264 if (fl_mode > 0 || el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2265 glMaterialf (LIGHT_MODE, GL_SHININESS, se);
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 // FIXME: good candidate for caching,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2268 // 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
2269 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2270 tex = opengl_texture::create (props.get_color_data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2271
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2272 if (! props.facecolor_is ("none"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2273 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2274 if (props.get_facealpha_double () == 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2275 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2276 if (fc_mode == UNIFORM || fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2277 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2278 glColor3dv (fcolor.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2279 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2280 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2281 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2282 cb[i] = as * fcolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2283 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
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 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2286 cb[i] = ds * fcolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2287 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2288
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2289 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2290 cb[i] = ss * (scr + (1-scr) * fcolor(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2291 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2292 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2293 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2294
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2295 if ((fl_mode > 0) && (num_lights > 0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2296 glEnable (GL_LIGHTING);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2297 glShadeModel ((fc_mode == INTERP || fl_mode == GOURAUD) ? GL_SMOOTH
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2298 : GL_FLAT);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2299 set_polygon_offset (true, 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2300 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2301 glEnable (GL_TEXTURE_2D);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2302
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2303 for (int i = 1; i < zc; i++)
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 if (y_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2306 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2307 i1 = i-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2308 i2 = i;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2309 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2310
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2311 for (int j = 1; j < zr; j++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2312 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2313
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2314 if (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
2315 || clip(j-1, i) || clip(j, i))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2316 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2317
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2318 if (fc_mode == FLAT)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2319 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2320 // "flat" only needs color at lower-left vertex
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2321 if (! octave::math::finite (c(j-1,i-1)))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2322 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2323 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2324 else if (fc_mode == INTERP)
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 // "interp" needs valid color at all 4 vertices
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2327 if (! (octave::math::finite (c(j-1, i-1)) && octave::math::finite (c(j, i-1))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2328 && octave::math::finite (c(j-1, i)) && octave::math::finite (c(j, i))))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2329 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2330 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2332 if (x_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2333 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2334 j1 = j-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2335 j2 = j;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2336 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2337
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2338 glBegin (GL_QUADS);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2339
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2340 // Vertex 1
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2341 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2342 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
2343 double (j-1) / (zr-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2344 else if (fc_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2345 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2346 // 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
2347 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2348 cb[k] = c(j-1, i-1, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2349 glColor3fv (cb);
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 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2352 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2353 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2354 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2355 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2356
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2357 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2358 cb[k] = ds * c(j-1, i-1, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2359 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2360
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2361 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2362 cb[k] = ss * (scr + (1-scr) * c(j-1, i-1, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2363 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2364 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2365 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2366 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2367 set_normal (bfl_mode, n, j-1, i-1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2368
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2369 glVertex3d (x(j1,i-1), y(j-1,i1), z(j-1,i-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2370
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2371 // Vertex 2
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2372 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2373 tex.tex_coord (double (i) / (zc-1), double (j-1) / (zr-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2374 else if (fc_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2375 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2376 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2377 cb[k] = c(j-1, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2378 glColor3fv (cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2379
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2380 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2381 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2382 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2383 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2384 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2385
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2386 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2387 cb[k] = ds * c(j-1, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2388 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2389
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2390 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2391 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2392 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2393 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2394 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2395
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2396 if (fl_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2397 set_normal (bfl_mode, n, j-1, i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2398
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2399 glVertex3d (x(j1,i), y(j-1,i2), z(j-1,i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2400
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2401 // Vertex 3
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2402 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2403 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
2404 else if (fc_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2405 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2406 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2407 cb[k] = c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2408 glColor3fv (cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2409
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2410 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2411 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2412 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2413 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2414 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2415
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2416 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2417 cb[k] = ds * c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2418 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2419
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2420 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2421 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2422 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2423 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2424 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2425 if (fl_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2426 set_normal (bfl_mode, n, j, i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2427
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2428 glVertex3d (x(j2,i), y(j,i2), z(j,i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2429
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2430 // Vertex 4
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2431 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2432 tex.tex_coord (double (i-1) / (zc-1), double (j) / (zr-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2433 else if (fc_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2434 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2435 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2436 cb[k] = c(j, i-1, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2437 glColor3fv (cb);
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 if (fl_mode > 0)
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 k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2442 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2443 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2446 cb[k] = ds * c(j, i-1, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2447 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2448
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2449 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2450 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2451 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2454 if (fl_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2455 set_normal (bfl_mode, n, j, i-1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2456
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2457 glVertex3d (x(j2,i-1), y(j,i1), z(j,i-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2458
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2459 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2460 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2461 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2462
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2463 set_polygon_offset (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2464 if (fc_mode == TEXTURE)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2465 glDisable (GL_TEXTURE_2D);
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 if ((fl_mode > 0) && (num_lights > 0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2468 glDisable (GL_LIGHTING);
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 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2471 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2472 // FIXME: implement transparency
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2475
22391
c5da5e5e9846 Fix inconsistent on-screen/printout patch and surface edges (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22369
diff changeset
2476 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
2477 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2478 if (props.get_edgealpha_double () == 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2479 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2480 if (ec_mode == UNIFORM)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2481 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2482 glColor3dv (ecolor.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2483 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2484 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2485 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2486 cb[i] = as * ecolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2487 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2488
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2489 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2490 cb[i] = ds * ecolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2491 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
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 < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2494 cb[i] = ss * (scr + (1-scr) * ecolor(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2495 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2496 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2497 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2498
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2499 if ((el_mode > 0) && (num_lights > 0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2500 glEnable (GL_LIGHTING);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2501 glShadeModel ((ec_mode == INTERP || el_mode == GOURAUD) ? GL_SMOOTH
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2502 : GL_FLAT);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2503
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
2504 set_linestyle (props.get_linestyle (), false,
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
2505 props.get_linewidth ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2506 set_linewidth (props.get_linewidth ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2507
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2508 // Mesh along Y-axis
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 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
2511 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2512 for (int i = 0; i < zc; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2513 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2514 if (y_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2515 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2516 i1 = i-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2517 i2 = i;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2518 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2519
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2520 for (int j = 1; j < zr; j++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2521 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2522 if (clip(j-1,i) || clip(j,i))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2523 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2524
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2525 if (ec_mode == FLAT)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2526 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2527 // "flat" only needs color at lower-left vertex
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2528 if (! octave::math::finite (c(j-1,i)))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2529 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2530 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2531 else if (ec_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2532 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2533 // "interp" needs valid color at both vertices
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2534 if (! (octave::math::finite (c(j-1, i)) && octave::math::finite (c(j, i))))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2535 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2536 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2537
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2538 if (x_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2539 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2540 j1 = j-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2541 j2 = j;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2542 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2543
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2544 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2545
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2546 // Vertex 1
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2547 if (ec_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2548 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2549 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2550 cb[k] = c(j-1, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2551 glColor3fv (cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2552
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2553 if (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2554 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2555 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2556 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2557 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2558
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2559 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2560 cb[k] = ds * c(j-1, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2561 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2562
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2563 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2564 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2565 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2566 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2567 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2568 if (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2569 set_normal (bfl_mode, n, j-1, i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2570
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2571 glVertex3d (x(j1,i), y(j-1,i2), z(j-1,i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2572
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2573 // Vertex 2
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2574 if (ec_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2575 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2576 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2577 cb[k] = c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2578 glColor3fv (cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2579
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2580 if (el_mode > 0)
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2583 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2584 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2587 cb[k] = ds * c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2588 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2589
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2590 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2591 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2592 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2593 }
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 (el_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2596 set_normal (bfl_mode, n, j, 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 glVertex3d (x(j2,i), y(j,i2), z(j,i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2599
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2600 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2601 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2602 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2603 }
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 // Mesh along X-axis
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 (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
2608 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2609 for (int j = 0; j < zr; j++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2610 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2611 if (x_mat)
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 j1 = j-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2614 j2 = j;
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2617 for (int i = 1; i < zc; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2618 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2619 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
2620 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2621
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2622 if (ec_mode == FLAT)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2623 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2624 // "flat" only needs color at lower-left vertex
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2625 if (! octave::math::finite (c(j,i-1)))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2626 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2627 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2628 else if (ec_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2629 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2630 // "interp" needs valid color at both vertices
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2631 if (! (octave::math::finite (c(j, i-1)) && octave::math::finite (c(j, i))))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2632 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2633 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2634
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2635 if (y_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2636 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2637 i1 = i-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2638 i2 = i;
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2641 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2642
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2643 // Vertex 1
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2644 if (ec_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2645 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2646 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2647 cb[k] = c(j, i-1, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2648 glColor3fv (cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2649
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2650 if (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2651 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2652 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2653 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2654 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2657 cb[k] = ds * c(j, i-1, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2658 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2659
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2660 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2661 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2662 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
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 (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2666 set_normal (bfl_mode, n, j, i-1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2667
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2668 glVertex3d (x(j2,i-1), y(j,i1), z(j,i-1));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2669
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2670 // Vertex 2
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2671 if (ec_mode == INTERP)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2672 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2673 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2674 cb[k] = c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2675 glColor3fv (cb);
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 if (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2678 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2679 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2680 cb[k] *= as;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2681 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2682
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2683 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2684 cb[k] = ds * c(j, i, k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2685 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
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 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2688 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2689 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2690 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2691 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2692 if (el_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2693 set_normal (bfl_mode, n, j, i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2694
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2695 glVertex3d (x(j2,i), y(j,i2), z(j,i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2696
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2697 glEnd ();
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2700 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2701
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
2702 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
2703 set_linewidth (0.5f);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2704
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2705 if ((el_mode > 0) && (num_lights > 0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2706 glDisable (GL_LIGHTING);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2707 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2708 else
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 // FIXME: implement transparency
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2711 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2712 }
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 if (! props.marker_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2715 && ! (props.markeredgecolor_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2716 && props.markerfacecolor_is ("none")))
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 // 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
2719 // 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
2720 // and facecolor set to none.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2721
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2722 bool do_edge = ! props.markeredgecolor_is ("none");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2723 bool do_face = ! props.markerfacecolor_is ("none");
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 Matrix mecolor = props.get_markeredgecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2726 Matrix mfcolor = props.get_markerfacecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2727 Matrix cc (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2728
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2729 if (mecolor.is_empty () && props.markeredgecolor_is ("auto"))
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 mecolor = props.get_edgecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2732 do_edge = ! props.edgecolor_is ("none");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2733 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2734
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2735 if (mfcolor.is_empty () && props.markerfacecolor_is ("auto"))
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 mfcolor = props.get_facecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2738 do_face = ! props.facecolor_is ("none");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2739 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2740
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2741 if ((mecolor.is_empty () || mfcolor.is_empty ()) && c.is_empty ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2742 c = props.get_color_data ().array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2743
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2744 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
2745 props.get_linewidth ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2746
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2747 for (int i = 0; i < zc; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2748 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2749 if (y_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2750 i1 = i;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2751
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2752 for (int j = 0; j < zr; j++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2753 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2754 if (clip(j,i))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2755 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2756
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2757 if (x_mat)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2758 j1 = j;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2759
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2760 if ((do_edge && mecolor.is_empty ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2761 || (do_face && mfcolor.is_empty ()))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2762 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2763 if (! octave::math::finite (c(j,i)))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2764 continue; // Skip NaNs in color data
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2765
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2766 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2767 cc(k) = c(j,i,k);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2768 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2769
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2770 Matrix lc = (do_edge ? (mecolor.is_empty () ? cc : mecolor)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2771 : Matrix ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2772 Matrix fc = (do_face ? (mfcolor.is_empty () ? cc : mfcolor)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2773 : Matrix ());
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 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
2776 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2777 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2778
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2779 end_marker ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2780 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2781
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2782 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
2783
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2784 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2785
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2786 // 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
2787 // 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
2788
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2789 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
2790
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2791 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2792 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2793
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2794 // FIXME: global optimization (rendering, data structures...),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2795 // 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
2796 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2797 opengl_renderer::draw_patch (const patch::properties &props)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2798 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2799 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
2800
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2801 // 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
2802 std::string msg;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2803 if (props.has_bad_data (msg))
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 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
2806 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2807 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2808
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2809 const Matrix f = props.get_faces ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2810 const Matrix v = xform.scale (props.get_vertices ().matrix_value ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2811 Matrix c;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2812 const Matrix n = props.get_vertexnormals ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2813 Matrix a;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2814
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2815 int nv = v.rows ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2816 int nf = f.rows ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2817 int fcmax = f.columns ();
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 bool has_z = (v.columns () > 2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2820 bool has_facecolor = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2821 bool has_facealpha = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2822 // FIXME: remove when patch object has normal computation (patch #8951)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2823 bool has_normals = (n.rows () == nv);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2824
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2825 int fc_mode = ((props.facecolor_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2826 || props.facecolor_is_rgb ()) ? 0 :
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2827 (props.facecolor_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2828 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
2829 (props.facelighting_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2830 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
2831 (props.facealpha_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2832 int ec_mode = ((props.edgecolor_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2833 || props.edgecolor_is_rgb ()) ? 0 :
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2834 (props.edgecolor_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2835 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
2836 (props.edgelighting_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2837 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
2838 (props.edgealpha_is ("flat") ? 1 : 2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2839 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
2840 (props.backfacelighting_is ("reverselit") ? 1 : 2));
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 Matrix fcolor = props.get_facecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2843 Matrix ecolor = props.get_edgecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2844
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2845 float as = props.get_ambientstrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2846 float ds = props.get_diffusestrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2847 float ss = props.get_specularstrength ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2848 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
2849 float scr = props.get_specularcolorreflectance ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2850
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2851 boolMatrix clip (1, nv, false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2852
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2853 if (has_z)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2854 for (int i = 0; i < nv; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2855 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
2856 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2857 for (int i = 0; i < nv; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2858 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
2859
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2860 boolMatrix clip_f (1, nf, false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2861 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
2862
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2863 for (int i = 0; i < nf; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2864 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2865 bool fclip = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2866 int count = 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2867
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2868 for (int j = 0; j < fcmax && ! octave::math::isnan (f(i,j)); j++, count++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2869 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
2870
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2871 clip_f(i) = fclip;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2872 count_f(i) = count;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2873 }
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 if (fc_mode > 0 || ec_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2876 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2877 c = props.get_color_data ().matrix_value ();
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 if (c.rows () == 1)
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 // 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
2882
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2883 if (fc_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2884 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2885 fcolor = c;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2886 fc_mode = UNIFORM;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2887 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2888
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2889 if (ec_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2890 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2891 ecolor = c;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2892 ec_mode = UNIFORM;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2893 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2894
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2895 c = Matrix ();
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 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2898 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
2899 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2900
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2901 if (fa_mode > 0 || ea_mode > 0)
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 // FIXME: retrieve alpha data from patch object
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2904 //a = props.get_alpha_data ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2905 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
2906 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2907
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2908 octave_idx_type fr = f.rows ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2909 std::vector<vertex_data> vdata (f.numel ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2910
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2911 for (int i = 0; i < nf; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2912 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
2913 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2914 int idx = int (f(i,j) - 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2915
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2916 Matrix vv (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2917 Matrix cc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2918 Matrix nn (1, 3, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2919 double aa = 1.0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2920
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2921 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
2922 if (has_z)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2923 vv(2) = v(idx,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2924 if (has_normals)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
2925 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2926 double dir = 1.0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2927 if (bfl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2928 dir = ((n(idx,0) * view_vector(0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2929 + n(idx,1) * view_vector(1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2930 + n(idx,2) * view_vector(2) < 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2931 ? ((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
2932 nn(0) = dir * n(idx,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2933 nn(1) = dir * n(idx,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2934 nn(2) = dir * n(idx,2);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
2935 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2936 if (c.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2937 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2938 cc.resize (1, 3);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2939 if (has_facecolor)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2940 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
2941 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2942 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
2943 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2944 if (a.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2945 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2946 if (has_facealpha)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2947 aa = a(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2948 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2949 aa = a(idx);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2950 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2951
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2952 vdata[i+j*fr] = vertex_data (vv, cc, nn, aa, as, ds, ss, se, scr);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
2953 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2954
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2955 if (fl_mode > 0 || el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2956 glMaterialf (LIGHT_MODE, GL_SHININESS, se);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2957
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2958 if (! props.facecolor_is ("none"))
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 // FIXME: adapt to double-radio property
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2961 if (props.get_facealpha_double () == 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2962 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2963 if (fc_mode == UNIFORM)
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 glColor3dv (fcolor.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2966 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2967 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2968 float cb[4] = { 0, 0, 0, 1 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2969
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2970 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2971 cb[i] = as * fcolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2972 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
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 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2975 cb[i] = ds * fcolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2976 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
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 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2979 cb[i] = ss * (scr + (1-scr) * fcolor(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2980 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
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 }
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 if ((fl_mode > 0) && (num_lights > 0) && has_normals)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2985 glEnable (GL_LIGHTING);
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 // NOTE: Push filled part of patch backwards to avoid Z-fighting with
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2988 // tesselator outline. A value of 1.0 seems to work fine. Value
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2989 // can't be too large or the patch will be pushed below the axes
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2990 // planes at +2.5.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2991 patch_tesselator tess (this, fc_mode, fl_mode, 1.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2992
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2993 for (int i = 0; i < nf; i++)
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 if (clip_f(i))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2996 continue;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2997
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2998 tess.begin_polygon (true);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
2999 tess.begin_contour ();
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 // 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
3002 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
3003 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3004 vertex_data::vertex_data_rep *vv = vdata[i+j*fr].get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3005
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3006 tess.add_vertex (vv->coords.fortran_vec (), vv);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3007 }
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 if (count_f(i) > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3010 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3011 vertex_data::vertex_data_rep *vv = vdata[i].get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3012
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3013 if (fc_mode == FLAT)
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 // For "flat" shading, use color of 1st vertex.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3016 Matrix col = vv->color;
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 if (col.numel () == 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3019 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3020 glColor3dv (col.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3021 if (fl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3022 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3023 float cb[4] = { 0, 0, 0, 1 };
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3024
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3025 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3026 cb[k] = (vv->ambient * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3027 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
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] = (vv->diffuse * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3031 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3032
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3033 for (int k = 0; k < 3; k++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3034 cb[k] = vv->specular * (vv->specular_color_refl
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3035 + (1-vv->specular_color_refl) * col(k));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3036 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3037 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3038 }
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3041 tess.add_vertex (vv->coords.fortran_vec (), vv);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3042 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3043
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3044 tess.end_contour ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3045 tess.end_polygon ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3046 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3047
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3048 if ((fl_mode > 0) && (num_lights > 0) && has_normals)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3049 glDisable (GL_LIGHTING);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3050 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3051 else
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 // FIXME: implement transparency
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3054 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3055 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3056
22391
c5da5e5e9846 Fix inconsistent on-screen/printout patch and surface edges (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22369
diff changeset
3057 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
3058 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3059 // FIXME: adapt to double-radio property
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3060 if (props.get_edgealpha_double () == 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3061 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3062 if (ec_mode == UNIFORM)
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 glColor3dv (ecolor.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3065 if (el_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3066 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3067 float cb[4] = { 0, 0, 0, 1 };
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 i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3070 cb[i] = (as * ecolor(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3071 glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3072
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3073 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3074 cb[i] = ds * ecolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3075 glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3076
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3077 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3078 cb[i] = ss * (scr + (1-scr) * ecolor(i));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3079 glMaterialfv (LIGHT_MODE, GL_SPECULAR, cb);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3080 }
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 if ((el_mode > 0) && (num_lights > 0) && has_normals)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3084 glEnable (GL_LIGHTING);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3085
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3086 double linewidth = props.get_linewidth ();
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3087 set_linestyle (props.get_linestyle (), false, linewidth);
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3088 set_linewidth (linewidth);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3089
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3090 // NOTE: patch contour cannot be offset. Offset must occur with the
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3091 // filled portion of the patch above. The tesselator uses
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3092 // 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
3093 // 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
3094 // not supported by glPolygonOffset which is used to do Z offsets.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3095 patch_tesselator tess (this, ec_mode, el_mode);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3096
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3097 for (int i = 0; i < nf; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3098 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3099 if (clip_f(i))
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 // This is an unclosed contour. Draw it as a line.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3102 bool flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3103
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3104 glShadeModel ((ec_mode == INTERP || el_mode == GOURAUD)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3105 ? GL_SMOOTH : GL_FLAT);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3106
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3107 // 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
3108 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
3109 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3110 if (! clip(int (f(i,j) - 1)))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3111 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3112 vertex_data::vertex_data_rep *vv
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3113 = vdata[i+j*fr].get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3114 const Matrix m = vv->coords;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3115 if (! flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3116 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3117 flag = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3118 glBegin (GL_LINE_STRIP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3119 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3120 if (ec_mode != UNIFORM)
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 Matrix col = vv->color;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3123
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3124 if (col.numel () == 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3125 glColor3dv (col.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3126 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3127 glVertex3d (m(0), m(1), m(2));
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 else if (flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3130 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3131 flag = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3132 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3133 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3134 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3135 // 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
3136 // from vertex 0 to vertex N.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3137 int j = count_f(i)-1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3138 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
3139 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3140 vertex_data::vertex_data_rep *vv
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3141 = vdata[i+j*fr].get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3142 const Matrix m = vv->coords;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3143 if (ec_mode != UNIFORM)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3144 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3145 Matrix col = vv->color;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3146
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3147 if (col.numel () == 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3148 glColor3dv (col.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3149 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3150 glVertex3d (m(0), m(1), m(2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3151 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3152
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3153 if (flag)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3154 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3155 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3156 else // Normal edge contour drawn with tesselator
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 tess.begin_polygon (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3159 tess.begin_contour ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3160
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3161 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
3162 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3163 vertex_data::vertex_data_rep *vv
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3164 = vdata[i+j*fr].get_rep ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3165 tess.add_vertex (vv->coords.fortran_vec (), vv);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
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 tess.end_contour ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3169 tess.end_polygon ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3170 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3171 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3172
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3173 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
3174 set_linewidth (0.5f);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3175
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3176 if ((el_mode > 0) && (num_lights > 0) && has_normals)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3177 glDisable (GL_LIGHTING);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3178 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3179 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3180 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3181 // FIXME: implement transparency
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 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3184
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3185 if (! props.marker_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3186 && ! (props.markeredgecolor_is ("none")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3187 && props.markerfacecolor_is ("none")))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3188 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3189 bool do_edge = ! props.markeredgecolor_is ("none");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3190 bool do_face = ! props.markerfacecolor_is ("none");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3191
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3192 Matrix mecolor = props.get_markeredgecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3193 Matrix mfcolor = props.get_markerfacecolor_rgb ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3194
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3195 bool has_markerfacecolor = false;
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 if ((mecolor.is_empty () && ! props.markeredgecolor_is ("none"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3198 || (mfcolor.is_empty () && ! props.markerfacecolor_is ("none")))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3199 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3200 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
3201
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3202 if (mc.rows () == 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3203 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3204 // 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
3205 if (mfcolor.is_empty () && ! props.markerfacecolor_is ("none"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3206 mfcolor = mc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3207
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3208 if (mecolor.is_empty () && ! props.markeredgecolor_is ("none"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3209 mecolor = mc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3210 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3211 else
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 if (c.is_empty ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3214 c = props.get_color_data ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3215 has_markerfacecolor = ((c.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3216 && (c.rows () == f.rows ()));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3217 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3218 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3219
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3220 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
3221 props.get_linewidth ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3222
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3223 for (int i = 0; i < nf; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3224 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
3225 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3226 int idx = int (f(i,j) - 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3227
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3228 if (clip(idx))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3229 continue;
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 cc;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3232 if (c.numel () > 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
3233 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3234 cc.resize (1, 3);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3235 if (has_markerfacecolor)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3236 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
3237 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3238 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
3239 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
3240
20974
1edf15793cac maint: Use is_empty rather than "numel () == 0" for clarity.
Rik <rik@octave.org>
parents: 20955
diff changeset
3241 Matrix lc = (do_edge ? (mecolor.is_empty () ? cc : mecolor)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3242 : Matrix ());
20974
1edf15793cac maint: Use is_empty rather than "numel () == 0" for clarity.
Rik <rik@octave.org>
parents: 20955
diff changeset
3243 Matrix fc = (do_face ? (mfcolor.is_empty () ? cc : mfcolor)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3244 : Matrix ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3245
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3246 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
3247 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3248
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3249 end_marker ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3250 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3251
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3252 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3253
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3254 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3255
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3256 // 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
3257 // 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
3258
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3259 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3260
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3261 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3262 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3263
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3264 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3265 opengl_renderer::draw_light (const light::properties &props)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3266 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3267 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3268
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3269 // enable light source
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3270 glEnable (current_light);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3271
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3272 // light position
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3273 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
3274 Matrix lpos = props.get_position ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3275 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3276 pos[i] = lpos(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3277 if (props.style_is ("local"))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3278 pos[3] = 1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3279 glLightfv (current_light, GL_POSITION, pos);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3280
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3281 // light color
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3282 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
3283 Matrix lcolor = props.get_color ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3284 for (int i = 0; i < 3; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3285 col[i] = lcolor(i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3286 glLightfv (current_light, GL_DIFFUSE, col);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3287 glLightfv (current_light, GL_SPECULAR, col);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3288
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3289 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3290
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3291 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3292
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3293 // 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
3294 // 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
3295
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3296 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3297
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3298 #endif
22331
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3301 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3302 opengl_renderer::draw_hggroup (const hggroup::properties &props)
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 draw (props.get_children ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3305 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3306
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3307 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3308 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
3309 {
21789
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3310 #if defined (HAVE_OPENGL)
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3311
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3312 if (props.get_string ().is_empty ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3313 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3314
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3315 set_font (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3316
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3317 Matrix pos = xform.scale (props.get_data_position ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3318 const Matrix bbox = props.get_extent_matrix ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3319
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3320 // FIXME: handle margin and surrounding box
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3321 bool blend = glIsEnabled (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3322
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3323 glEnable (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3324 glEnable (GL_ALPHA_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3325 glRasterPos3d (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3326 glBitmap (0, 0, 0, 0, bbox(0), bbox(1), 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3327 glDrawPixels (bbox(2), bbox(3),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3328 GL_RGBA, GL_UNSIGNED_BYTE, props.get_pixels ().data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3329 glDisable (GL_ALPHA_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3330 if (! blend)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3331 glDisable (GL_BLEND);
21789
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3332
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3333 #else
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3334
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3335 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3336
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3337 // 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
3338 // 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
3339
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3340 panic_impossible ();
21789
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3341
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
3342 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3343 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3344
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3345 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3346 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
3347 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3348 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3349
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3350 octave_value cdata = props.get_color_data ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3351 dim_vector dv (cdata.dims ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3352 int h = dv(0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3353 int w = dv(1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3354
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3355 Matrix x = props.get_xdata ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3356 Matrix y = props.get_ydata ().matrix_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3357
22369
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22363
diff changeset
3358 // Someone wants us to draw an empty image? No way.
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3359 if (x.is_empty () || y.is_empty ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3360 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3361
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3362 if (w > 1 && x(1) == x(0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3363 x(1) = x(1) + (w-1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3364
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3365 if (h > 1 && y(1) == y(0))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3366 y(1) = y(1) + (h-1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3367
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3368 const ColumnVector p0 = xform.transform (x(0), y(0), 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3369 const ColumnVector p1 = xform.transform (x(1), y(1), 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3370
22369
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22363
diff changeset
3371 if (octave::math::isnan (p0(0)) || octave::math::isnan (p0(1))
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22363
diff changeset
3372 || octave::math::isnan (p1(0)) || octave::math::isnan (p1(1)))
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3373 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3374 warning ("opengl_renderer: image X,Y data too large to draw");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3375 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3376 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3377
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3378 // image pixel size in screen pixel units
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3379 float pix_dx, pix_dy;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3380 // image pixel size in normalized units
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3381 float nor_dx, nor_dy;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3382
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3383 if (w > 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3384 {
22369
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22363
diff changeset
3385 pix_dx = (p1(0) - p0(0)) / (w-1);
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22363
diff changeset
3386 nor_dx = (x(1) - x(0)) / (w-1);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3387 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3388 else
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 const ColumnVector p1w = xform.transform (x(1) + 1, y(1), 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3391 pix_dx = p1w(0) - p0(0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3392 nor_dx = 1;
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3395 if (h > 1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3396 {
22369
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22363
diff changeset
3397 pix_dy = (p1(1) - p0(1)) / (h-1);
17c9cc85842e Fix display of scaled images in OpenGL toolkits (bug #48879).
Rik <rik@octave.org>
parents: 22363
diff changeset
3398 nor_dy = (y(1) - y(0)) / (h-1);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3399 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3400 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3401 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3402 const ColumnVector p1h = xform.transform (x(1), y(1) + 1, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3403 pix_dy = p1h(1) - p0(1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3404 nor_dy = 1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3405 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3406
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3407 // OpenGL won't draw any of the image if its origin is outside the
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3408 // viewport/clipping plane so we must do the clipping ourselves.
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3409
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3410 int j0, j1, i0, i1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3411 j0 = 0, j1 = w;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3412 i0 = 0, i1 = h;
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 float im_xmin = x(0) - nor_dx/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3415 float im_xmax = x(1) + nor_dx/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3416 float im_ymin = y(0) - nor_dy/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3417 float im_ymax = y(1) + nor_dy/2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3418 if (props.is_clipping ()) // clip to axes
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3419 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3420 if (im_xmin < xmin)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3421 j0 += (xmin - im_xmin)/nor_dx + 1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3422 if (im_xmax > xmax)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3423 j1 -= (im_xmax - xmax)/nor_dx;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3424
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3425 if (im_ymin < ymin)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3426 i0 += (ymin - im_ymin)/nor_dy + 1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3427 if (im_ymax > ymax)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3428 i1 -= (im_ymax - ymax)/nor_dy;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3429 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3430 else // clip to viewport
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3431 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3432 GLfloat vp[4];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3433 glGetFloatv (GL_VIEWPORT, vp);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3434 // FIXME: actually add the code to do it!
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3435 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3436
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3437 if (i0 >= i1 || j0 >= j1)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3438 return;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3439
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3440 glPixelZoom (pix_dx, -pix_dy);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3441 glRasterPos3d (im_xmin + nor_dx*j0, im_ymin + nor_dy*i0, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3442
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3443 // by default this is 4
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3444 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3445
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3446 // Expect RGB data
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3447 if (dv.ndims () == 3 && dv(2) == 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3448 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3449 if (cdata.is_double_type ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3450 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3451 const NDArray xcdata = cdata.array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3452
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3453 OCTAVE_LOCAL_BUFFER (GLfloat, a, 3*(j1-j0)*(i1-i0));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3454
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3455 for (int i = i0; i < i1; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3456 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3457 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3458 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3459 a[idx] = xcdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3460 a[idx+1] = xcdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3461 a[idx+2] = xcdata(i,j,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3462 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3463 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3464
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3465 draw_pixels (j1-j0, i1-i0, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3466
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3467 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3468 else if (cdata.is_single_type ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3469 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3470 const FloatNDArray xcdata = cdata.float_array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3471
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3472 OCTAVE_LOCAL_BUFFER (GLfloat, a, 3*(j1-j0)*(i1-i0));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3473
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3474 for (int i = i0; i < i1; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3475 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3476 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3477 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3478 a[idx] = xcdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3479 a[idx+1] = xcdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3480 a[idx+2] = xcdata(i,j,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3481 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3482 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3483
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3484 draw_pixels (j1-j0, i1-i0, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3485
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3486 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3487 else if (cdata.is_uint8_type ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3488 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3489 const uint8NDArray xcdata = cdata.uint8_array_value ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3490
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3491 OCTAVE_LOCAL_BUFFER (GLubyte, a, 3*(j1-j0)*(i1-i0));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3492
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3493 for (int i = i0; i < i1; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3494 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3495 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3496 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3497 a[idx] = xcdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3498 a[idx+1] = xcdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3499 a[idx+2] = xcdata(i,j,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3500 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3501 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3502
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3503 draw_pixels (j1-j0, i1-i0, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3504
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 if (cdata.is_uint16_type ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3507 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3508 const uint16NDArray xcdata = cdata.uint16_array_value ();
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 OCTAVE_LOCAL_BUFFER (GLushort, a, 3*(j1-j0)*(i1-i0));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3511
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3512 for (int i = i0; i < i1; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3513 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3514 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3515 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3516 a[idx] = xcdata(i,j,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3517 a[idx+1] = xcdata(i,j,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3518 a[idx+2] = xcdata(i,j,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3519 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3520 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3521
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3522 draw_pixels (j1-j0, i1-i0, a);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3523
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3524 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3525 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3526 warning ("opengl_renderer: invalid image data type (expected double, single, uint8, or uint16)");
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3527 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3528 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3529 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
3530
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3531 glPixelZoom (1, 1);
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3532
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3533 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3534
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3535 octave_unused_parameter (props);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3536
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3537 // 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
3538 // 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
3539
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3540 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3541
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3542 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3543 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3544
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3545 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3546 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
3547 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3548 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3549
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3550 glViewport (0, 0, w, h);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3551
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3552 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3553
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3554 octave_unused_parameter (w);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3555 octave_unused_parameter (h);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3556
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3557 // 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
3558 // 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
3559
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3560 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3561
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3562 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3563 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3564
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3565 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3566 opengl_renderer::draw_pixels (int width, int height, const float *data)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3567 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3568 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3569
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3570 glDrawPixels (width, height, GL_RGB, GL_FLOAT, data);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3571
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3572 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3573
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3574 octave_unused_parameter (width);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3575 octave_unused_parameter (height);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3576 octave_unused_parameter (data);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3577
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3578 // 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
3579 // 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
3580
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3581 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3582
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3583 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3584 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3585
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3586 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3587 opengl_renderer::draw_pixels (int width, int height, const uint8_t *data)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3588 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3589 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3590
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3591 glDrawPixels (width, height, GL_RGB, GL_UNSIGNED_BYTE, data);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3592
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3593 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3594
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3595 octave_unused_parameter (width);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3596 octave_unused_parameter (height);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3597 octave_unused_parameter (data);
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 // 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
3600 // 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
3601
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3602 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3603
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3604 #endif
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3607 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3608 opengl_renderer::draw_pixels (int width, int height, const uint16_t *data)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3609 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3610 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3611
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3612 glDrawPixels (width, height, GL_RGB, GL_UNSIGNED_SHORT, data);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3613
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3614 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3615
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3616 octave_unused_parameter (width);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3617 octave_unused_parameter (height);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3618 octave_unused_parameter (data);
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 // 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
3621 // 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
3622
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3623 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3624
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3625 #endif
22331
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
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3628 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3629 opengl_renderer::set_color (const Matrix& c)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3630 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3631 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3632
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3633 glColor3dv (c.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3634
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3635 txt_renderer.set_color (c);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3636
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3637 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3638
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3639 octave_unused_parameter (c);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3640
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3641 // 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
3642 // 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
3643
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3644 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3645
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3646 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3647 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3648
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3649 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3650 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
3651 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3652 txt_renderer.set_font (props.get ("fontname").string_value (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3653 props.get ("fontweight").string_value (),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3654 props.get ("fontangle").string_value (),
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22528
diff changeset
3655 props.get ("__fontsize_points__").double_value ());
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3656 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3657
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3658 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3659 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
3660 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3661 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3662
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3663 if (on)
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 glEnable (GL_POLYGON_OFFSET_FILL);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3666 glEnable (GL_POLYGON_OFFSET_LINE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3667 glPolygonOffset (offset, offset);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3668 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3669 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3670 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3671 glDisable (GL_POLYGON_OFFSET_FILL);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3672 glDisable (GL_POLYGON_OFFSET_LINE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3673 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3674
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3675 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3676
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3677 octave_unused_parameter (on);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3678 octave_unused_parameter (offset);
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 // 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
3681 // 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
3682
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3683 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3684
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3685 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3686 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3687
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3688 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3689 opengl_renderer::set_linewidth (float w)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3690 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3691 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3692
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3693 glLineWidth (w);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3694
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3695 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3696
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3697 octave_unused_parameter (w);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3698
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3699 // 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
3700 // 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
3701
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3702 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3703
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3704 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3705 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3706
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3707 void
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3708 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
3709 double linewidth)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3710 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3711 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3712
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3713 bool solid = false;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3714
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3715 if (s == "-")
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3716 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3717 glLineStipple (1, static_cast<unsigned short> (0xFFFF));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3718 solid = true;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3719 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3720 else if (s == ":")
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3721 glLineStipple (linewidth, static_cast<unsigned short> (0x5555));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3722 else if (s == "--")
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3723 glLineStipple (linewidth, static_cast<unsigned short> (0x0F0F));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3724 else if (s == "-.")
22396
52c205a0ad88 Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents: 22393
diff changeset
3725 glLineStipple (linewidth, static_cast<unsigned short> (0x6F6F));
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3726 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3727 glLineStipple (1, static_cast<unsigned short> (0x0000));
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 if (solid && ! use_stipple)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3730 glDisable (GL_LINE_STIPPLE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3731 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3732 glEnable (GL_LINE_STIPPLE);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3733
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3734 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3735
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3736 octave_unused_parameter (s);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3737 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
3738 octave_unused_parameter (linewidth);
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3739
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3740 // 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
3741 // 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
3742
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3743 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3744
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3745 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3746 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3747
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3748 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3749 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
3750 double z1, double z2)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3751 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3752 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3753
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3754 double dx = (x2-x1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3755 double dy = (y2-y1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3756 double dz = (z2-z1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3757
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3758 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
3759 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
3760 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
3761
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3762 ColumnVector p (4, 0.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3763
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3764 p(0) = -1; p(3) = x2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3765 glClipPlane (GL_CLIP_PLANE0, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3766 p(0) = 1; p(3) = -x1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3767 glClipPlane (GL_CLIP_PLANE1, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3768 p(0) = 0; p(1) = -1; p(3) = y2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3769 glClipPlane (GL_CLIP_PLANE2, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3770 p(1) = 1; p(3) = -y1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3771 glClipPlane (GL_CLIP_PLANE3, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3772 p(1) = 0; p(2) = -1; p(3) = z2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3773 glClipPlane (GL_CLIP_PLANE4, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3774 p(2) = 1; p(3) = -z1;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3775 glClipPlane (GL_CLIP_PLANE5, p.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3776
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3777 xmin = x1; xmax = x2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3778 ymin = y1; ymax = y2;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3779 zmin = z1; zmax = z2;
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3780
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3781 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3782
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3783 octave_unused_parameter (x1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3784 octave_unused_parameter (x2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3785 octave_unused_parameter (y1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3786 octave_unused_parameter (y2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3787 octave_unused_parameter (z1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3788 octave_unused_parameter (z2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3789
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3790 // 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
3791 // 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
3792
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3793 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3794
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3795 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3796 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3797
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3798 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3799 opengl_renderer::set_clipping (bool enable)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3800 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3801 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3802
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3803 bool has_clipping = (glIsEnabled (GL_CLIP_PLANE0) == GL_TRUE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3804
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3805 if (enable != has_clipping)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3806 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3807 if (enable)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3808 for (int i = 0; i < 6; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3809 glEnable (GL_CLIP_PLANE0+i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3810 else
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3811 for (int i = 0; i < 6; i++)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3812 glDisable (GL_CLIP_PLANE0+i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3813 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3814
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3815 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3816
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3817 octave_unused_parameter (enable);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3818
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3819 // 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
3820 // 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
3821
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3822 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3823
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3824 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3825 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3826
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3827 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3828 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
3829 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3830 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3831
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3832 # if defined (HAVE_FRAMEWORK_OPENGL)
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3833 GLint vw[4];
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3834 # else
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3835 int vw[4];
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3836 # endif
7825
13871b7de124 Import sources for OpenGL-based renderer.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
3837
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3838 glGetIntegerv (GL_VIEWPORT, vw);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3839
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3840 glMatrixMode (GL_PROJECTION);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3841 glPushMatrix ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3842 glLoadIdentity ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3843 glOrtho (0, vw[2], vw[3], 0, xZ1, xZ2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3844 glMatrixMode (GL_MODELVIEW);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3845 glPushMatrix ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3846
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3847 set_clipping (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3848 set_linewidth (width);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3849
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3850 marker_id = make_marker_list (m, size, false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3851 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
3852
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3853 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3854
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3855 octave_unused_parameter (m);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3856 octave_unused_parameter (size);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3857 octave_unused_parameter (width);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3858
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3859 // 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
3860 // 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
3861
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3862 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3863
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3864 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3865 }
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 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3868 opengl_renderer::end_marker (void)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3869 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3870 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3871
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3872 glDeleteLists (marker_id, 1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3873 glDeleteLists (filled_marker_id, 1);
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 glMatrixMode (GL_MODELVIEW);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3876 glPopMatrix ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3877 glMatrixMode (GL_PROJECTION);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3878 glPopMatrix ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3879 set_linewidth (0.5f);
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3880
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3881 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3882
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3883 // 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
3884 // 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
3885
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3886 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3887
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3888 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3889 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3890
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3891 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3892 opengl_renderer::draw_marker (double x, double y, double z,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3893 const Matrix& lc, const Matrix& fc)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3894 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3895 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3896
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3897 ColumnVector tmp = xform.transform (x, y, z, false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3898
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3899 glLoadIdentity ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3900 glTranslated (tmp(0), tmp(1), -tmp(2));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3901
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3902 if (filled_marker_id > 0 && fc.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3903 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3904 glColor3dv (fc.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3905 set_polygon_offset (true, -1.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3906 glCallList (filled_marker_id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3907 if (lc.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3908 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3909 glColor3dv (lc.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3910 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3911 glEdgeFlag (GL_TRUE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3912 set_polygon_offset (true, -2.0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3913 glCallList (filled_marker_id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3914 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3915 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3916 set_polygon_offset (false);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3917 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3918 else if (marker_id > 0 && lc.numel () > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3919 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3920 glColor3dv (lc.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3921 glCallList (marker_id);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3922 }
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3923
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3924 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3925
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3926 octave_unused_parameter (x);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3927 octave_unused_parameter (y);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3928 octave_unused_parameter (z);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3929 octave_unused_parameter (lc);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3930 octave_unused_parameter (fc);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3931
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3932 // 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
3933 // 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
3934
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3935 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
3936
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3937 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3938 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3939
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3940 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3941 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
3942 {
21797
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
3943 #if defined (HAVE_OPENGL)
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
3944
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3945 double x = n(j,i,0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3946 double y = n(j,i,1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3947 double z = n(j,i,2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3948
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3949 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
3950
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3951 double dir = 1.0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3952
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3953 if (bfl_mode > 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3954 dir = ((x * view_vector(0) + y * view_vector(1) + z * view_vector(2) < 0)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3955 ? ((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
3956
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3957 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
3958
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
3959 #else
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
3960
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3961 octave_unused_parameter (bfl_mode);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3962 octave_unused_parameter (n);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3963 octave_unused_parameter (j);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3964 octave_unused_parameter (i);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3965
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3966 // 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
3967 // 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
3968
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3969 panic_impossible ();
21797
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
3970
e5f083f9704e eliminate some duplicate code in gl-render.cc
John W. Eaton <jwe@octave.org>
parents: 21790
diff changeset
3971 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3972 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3973
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3974 unsigned int
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3975 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
3976 bool filled) const
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3977 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3978 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
3979
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3980 char c = marker[0];
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3981
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3982 if (filled && (c == '+' || c == 'x' || c == '*' || c == '.'))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3983 return 0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3984
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3985 unsigned int ID = glGenLists (1);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3986 double sz = size * toolkit.get_screen_resolution () / 72.0;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3987
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3988 // constants for the * marker
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3989 const double sqrt2d4 = 0.35355339059327;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3990 double tt = sz*sqrt2d4;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3991
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3992 glNewList (ID, GL_COMPILE);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3993
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3994 switch (marker[0])
7851
002b1d8460d2 added some more markers
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7846
diff changeset
3995 {
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3996 case '+':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3997 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3998 glVertex2d (-sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
3999 glVertex2d (sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4000 glVertex2d (0, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4001 glVertex2d (0, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4002 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4003 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4004 case 'x':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4005 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4006 glVertex2d (-sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4007 glVertex2d (sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4008 glVertex2d (-sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4009 glVertex2d (sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4010 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4011 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4012 case '*':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4013 glBegin (GL_LINES);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4014 glVertex2d (-sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4015 glVertex2d (sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4016 glVertex2d (0, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4017 glVertex2d (0, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4018 glVertex2d (-tt, -tt);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4019 glVertex2d (+tt, +tt);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4020 glVertex2d (-tt, +tt);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4021 glVertex2d (+tt, -tt);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4022 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4023 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4024 case '.':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4025 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4026 // 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
4027
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4028 // 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
4029 if (sz > 0 && sz < 3)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4030 sz = 3;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4031
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4032 int div = static_cast <int> (M_PI * sz / 12);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4033 if (! (div % 2))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4034 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
4035 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
4036 double ang_step = M_PI / div;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4037
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4038 glBegin (GL_POLYGON);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4039 for (double ang = 0; ang < 2*M_PI; ang += ang_step)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4040 glVertex2d (sz/6*cos (ang), sz/6*sin (ang));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4041 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4042 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4043 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4044 case 's':
22268
a54d6b9c08bc Fix badly drawn 'o' and '.' markers at small and large sizes (OpenGL).
Rik <rik@octave.org>
parents: 22258
diff changeset
4045 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
4046 glVertex2d (-sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4047 glVertex2d (-sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4048 glVertex2d (sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4049 glVertex2d (sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4050 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4051 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4052 case 'o':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4053 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4054 int div = static_cast <int> (M_PI * sz / 4);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4055 if (! (div % 2))
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4056 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
4057 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
4058 double ang_step = M_PI / div;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4059
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4060 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4061 for (double ang = 0; ang < 2*M_PI; ang += ang_step)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4062 glVertex2d (sz/2*cos (ang), sz/2*sin (ang));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4063 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4064 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4065 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4066 case 'd':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4067 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4068 glVertex2d (0, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4069 glVertex2d (sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4070 glVertex2d (0, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4071 glVertex2d (-sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4072 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4073 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4074 case 'v':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4075 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4076 glVertex2d (0, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4077 glVertex2d (sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4078 glVertex2d (-sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4079 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4080 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4081 case '^':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4082 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4083 glVertex2d (0, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4084 glVertex2d (-sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4085 glVertex2d (sz/2, sz/2);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10202
diff changeset
4086 glEnd ();
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4087 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4088 case '>':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4089 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4090 glVertex2d (sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4091 glVertex2d (-sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4092 glVertex2d (-sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4093 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4094 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4095 case '<':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4096 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4097 glVertex2d (-sz/2, 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4098 glVertex2d (sz/2, -sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4099 glVertex2d (sz/2, sz/2);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4100 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4101 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4102 case 'p':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4103 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4104 double ang, r, dr;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4105 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
4106
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4107 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4108 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
4109 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4110 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
4111 r = 1.0 - (dr * fmod (double (i+1), 2.0));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4112 glVertex2d (sz/2*r*cos (ang), sz/2*r*sin (ang));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4113 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4114 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4115 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4116 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4117 case 'h':
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4118 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4119 double ang, r, dr;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4120 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
4121
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4122 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4123 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
4124 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4125 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
4126 r = 1.0 - (dr * fmod (double (i+1), 2.0));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4127 glVertex2d (sz/2*r*cos (ang), sz/2*r*sin (ang));
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4128 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4129 glEnd ();
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4130 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4131 break;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4132 default:
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4133 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
4134 break;
7851
002b1d8460d2 added some more markers
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7846
diff changeset
4135 }
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4136
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4137 glEndList ();
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 return ID;
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4140
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4141 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4142
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4143 octave_unused_parameter (marker);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4144 octave_unused_parameter (size);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4145 octave_unused_parameter (filled);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4146
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4147 // 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
4148 // 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
4149
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4150 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4151
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4152 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4153 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4154
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4155 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4156 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
4157 uint8NDArray& pixels,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4158 Matrix& bbox,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4159 int halign, int valign, double rotation)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4160 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4161 txt_renderer.text_to_pixels (txt, pixels, bbox, halign, valign,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4162 rotation, interpreter);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4163 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4164
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4165 void
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4166 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
4167 std::list<text_renderer::string>& lst,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4168 Matrix& bbox,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4169 int halign, int valign, double rotation)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4170 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4171 txt_renderer.text_to_strlist (txt, lst, bbox, halign, valign,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4172 rotation, interpreter);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4173 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4174
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4175 Matrix
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4176 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
4177 double x, double y, double z,
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4178 int halign, int valign, double rotation)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4179 {
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4180 #if defined (HAVE_OPENGL)
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4181
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4182 Matrix bbox (1, 4, 0.0);
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 if (txt.empty ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4185 return bbox;
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 if (txt_renderer.ok ())
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4188 {
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4189 uint8NDArray pixels;
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4190 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
4191
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4192 bool blend = glIsEnabled (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4193
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4194 glEnable (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4195 glEnable (GL_ALPHA_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4196 glRasterPos3d (x, y, z);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4197 glBitmap(0, 0, 0, 0, bbox(0), bbox(1), 0);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4198 glDrawPixels (bbox(2), bbox(3),
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4199 GL_RGBA, GL_UNSIGNED_BYTE, pixels.data ());
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4200 glDisable (GL_ALPHA_TEST);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4201
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4202 if (! blend)
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4203 glDisable (GL_BLEND);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4204 }
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4205
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
4206 return bbox;
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
4207
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4208 #else
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4209
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4210 octave_unused_parameter (txt);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4211 octave_unused_parameter (x);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4212 octave_unused_parameter (y);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4213 octave_unused_parameter (z);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4214 octave_unused_parameter (halign);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4215 octave_unused_parameter (valign);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4216 octave_unused_parameter (rotation);
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4217
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4218 // 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
4219 // 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
4220
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4221 panic_impossible ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21689
diff changeset
4222
21353
e4fc19d8c6c3 remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
4223 #endif
22331
b81b08cc4c83 maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
4224 }
9403
4af6e29449c1 [mq]: graphics_text_engine
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
4225 }
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22396
diff changeset
4226