26#if defined (HAVE_CONFIG_H)
34#if defined (HAVE_WINDOWS_H)
35# define WIN32_LEAN_AND_MEAN
51#if defined (HAVE_OPENGL)
54next_power_of_2 (
int n)
58 while (m < n && m < std::numeric_limits<int>::max ())
64#define LIGHT_MODE GL_FRONT_AND_BACK
94#if ! defined (CALLBACK)
107 : m_glfcns (glfcns), m_id (), m_w (), m_h (), m_tw (), m_th (),
108 m_tx (), m_ty (), m_valid (
false)
113 : m_glfcns (glfcns), m_id (
id), m_w (w), m_h (h), m_tw (tw), m_th (th),
114 m_tx (
double(m_w)/m_tw), m_ty (
double(m_h)/m_th), m_valid (
true)
117 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (texture_rep)
122 m_glfcns.glDeleteTextures (1, &m_id);
125 void bind (
int mode)
const
128 m_glfcns.glBindTexture (mode, m_id);
131 void tex_coord (
double q,
double r)
const
134 m_glfcns.glTexCoord2d (q*m_tx, r*m_ty);
147 opengl_texture () =
delete;
150 : m_rep (
new texture_rep (glfcns))
155 : m_rep (
new texture_rep (glfcns,
id, w, h, tw, th))
158 OCTAVE_DEFAULT_COPY_DELETE (opengl_texture)
163 void bind (
int mode = GL_TEXTURE_2D)
const { m_rep->bind (mode); }
165 void tex_coord (
double q,
double r)
const { m_rep->tex_coord (q, r); }
167 bool is_valid ()
const {
return m_rep->m_valid; }
171 opengl_texture (
const std::shared_ptr<texture_rep>& new_rep)
175 std::shared_ptr<texture_rep> m_rep;
181 opengl_texture retval (glfcns);
186 if (dv.
ndims () == 3 && (dv(2) == 3 || dv(2) == 4))
191 h = dv(0),
w = dv(1);
196 glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_size);
197 static bool warned =
false;
198 if (h > max_size || w > max_size)
202 warning (
"opengl_texture::create: the opengl library in use "
203 "doesn't support images with either dimension larger "
204 "than %d. Not rendering.", max_size);
208 return opengl_texture (glfcns);
214 tw = next_power_of_2 (w);
215 th = next_power_of_2 (h);
226 for (
int i = 0; i < h; i++)
228 for (
int j = 0, idx = i*tw*3; j <
w; j++, idx += 3)
230 a[idx] = xdata(i, j, 0);
231 a[idx+1] = xdata(i, j, 1);
232 a[idx+2] = xdata(i, j, 2);
236 glfcns.
glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB,
246 for (
int i = 0; i < h; i++)
248 for (
int j = 0, idx = i*tw*3; j <
w; j++, idx += 3)
250 a[idx] = xdata(i, j, 0);
251 a[idx+1] = xdata(i, j, 1);
252 a[idx+2] = xdata(i, j, 2);
256 glfcns.
glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB,
265 for (
int i = 0; i < h; i++)
267 for (
int j = 0, idx = i*tw*3; j <
w; j++, idx += 3)
269 a[idx] = xdata(i, j, 0);
270 a[idx+1] = xdata(i, j, 1);
271 a[idx+2] = xdata(i, j, 2);
276 GL_RGB, GL_UNSIGNED_SHORT, a);
284 for (
int i = 0; i < h; i++)
286 for (
int j = 0, idx = i*tw*3; j <
w; j++, idx += 3)
288 a[idx] = xdata(i, j, 0);
289 a[idx+1] = xdata(i, j, 1);
290 a[idx+2] = xdata(i, j, 2);
295 GL_RGB, GL_UNSIGNED_BYTE, a);
303 for (
int i = 0; i < h; i++)
305 for (
int j = 0, idx = i*tw*4; j <
w; j++, idx += 4)
307 a[idx] = xdata(i, j, 0);
308 a[idx+1] = xdata(i, j, 1);
309 a[idx+2] = xdata(i, j, 2);
310 a[idx+3] = xdata(i, j, 3);
314 glfcns.
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0,
315 GL_RGBA, GL_UNSIGNED_BYTE, a);
320 warning (
"opengl_texture::create: invalid image data type, expected double, single, uint8, or uint16");
331 warning (
"opengl_texture::create: OpenGL error while generating texture data");
333 retval = opengl_texture (glfcns,
id, w, h, tw, th);
337 warning (
"opengl_texture::create: invalid texture data size");
342class opengl_tessellator
345#if defined (HAVE_FRAMEWORK_OPENGL) && defined (HAVE_GLUTESSCALLBACK_THREEDOTS)
346 typedef GLvoid (
CALLBACK *fcn) (...);
353 opengl_tessellator () : m_glu_tess (nullptr), m_fill () { init (); }
355 OCTAVE_DISABLE_COPY_MOVE (opengl_tessellator)
357 virtual ~opengl_tessellator ()
358 {
if (m_glu_tess) gluDeleteTess (m_glu_tess); }
360 void begin_polygon (
bool filled =
true)
362 gluTessProperty (m_glu_tess, GLU_TESS_BOUNDARY_ONLY,
363 (filled ? GL_FALSE : GL_TRUE));
365 gluTessBeginPolygon (m_glu_tess,
this);
368 void end_polygon ()
const
369 { gluTessEndPolygon (m_glu_tess); }
371 void begin_contour ()
const
372 { gluTessBeginContour (m_glu_tess); }
374 void end_contour ()
const
375 { gluTessEndContour (m_glu_tess); }
377 void add_vertex (
double *loc,
void *data)
const
378 { gluTessVertex (m_glu_tess, loc, data); }
381 virtual void begin (GLenum ) { }
383 virtual void end () { }
385 virtual void vertex (
void * ) { }
387 virtual void combine (GLdouble [3] ,
void *[4] ,
388 GLfloat [4] ,
void ** ) { }
390 virtual void edge_flag (GLboolean ) { }
392 virtual void error (GLenum err)
393 { ::error (
"OpenGL tessellation error (%d)", err); }
397 m_glu_tess = gluNewTess ();
399 gluTessCallback (m_glu_tess, GLU_TESS_BEGIN_DATA,
400 reinterpret_cast<fcn
> (tess_begin));
401 gluTessCallback (m_glu_tess, GLU_TESS_END_DATA,
402 reinterpret_cast<fcn
> (tess_end));
403 gluTessCallback (m_glu_tess, GLU_TESS_VERTEX_DATA,
404 reinterpret_cast<fcn
> (tess_vertex));
405 gluTessCallback (m_glu_tess, GLU_TESS_COMBINE_DATA,
406 reinterpret_cast<fcn
> (tess_combine));
407 gluTessCallback (m_glu_tess, GLU_TESS_EDGE_FLAG_DATA,
408 reinterpret_cast<fcn
> (tess_edge_flag));
409 gluTessCallback (m_glu_tess, GLU_TESS_ERROR_DATA,
410 reinterpret_cast<fcn
> (tess_error));
413 bool is_filled ()
const {
return m_fill; }
416 static void CALLBACK tess_begin (GLenum type,
void *t)
417 {
reinterpret_cast<opengl_tessellator *
> (t)->begin (type); }
419 static void CALLBACK tess_end (
void *t)
420 {
reinterpret_cast<opengl_tessellator *
> (t)->end (); }
422 static void CALLBACK tess_vertex (
void *v,
void *t)
423 {
reinterpret_cast<opengl_tessellator *
> (t)->vertex (v); }
425 static void CALLBACK tess_combine (GLdouble c[3],
void *v[4], GLfloat w[4],
427 {
reinterpret_cast<opengl_tessellator *
> (t)->combine (c, v, w, out); }
429 static void CALLBACK tess_edge_flag (GLboolean flag,
void *t)
430 {
reinterpret_cast<opengl_tessellator *
> (t)->edge_flag (flag); }
432 static void CALLBACK tess_error (GLenum err,
void *t)
433 {
reinterpret_cast<opengl_tessellator *
> (t)->error (err); }
437 GLUtesselator *m_glu_tess;
445 class vertex_data_rep
450 : m_coords (), m_color (), m_vertex_normal (), m_face_normal (),
451 m_alpha (), m_ambient (), m_diffuse (), m_specular (),
452 m_specular_exp (), m_specular_color_refl ()
456 const Matrix& fn,
double a,
float as,
float ds,
float ss,
458 : m_coords (c), m_color (col), m_vertex_normal (vn),
459 m_face_normal (fn), m_alpha (a), m_ambient (as), m_diffuse (ds),
460 m_specular (ss), m_specular_exp (se), m_specular_color_refl (scr)
463 OCTAVE_DEFAULT_COPY (vertex_data_rep)
465 ~vertex_data_rep () =
default;
475 float m_specular_exp;
476 float m_specular_color_refl;
482 vertex_data () : m_rep (nil_rep ()) { }
485 const Matrix& fn,
double a,
float as,
float ds,
float ss,
487 : m_rep (new vertex_data_rep (c, col, vn, fn, a, as, ds, ss, se, scr))
490 vertex_data (
const vertex_data&) =
default;
492 ~vertex_data () =
default;
494 vertex_data& operator = (
const vertex_data&) =
default;
496 vertex_data_rep * get_rep ()
const {
return m_rep.get (); }
500 static std::shared_ptr<vertex_data_rep> nil_rep ()
502 static std::shared_ptr<vertex_data_rep> nr (
new vertex_data_rep ());
507 std::shared_ptr<vertex_data_rep> m_rep;
510class opengl_renderer::patch_tessellator :
public opengl_tessellator
516 : opengl_tessellator (), m_renderer (r),
517 m_color_mode (cmode), m_light_mode (lmode), m_face_lighting (fl),
518 m_index (idx), m_first (true), m_tmp_vdata ()
521 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (patch_tessellator)
523 ~patch_tessellator () =
default;
526 void begin (GLenum type)
539 m_renderer->set_polygon_offset (
true, m_index);
550 m_renderer->set_polygon_offset (
false);
553 void vertex (
void *data)
557 vertex_data::vertex_data_rep *v
558 =
reinterpret_cast<vertex_data::vertex_data_rep *
> (data);
564 if (m_color_mode ==
INTERP || (m_color_mode ==
FLAT && ! is_filled ()))
568 if (col.
numel () == 3)
570 glfcns.
glColor4d (col(0), col(1), col(2), v->m_alpha);
571 if (m_light_mode > 0)
574 float buf[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
577 for (
int k = 0; k < 3; k++)
578 buf[k] = (v->m_specular
579 * (v->m_specular_color_refl +
580 (1 - v->m_specular_color_refl) * col(k)));
584 for (
int k = 0; k < 3; k++)
585 buf[k] = (v->m_diffuse * col(k));
588 for (
int k = 0; k < 3; k++)
589 buf[k] = (v->m_ambient * col(k));
595 if (m_light_mode ==
FLAT && m_first)
597 else if (m_light_mode ==
GOURAUD)
605 void combine (GLdouble xyz[3],
void *data[4], GLfloat w[4],
void **out_data)
607 vertex_data::vertex_data_rep *v[4];
610 for (
int i = 0; i < 4; i++)
612 v[i] =
reinterpret_cast<vertex_data::vertex_data_rep *
> (data[i]);
614 if (vmax == 4 && ! v[i])
628 if (v[0]->m_color.numel ())
631 for (
int ic = 0; ic < 3; ic++)
632 for (
int iv = 0; iv < vmax; iv++)
633 cc(ic) += (
w[iv] * v[iv]->m_color (ic));
636 if (v[0]->m_vertex_normal.numel () > 0)
638 for (
int in = 0; in < 3; in++)
639 for (
int iv = 0; iv < vmax; iv++)
640 vnn(in) += (
w[iv] * v[iv]->m_vertex_normal (in));
643 if (v[0]->m_face_normal.numel () > 0)
645 for (
int in = 0; in < 3; in++)
646 for (
int iv = 0; iv < vmax; iv++)
647 fnn(in) += (
w[iv] * v[iv]->m_face_normal (in));
650 for (
int iv = 0; iv < vmax; iv++)
651 aa += (w[iv] * v[iv]->m_alpha);
653 vertex_data new_v (vv, cc, vnn, fnn, aa, v[0]->m_ambient, v[0]->m_diffuse,
654 v[0]->m_specular, v[0]->m_specular_exp,
655 v[0]->m_specular_color_refl);
656 m_tmp_vdata.push_back (new_v);
658 *out_data = new_v.get_rep ();
668 bool m_face_lighting;
671 std::list<vertex_data> m_tmp_vdata;
676class opengl_renderer::patch_tessellator
681OCTAVE_NORETURN
static void
682error_unexpected (
const char *name)
684 error (
"unexpected call to %s when HAVE_OPENGL is not defined - please report this bug", name);
690 : m_glfcns (glfcns), m_xmin (), m_xmax (), m_ymin (), m_ymax (),
691 m_zmin (), m_zmax (), m_devpixratio (1.0), m_xform (), m_toolkit (),
692 m_xZ1 (), m_xZ2 (), m_marker_id (), m_filled_marker_id (),
693 m_camera_pos (), m_camera_dir (), m_view_vector (),
694 m_interpreter (
"none"), m_txt_renderer (), m_current_light (0),
695 m_max_lights (0), m_selecting (false), m_printing (false)
701#if defined (HAVE_OPENGL)
706 static bool ok = (
sizeof (
int) <=
sizeof (GLsizei));
709 error (
"the size of GLsizei is smaller than the size of int");
721 if (! go.valid_object ())
724 const base_properties& props = go.get_properties ();
727 m_toolkit = props.get_toolkit ();
729 if (go.isa (
"figure"))
730 draw_figure (
dynamic_cast<const figure::properties&
> (props));
731 else if (go.isa (
"axes"))
732 draw_axes (
dynamic_cast<const axes::properties&
> (props));
733 else if (go.isa (
"line"))
734 draw_line (
dynamic_cast<const line::properties&
> (props));
735 else if (go.isa (
"surface"))
736 draw_surface (
dynamic_cast<const surface::properties&
> (props));
737 else if (go.isa (
"patch"))
738 draw_patch (
dynamic_cast<const patch::properties&
> (props));
739 else if (go.isa (
"scatter"))
740 draw_scatter (
dynamic_cast<const scatter::properties&
> (props));
741 else if (go.isa (
"light"))
742 draw_light (
dynamic_cast<const light::properties&
> (props));
743 else if (go.isa (
"hggroup"))
744 draw_hggroup (
dynamic_cast<const hggroup::properties&
> (props));
745 else if (go.isa (
"text"))
746 draw_text (
dynamic_cast<const text::properties&
> (props));
747 else if (go.isa (
"image"))
748 draw_image (
dynamic_cast<const image::properties&
> (props));
749 else if (go.isa (
"uimenu") || go.isa (
"uicontrol")
750 || go.isa (
"uicontextmenu") || go.isa (
"uitoolbar")
751 || go.isa (
"uipushtool") || go.isa (
"uitoggletool")
752 || go.isa (
"uitable"))
754 else if (go.isa (
"uipanel"))
757 draw_uipanel (
dynamic_cast<const uipanel::properties&
> (props), go);
759 else if (go.isa (
"uibuttongroup"))
766 warning (
"opengl_renderer: cannot render object of type '%s'",
767 props.graphics_object_name ().c_str ());
770#if defined (HAVE_OPENGL)
774 warning (
"opengl_renderer: Error '%s' (%d) occurred drawing '%s' object",
775 gluErrorString (gl_error), gl_error,
776 props.graphics_object_name ().c_str ());
784 m_printing = props.is___printing__ ();
787 init_gl_context (props.is_graphicssmoothing (), props.get_color_rgb ());
789#if defined (HAVE_OPENGL)
791 props.set___gl_extensions__ (get_string (GL_EXTENSIONS));
792 props.set___gl_renderer__ (get_string (GL_RENDERER));
793 props.set___gl_vendor__ (get_string (GL_VENDOR));
794 props.set___gl_version__ (get_string (GL_VERSION));
800 draw (props.get_all_children (),
false);
805 const graphics_object& go)
807 graphics_object fig = go.get_ancestor (
"figure");
808 const figure::properties& figProps
809 =
dynamic_cast<const figure::properties&
> (fig.get_properties ());
814 props.get_backgroundcolor_rgb ());
818 draw (props.get_all_children (),
false);
823 const graphics_object& go)
825 graphics_object fig = go.get_ancestor (
"figure");
826 const figure::properties& figProps
827 =
dynamic_cast<const figure::properties&
> (fig.get_properties ());
832 props.get_backgroundcolor_rgb ());
836 draw (props.get_all_children (),
false);
842#if defined (HAVE_OPENGL)
848#if defined (HAVE_GLBLENDFUNCSEPARATE)
849 std::string gl_version = get_string (GL_VERSION);
850 if (gl_version.size() >= 3 && gl_version.substr(0, 3) >=
"1.4")
851 m_glfcns.glBlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
852 GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
864 bool has_multisample =
false;
867 GLint iMultiSample, iNumSamples;
870 if (iMultiSample == GL_TRUE && iNumSamples > 0)
871 has_multisample =
true;
874 if (! has_multisample)
901 warning (
"opengl_renderer: Error '%s' (%d) occurred in init_gl_context",
902 gluErrorString (gl_error), gl_error);
906 octave_unused_parameter (enhanced);
907 octave_unused_parameter (c);
912 error_unexpected (
"opengl_renderer::init_gl_context");
919 const std::string& gridstyle,
920 const Matrix& gridcolor,
const double gridalpha,
921 const Matrix& ticks,
double lim1,
double lim2,
922 double p1,
double p1N,
double p2,
double p2N,
925#if defined (HAVE_OPENGL)
930 for (
int i = 0; i < ticks.
numel (); i++)
932 double val = ticks(i);
933 if (lim1 <= val && val <= lim2)
966 double black[3] = {0, 0, 0};
971 octave_unused_parameter (linewidth);
972 octave_unused_parameter (gridstyle);
973 octave_unused_parameter (gridcolor);
974 octave_unused_parameter (gridalpha);
975 octave_unused_parameter (ticks);
976 octave_unused_parameter (lim1);
977 octave_unused_parameter (lim2);
978 octave_unused_parameter (p1);
979 octave_unused_parameter (p1N);
980 octave_unused_parameter (p2);
981 octave_unused_parameter (p2N);
982 octave_unused_parameter (xyz);
983 octave_unused_parameter (is_3D);
988 error_unexpected (
"opengl_renderer::render_grid");
995 double lim1,
double lim2,
996 double p1,
double p1N,
997 double p2,
double p2N,
998 double dx,
double dy,
double dz,
999 int xyz,
bool mirror,
bool tickdir_both)
1001#if defined (HAVE_OPENGL)
1005 for (
int i = 0; i < ticks.
numel (); i++)
1007 double val = ticks(i);
1009 if (lim1 <= val && val <= lim2)
1014 p2 + (tickdir_both ? -dz : 0));
1019 p2N + (tickdir_both ? dz : 0));
1026 p2 + (tickdir_both ? -dz : 0));
1031 p2N + (tickdir_both ? dz : 0));
1038 p2 + (tickdir_both ? -dy : 0), val);
1043 p2N + (tickdir_both ? dy : 0), val);
1054 octave_unused_parameter (ticks);
1055 octave_unused_parameter (lim1);
1056 octave_unused_parameter (lim2);
1057 octave_unused_parameter (p1);
1058 octave_unused_parameter (p1N);
1059 octave_unused_parameter (p2);
1060 octave_unused_parameter (p2N);
1061 octave_unused_parameter (dx);
1062 octave_unused_parameter (dy);
1063 octave_unused_parameter (dz);
1064 octave_unused_parameter (xyz);
1065 octave_unused_parameter (mirror);
1066 octave_unused_parameter (tickdir_both);
1071 error_unexpected (
"opengl_renderer::render_tickmarks");
1079 double lim1,
double lim2,
1080 double p1,
double p2,
1081 int xyz,
int ha,
int va,
1082 int& wmax,
int& hmax)
1084#if defined (HAVE_OPENGL)
1086 int nticks = ticks.
numel ();
1087 int nlabels = ticklabels.
numel ();
1092 for (
int i = 0; i < nticks; i++)
1094 double val = ticks(i);
1096 if (lim1 <= val && val <= lim2)
1100 std::string label (ticklabels(i % nlabels));
1117 wmax = std::max (wmax,
static_cast<int> (b(2)));
1118 hmax = std::max (hmax,
static_cast<int> (b(3)));
1124 octave_unused_parameter (ticks);
1125 octave_unused_parameter (ticklabels);
1126 octave_unused_parameter (lim1);
1127 octave_unused_parameter (lim2);
1128 octave_unused_parameter (p1);
1129 octave_unused_parameter (p2);
1130 octave_unused_parameter (xyz);
1131 octave_unused_parameter (ha);
1132 octave_unused_parameter (va);
1133 octave_unused_parameter (wmax);
1134 octave_unused_parameter (hmax);
1139 error_unexpected (
"opengl_renderer::render_ticktexts");
1147#if defined (HAVE_OPENGL)
1157 octave_unused_parameter (x1);
1158 octave_unused_parameter (x2);
1159 octave_unused_parameter (y1);
1160 octave_unused_parameter (y2);
1165 error_unexpected (
"opengl_renderer::draw_zoom_rect");
1172 int x1,
int y1,
int x2,
int y2,
1173 const Matrix& overlaycolor,
1174 double overlayalpha,
1175 const Matrix& bordercolor,
1176 double borderalpha,
double borderwidth)
1178#if defined (HAVE_OPENGL)
1215 octave_unused_parameter (width);
1216 octave_unused_parameter (height);
1217 octave_unused_parameter (x1);
1218 octave_unused_parameter (x2);
1219 octave_unused_parameter (y1);
1220 octave_unused_parameter (y2);
1221 octave_unused_parameter (overlaycolor);
1222 octave_unused_parameter (overlayalpha);
1223 octave_unused_parameter (bordercolor);
1224 octave_unused_parameter (borderalpha);
1225 octave_unused_parameter (borderwidth);
1230 error_unexpected (
"opengl_renderer::draw_zoom_box");
1238#if defined (HAVE_OPENGL)
1253 idx(0) = idx_vector::make_range (height - 1, -1, height);
1254 idx(1) = idx_vector::colon;
1255 idx(2) = idx_vector::colon;
1257 return pix.
permute (perm).index (idx);
1264 octave_unused_parameter (width);
1265 octave_unused_parameter (height);
1267 error_unexpected (
"opengl_renderer::get_pixels");
1275#if defined (HAVE_OPENGL)
1284 error_unexpected (
"opengl_renderer::finish");
1292#if defined (HAVE_OPENGL)
1296 Matrix x_zlim = props.get_transform_zlim ();
1300 const double expansion_fac = 100.0;
1304 const double single_prec_fac = 10.0;
1306 double avgZ = x_zlim(0) / 2.0 + x_zlim(1) / 2.0;
1308 = std::max (expansion_fac * (x_zlim(1)-x_zlim(0)),
1309 single_prec_fac * std::abs (avgZ)
1310 * std::numeric_limits<float>::epsilon ());
1311 m_xZ1 = avgZ - span;
1312 m_xZ2 = avgZ + span;
1314 Matrix x_mat1 = props.get_opengl_matrix_1 ();
1315 Matrix x_mat2 = props.get_opengl_matrix_2 ();
1333 m_xform = props.get_transform ();
1337 octave_unused_parameter (props);
1342 error_unexpected (
"opengl_renderer::setup_opengl_transformation");
1348opengl_renderer::draw_axes_planes (
const axes::properties& props)
1350#if defined (HAVE_OPENGL)
1352 Matrix axe_color = props.get_color_rgb ();
1353 if (axe_color.
isempty () || ! props.is_visible ())
1356 double xPlane = props.get_xPlane ();
1357 double yPlane = props.get_yPlane ();
1358 double zPlane = props.get_zPlane ();
1359 double xPlaneN = props.get_xPlaneN ();
1360 double yPlaneN = props.get_yPlaneN ();
1361 double zPlaneN = props.get_zPlaneN ();
1362 bool is2D = props.get_is2D ();
1397 octave_unused_parameter (props);
1402 error_unexpected (
"opengl_renderer::draw_axes_planes");
1408opengl_renderer::draw_axes_boxes (
const axes::properties& props)
1410#if defined (HAVE_OPENGL)
1412 if (! props.is_visible ())
1415 bool xySym = props.get_xySym ();
1416 bool layer2Dtop = props.get_layer2Dtop ();
1417 bool is2D = props.get_is2D ();
1418 bool isXOrigin = props.xaxislocation_is (
"origin")
1419 && ! props.yscale_is (
"log");
1420 bool isYOrigin = props.yaxislocation_is (
"origin")
1421 && ! props.xscale_is (
"log");
1422 bool boxFull = (props.get_boxstyle () ==
"full");
1423 double linewidth = props.get_linewidth ();
1424 double xPlane = props.get_xPlane ();
1425 double yPlane = props.get_yPlane ();
1426 double zPlane = props.get_zPlane ();
1427 double xPlaneN = props.get_xPlaneN ();
1428 double yPlaneN = props.get_yPlaneN ();
1429 double zPlaneN = props.get_zPlaneN ();
1430 double xpTick = props.get_xpTick ();
1431 double ypTick = props.get_ypTick ();
1432 double zpTick = props.get_zpTick ();
1433 double xpTickN = props.get_xpTickN ();
1434 double ypTickN = props.get_ypTickN ();
1435 double zpTickN = props.get_zpTickN ();
1437 bool plotyy = (props.has_property (
"__plotyy_axes__"));
1447 std::swap (zpTick, zpTickN);
1450 Matrix color = props.get_xcolor_rgb ();
1456 if (! isXOrigin || props.is_box() || ! is2D)
1462 if (props.is_box ())
1480 color = props.get_ycolor_rgb ();
1485 if (! isYOrigin || props.is_box() || ! is2D)
1491 if (props.is_box () && ! plotyy)
1510 color = props.get_zcolor_rgb ();
1512 if (! color.
isempty () && ! is2D)
1527 if (props.is_box ())
1557 octave_unused_parameter (props);
1562 error_unexpected (
"opengl_renderer::draw_axes_boxes");
1568opengl_renderer::draw_axes_x_grid (
const axes::properties& props)
1570#if defined (HAVE_OPENGL)
1574 int xstate = props.get_xstate ();
1576 if (xstate != AXE_DEPTH_DIR
1577 && (props.is_visible ()
1578 || (m_selecting && props.pickableparts_is (
"all"))))
1580 int zstate = props.get_zstate ();
1581 bool x2Dtop = props.get_x2Dtop ();
1582 bool layer2Dtop = props.get_layer2Dtop ();
1583 bool xyzSym = props.get_xyzSym ();
1584 bool nearhoriz = props.get_nearhoriz ();
1585 double xticklen = props.get_xticklen ();
1586 double xtickoffset = props.get_xtickoffset ();
1587 double fy = props.get_fy ();
1588 double fz = props.get_fz ();
1589 double x_min = props.get_x_min ();
1590 double x_max = props.get_x_max ();
1591 double y_min = props.get_y_min ();
1592 double y_max = props.get_y_max ();
1593 double yPlane = props.get_yPlane ();
1594 double yPlaneN = props.get_yPlaneN ();
1595 double ypTick = props.get_ypTick ();
1596 double ypTickN = props.get_ypTickN ();
1597 double zPlane = props.get_zPlane ();
1598 double zPlaneN = props.get_zPlaneN ();
1599 double zpTick = props.get_zpTick ();
1600 double zpTickN = props.get_zpTickN ();
1603 Matrix xticks =
m_xform.xscale (props.get_xtick ().matrix_value ());
1604 Matrix xmticks =
m_xform.xscale (props.get_xminortickvalues ().matrix_value ());
1605 bool do_xtick = ! props.tickdir_is (
"none") && ! xticks.
isempty ();
1606 bool do_xminortick = do_xtick && props.is_xminortick ();
1607 string_vector xticklabels = props.get_xticklabel ().string_vector_value ();
1610 bool tick_along_z = nearhoriz || math::isinf (fy);
1611 double linewidth = props.get_linewidth ();
1612 std::string gridstyle = props.get_gridlinestyle ();
1613 std::string minorgridstyle = props.get_minorgridlinestyle ();
1614 Matrix gridcolor = props.get_gridcolor_rgb ();
1615 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1616 double gridalpha = props.get_gridalpha ();
1617 double minorgridalpha = props.get_minorgridalpha ();
1618 bool do_xgrid = (props.is_xgrid () && (gridstyle !=
"none"));
1619 bool do_xminorgrid = (props.is_xminorgrid ()
1620 && (minorgridstyle !=
"none")
1622 bool is_origin = props.xaxislocation_is (
"origin") && props.get_is2D ()
1623 && ! props.yscale_is (
"log");
1624 bool is_origin_low = is_origin && (y_min + y_max) < 0;
1625 bool mirror = props.is_box () && xstate != AXE_ANY_DIR;
1626 bool is_tickdir_both = props.tickdir_is (
"both");
1631 if (props.gridcolormode_is (
"auto"))
1632 if (props.xcolormode_is (
"manual") && ! props.xcolor_is (
"none"))
1633 gridcolor = props.get_xcolor_rgb ();
1635 if (props.minorgridcolormode_is (
"auto"))
1636 if (props.xcolormode_is (
"manual") && ! props.xcolor_is (
"none"))
1637 minorgridcolor = props.get_xcolor_rgb ();
1642 if (minorgridcolor.
isempty ())
1643 do_xminorgrid =
false;
1646 if (do_xminorgrid && ! do_xgrid)
1648 gridstyle = minorgridstyle;
1649 gridcolor = minorgridcolor;
1650 gridalpha = minorgridalpha;
1657 minorgridstyle, minorgridcolor, minorgridalpha,
1658 xmticks, x_min, x_max,
1659 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1660 0, (zstate != AXE_DEPTH_DIR));
1665 gridstyle, gridcolor, gridalpha,
1666 xticks, x_min, x_max,
1667 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1668 0, (zstate != AXE_DEPTH_DIR));
1671 if (props.xcolor_is (
"none"))
1677 double y_axis_pos = 0.;
1680 y_axis_pos = math::max (math::min (0., y_max), y_min);
1693 is_origin ? y_axis_pos : ypTick, ypTick,
1695 0., 0., (is_origin_low ? -1. : 1.) *
1696 math::
signum (zpTick-zpTickN)*fz*xticklen/2,
1697 0, ! is_origin && mirror, is_tickdir_both);
1700 is_origin ? y_axis_pos : ypTick, ypTickN,
1702 0., (is_origin_low ? -1. : 1.) *
1703 math::
signum (ypTick-ypTickN)*fy*xticklen/2, 0.,
1704 0, ! is_origin && mirror, is_tickdir_both);
1712 is_origin ? y_axis_pos : ypTick, ypTick,
1714 0., 0., (is_origin_low ? -1. : 1.) *
1715 math::
signum (zpTick-zpTickN)*fz*xticklen,
1716 0, ! is_origin && mirror, is_tickdir_both);
1719 is_origin ? y_axis_pos : ypTick, ypTickN,
1721 0., (is_origin_low ? -1. : 1.) *
1722 math::
signum (ypTick-ypTickN)*fy*xticklen, 0.,
1723 0, ! is_origin && mirror, is_tickdir_both);
1727 if (xticklabels.
numel () > 0)
1729 int halign = (xstate == AXE_HORZ_DIR
1731 : (xyzSym || is_origin_low ? 0 : 2));
1732 int valign = (xstate == AXE_VERT_DIR
1734 : (x2Dtop || is_origin_low ? 0 : 2));
1738 is_origin ? y_axis_pos : ypTick,
1740 (is_origin_low ? -1. : 1.) *
1741 math::
signum (zpTick-zpTickN)*fz*xtickoffset,
1742 0, halign, valign, wmax, hmax);
1745 (is_origin ? y_axis_pos : ypTick) +
1746 (is_origin_low ? -1. : 1.) *
1747 math::
signum (ypTick-ypTickN)*fy*xtickoffset,
1748 zpTick, 0, halign, valign, wmax, hmax);
1751 gh_mgr.
get_object (props.get_xlabel ()).set (
"visible",
"on");
1754 gh_mgr.
get_object (props.get_xlabel ()).set (
"visible",
"off");
1758 octave_unused_parameter (props);
1763 error_unexpected (
"opengl_renderer::draw_axes_x_grid");
1769opengl_renderer::draw_axes_y_grid (
const axes::properties& props)
1771#if defined (HAVE_OPENGL)
1775 int ystate = props.get_ystate ();
1777 if (ystate != AXE_DEPTH_DIR && props.is_visible ()
1778 && (props.is_visible ()
1779 || (m_selecting && props.pickableparts_is (
"all"))))
1781 int zstate = props.get_zstate ();
1782 bool y2Dright = props.get_y2Dright ();
1783 bool layer2Dtop = props.get_layer2Dtop ();
1784 bool xyzSym = props.get_xyzSym ();
1785 bool nearhoriz = props.get_nearhoriz ();
1786 double yticklen = props.get_yticklen ();
1787 double ytickoffset = props.get_ytickoffset ();
1788 double fx = props.get_fx ();
1789 double fz = props.get_fz ();
1790 double xPlane = props.get_xPlane ();
1791 double xPlaneN = props.get_xPlaneN ();
1792 double xpTick = props.get_xpTick ();
1793 double xpTickN = props.get_xpTickN ();
1794 double y_min = props.get_y_min ();
1795 double y_max = props.get_y_max ();
1796 double x_min = props.get_x_min ();
1797 double x_max = props.get_x_max ();
1798 double zPlane = props.get_zPlane ();
1799 double zPlaneN = props.get_zPlaneN ();
1800 double zpTick = props.get_zpTick ();
1801 double zpTickN = props.get_zpTickN ();
1804 Matrix yticks =
m_xform.yscale (props.get_ytick ().matrix_value ());
1805 Matrix ymticks =
m_xform.yscale (props.get_yminortickvalues ().matrix_value ());
1806 bool do_ytick = ! props.tickdir_is (
"none") && ! yticks.
isempty ();
1807 bool do_yminortick = do_ytick && props.is_yminortick ();
1808 string_vector yticklabels = props.get_yticklabel ().string_vector_value ();
1811 bool tick_along_z = nearhoriz || math::isinf (fx);
1812 double linewidth = props.get_linewidth ();
1813 std::string gridstyle = props.get_gridlinestyle ();
1814 std::string minorgridstyle = props.get_minorgridlinestyle ();
1815 Matrix gridcolor = props.get_gridcolor_rgb ();
1816 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1817 double gridalpha = props.get_gridalpha ();
1818 double minorgridalpha = props.get_minorgridalpha ();
1819 bool do_ygrid = (props.is_ygrid () && (gridstyle !=
"none"));
1820 bool do_yminorgrid = (props.is_yminorgrid ()
1821 && (minorgridstyle !=
"none")
1823 bool is_origin = props.yaxislocation_is (
"origin") && props.get_is2D ()
1824 && ! props.xscale_is (
"log");
1825 bool is_origin_low = is_origin && (x_min + x_max) < 0;
1826 bool mirror = props.is_box () && ystate != AXE_ANY_DIR
1827 && (! props.has_property (
"__plotyy_axes__"));
1828 bool is_tickdir_both = props.tickdir_is (
"both");
1833 if (props.gridcolormode_is (
"auto"))
1834 if (props.ycolormode_is (
"manual") && ! props.ycolor_is (
"none"))
1835 gridcolor = props.get_ycolor_rgb ();
1837 if (props.minorgridcolormode_is (
"auto"))
1838 if (props.ycolormode_is (
"manual") && ! props.ycolor_is (
"none"))
1839 minorgridcolor = props.get_ycolor_rgb ();
1844 if (minorgridcolor.
isempty ())
1845 do_yminorgrid =
false;
1848 if (do_yminorgrid && ! do_ygrid)
1850 gridstyle = minorgridstyle;
1851 gridcolor = minorgridcolor;
1852 gridalpha = minorgridalpha;
1859 minorgridstyle, minorgridcolor, minorgridalpha,
1860 ymticks, y_min, y_max,
1861 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1862 1, (zstate != AXE_DEPTH_DIR));
1867 gridstyle, gridcolor, gridalpha,
1868 yticks, y_min, y_max,
1869 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1870 1, (zstate != AXE_DEPTH_DIR));
1873 if (props.ycolor_is (
"none"))
1879 double x_axis_pos = 0.;
1882 x_axis_pos = math::max (math::min (0., x_max), x_min);
1895 is_origin ? x_axis_pos : xpTick, xpTick,
1897 0., 0., (is_origin_low ? -1. : 1.) *
1898 math::
signum (zpTick-zpTickN)*fz*yticklen/2,
1899 1, ! is_origin && mirror, is_tickdir_both);
1902 is_origin ? x_axis_pos : xpTick, xpTickN,
1904 (is_origin_low ? -1. : 1.) *
1905 math::
signum (xpTick-xpTickN)*fx*yticklen/2, 0., 0.,
1906 1, ! is_origin && mirror, is_tickdir_both);
1914 is_origin ? x_axis_pos : xpTick, xpTick,
1916 0., 0., (is_origin_low ? -1. : 1.) *
1917 math::
signum (zpTick-zpTickN)*fz*yticklen,
1918 1, ! is_origin && mirror, is_tickdir_both);
1921 is_origin ? x_axis_pos : xpTick, xpTickN,
1923 (is_origin_low ? -1. : 1.) *
1924 math::
signum (xPlaneN-xPlane)*fx*yticklen, 0., 0.,
1925 1, ! is_origin && mirror, is_tickdir_both);
1929 if (yticklabels.
numel () > 0)
1931 int halign = (ystate == AXE_HORZ_DIR
1933 : (! xyzSym || y2Dright || is_origin_low ? 0 : 2));
1934 int valign = (ystate == AXE_VERT_DIR
1936 : (is_origin_low ? 0 : 2));
1940 is_origin ? x_axis_pos : xpTick,
1942 (is_origin_low ? -1. : 1.) *
1943 math::
signum (zpTick-zpTickN)*fz*ytickoffset,
1944 1, halign, valign, wmax, hmax);
1947 (is_origin ? x_axis_pos : xpTick) +
1948 (is_origin_low ? -1. : 1.) *
1949 math::
signum (xpTick-xpTickN)*fx*ytickoffset,
1950 zpTick, 1, halign, valign, wmax, hmax);
1953 gh_mgr.
get_object (props.get_ylabel ()).set (
"visible",
"on");
1956 gh_mgr.
get_object (props.get_ylabel ()).set (
"visible",
"off");
1960 octave_unused_parameter (props);
1965 error_unexpected (
"opengl_renderer::draw_axes_y_grid");
1971opengl_renderer::draw_axes_z_grid (
const axes::properties& props)
1975 int zstate = props.get_zstate ();
1977 if (zstate != AXE_DEPTH_DIR && props.is_visible ()
1978 && (props.is_visible ()
1979 || (m_selecting && props.pickableparts_is (
"all"))))
1981 bool xySym = props.get_xySym ();
1982 bool zSign = props.get_zSign ();
1983 double zticklen = props.get_zticklen ();
1984 double ztickoffset = props.get_ztickoffset ();
1985 double fx = props.get_fx ();
1986 double fy = props.get_fy ();
1987 double xPlane = props.get_xPlane ();
1988 double xPlaneN = props.get_xPlaneN ();
1989 double yPlane = props.get_yPlane ();
1990 double yPlaneN = props.get_yPlaneN ();
1991 double z_min = props.get_z_min ();
1992 double z_max = props.get_z_max ();
1995 Matrix zticks =
m_xform.zscale (props.get_ztick ().matrix_value ());
1996 Matrix zmticks =
m_xform.zscale (props.get_zminortickvalues ().matrix_value ());
1997 bool do_ztick = ! props.tickdir_is (
"none") && ! zticks.
isempty ();
1998 bool do_zminortick = do_ztick && props.is_zminortick ();
1999 string_vector zticklabels = props.get_zticklabel ().string_vector_value ();
2002 double linewidth = props.get_linewidth ();
2003 std::string gridstyle = props.get_gridlinestyle ();
2004 std::string minorgridstyle = props.get_minorgridlinestyle ();
2005 Matrix gridcolor = props.get_gridcolor_rgb ();
2006 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
2007 double gridalpha = props.get_gridalpha ();
2008 double minorgridalpha = props.get_minorgridalpha ();
2009 bool do_zgrid = (props.is_zgrid () && (gridstyle !=
"none"));
2010 bool do_zminorgrid = (props.is_zminorgrid ()
2011 && (minorgridstyle !=
"none")
2013 bool mirror = props.is_box () && zstate != AXE_ANY_DIR;
2014 bool is_tickdir_both = props.tickdir_is (
"both");
2019 if (props.gridcolormode_is (
"auto"))
2020 if (props.zcolormode_is (
"manual") && ! props.zcolor_is (
"none"))
2021 gridcolor = props.get_zcolor_rgb ();
2023 if (props.minorgridcolormode_is (
"auto"))
2024 if (props.zcolormode_is (
"manual") && ! props.zcolor_is (
"none"))
2025 minorgridcolor = props.get_zcolor_rgb ();
2030 if (minorgridcolor.
isempty ())
2031 do_zminorgrid =
false;
2034 if (do_zminorgrid && ! do_zgrid)
2036 gridstyle = minorgridstyle;
2037 gridcolor = minorgridcolor;
2038 gridalpha = minorgridalpha;
2045 minorgridstyle, minorgridcolor, minorgridalpha,
2046 zmticks, z_min, z_max,
2047 xPlane, xPlaneN, yPlane, yPlaneN, 2,
true);
2052 gridstyle, gridcolor, gridalpha,
2053 zticks, z_min, z_max,
2054 xPlane, xPlaneN, yPlane, yPlaneN, 2,
true);
2057 if (props.zcolor_is (
"none"))
2067 if (math::isinf (fy))
2070 math::signum (xPlaneN-xPlane)*fx*zticklen/2, 0., 0.,
2071 2, mirror, is_tickdir_both);
2075 0., math::signum (yPlane-yPlaneN)*fy*zticklen/2, 0.,
2076 2,
false, is_tickdir_both);
2080 if (math::isinf (fx))
2083 0., math::signum (yPlaneN-yPlane)*fy*zticklen/2, 0.,
2084 2, mirror, is_tickdir_both);
2088 math::signum (xPlane-xPlaneN)*fx*zticklen/2, 0., 0.,
2089 2,
false, is_tickdir_both);
2098 if (math::isinf (fy))
2101 math::signum (xPlaneN-xPlane)*fx*zticklen, 0., 0.,
2102 2, mirror, is_tickdir_both);
2106 0., math::signum (yPlane-yPlaneN)*fy*zticklen, 0.,
2107 2,
false, is_tickdir_both);
2111 if (math::isinf (fx))
2114 0., math::signum (yPlaneN-yPlane)*fy*zticklen, 0.,
2115 2, mirror, is_tickdir_both);
2119 math::signum (xPlane-xPlaneN)*fx*zticklen, 0., 0.,
2120 2,
false, is_tickdir_both);
2125 if (zticklabels.
numel () > 0)
2128 int valign = (zstate == AXE_VERT_DIR ? 1 : (zSign ? 3 : 2));
2132 if (math::isinf (fy))
2134 xPlaneN + math::signum (xPlaneN-xPlane)*fx*ztickoffset,
2135 yPlane, 2, halign, valign, wmax, hmax);
2138 yPlane + math::signum (yPlane-yPlaneN)*fy*ztickoffset,
2139 2, halign, valign, wmax, hmax);
2143 if (math::isinf (fx))
2145 yPlaneN + math::signum (yPlaneN-yPlane)*fy*ztickoffset,
2146 2, halign, valign, wmax, hmax);
2149 xPlane + math::signum (xPlane-xPlaneN)*fx*ztickoffset,
2150 yPlaneN, 2, halign, valign, wmax, hmax);
2154 gh_mgr.
get_object (props.get_zlabel ()).set (
"visible",
"on");
2157 gh_mgr.
get_object (props.get_zlabel ()).set (
"visible",
"off");
2161opengl_renderer::draw_axes_grids (
const axes::properties& props)
2163#if defined (HAVE_OPENGL)
2165 GLboolean antialias;
2169 if (antialias == GL_TRUE)
2177 draw_axes_x_grid (props);
2178 draw_axes_y_grid (props);
2179 draw_axes_z_grid (props);
2181 if (antialias == GL_TRUE)
2185 octave_unused_parameter (props);
2190 error_unexpected (
"opengl_renderer::draw_axes_grids");
2196opengl_renderer::draw_all_lights (
const base_properties& props,
2197 std::list<graphics_object>& obj_list)
2199#if defined (HAVE_OPENGL)
2202 Matrix children = props.get_all_children ();
2206 graphics_object go = gh_mgr.
get_object (children(i));
2208 base_properties& p = go.get_properties ();
2211 || (m_selecting && p.pickableparts_is (
"all")))
2213 if (go.isa (
"light") && ! m_selecting)
2215 if (m_current_light-GL_LIGHT0 < m_max_lights)
2222 else if (go.isa (
"hggroup")
2223 && ! (m_selecting && p.pickableparts_is (
"none")))
2224 draw_all_lights (go.get_properties (), obj_list);
2225 else if (! (m_selecting && p.pickableparts_is (
"none")))
2226 obj_list.push_back (go);
2231 octave_unused_parameter (props);
2232 octave_unused_parameter (obj_list);
2237 error_unexpected (
"opengl_renderer::draw_all_lights");
2243opengl_renderer::draw_axes_children (
const axes::properties& props)
2245#if defined (HAVE_OPENGL)
2247 std::list<graphics_object> obj_list;
2248 std::list<graphics_object>::iterator it;
2262 if (props.get_num_lights () > m_max_lights)
2264 "light: Maximum number of lights (%d) in these axes is "
2265 "exceeded.", m_max_lights);
2267 m_current_light = GL_LIGHT0;
2268 draw_all_lights (props, obj_list);
2271 for (
unsigned int i = props.get_num_lights (); i < m_max_lights; i++)
2276 m_view_vector = props.get_cameraposition ().matrix_value ();
2278 float cb[4] = { 1.0, 1.0, 1.0, 1.0 };
2279 ColumnVector ambient_color = props.get_ambientlightcolor_rgb ();
2280 for (
int i = 0; i < 3; i++)
2281 cb[i] = ambient_color(i);
2286 it = obj_list.begin ();
2287 while (it != obj_list.end ())
2289 graphics_object go = (*it);
2293 if (! go.isa (
"text") || go.get (
"units").string_value () ==
"data")
2298 it = obj_list.erase (it);
2308 for (
const graphics_object& go : obj_list)
2321 octave_unused_parameter (props);
2326 error_unexpected (
"opengl_renderer::draw_axes_children");
2334#if defined (HAVE_OPENGL)
2337 if (! props.is_visible () && props.get_tag () ==
"legend")
2342 if (m_selecting && props.pickableparts_is (
"none"))
2345 static double floatmax = std::numeric_limits<float>::max ();
2347 double x_min = props.get_x_min ();
2348 double x_max = props.get_x_max ();
2349 double y_min = props.get_y_min ();
2350 double y_max = props.get_y_max ();
2351 double z_min = props.get_z_min ();
2352 double z_max = props.get_z_max ();
2354 if (x_max > floatmax || y_max > floatmax || z_max > floatmax
2355 || x_min < -floatmax || y_min < -floatmax || z_min < -floatmax)
2357 warning (
"opengl_renderer: data values greater than float capacity. (1) Scale data, or (2) Use gnuplot");
2365 bool is2D = props.get_is2D (
true);
2371 draw_axes_planes (props);
2373 if (! is2D || props.layer_is (
"bottom"))
2375 draw_axes_grids (props);
2376 if (props.get_tag () !=
"legend" || props.get_box () !=
"off")
2377 draw_axes_boxes (props);
2380 set_clipbox (x_min, x_max, y_min, y_max, z_min, z_max);
2382 draw_axes_children (props);
2384 if (is2D && props.layer_is (
"top"))
2386 draw_axes_grids (props);
2387 if (props.get_tag () !=
"legend" || props.get_box () !=
"off")
2388 draw_axes_boxes (props);
2393 octave_unused_parameter (props);
2398 error_unexpected (
"opengl_renderer::draw_axes");
2406#if defined (HAVE_OPENGL)
2408 bool draw_all = m_selecting && props.pickableparts_is (
"all");
2411 Matrix y =
m_xform.yscale (props.get_ydata ().matrix_value ());
2412 Matrix z =
m_xform.zscale (props.get_zdata ().matrix_value ());
2414 bool has_z = (z.
numel () > 0);
2415 int n =
static_cast<int> (std::min (std::min (
x.numel (), y.
numel ()),
2417 : std::numeric_limits<int>::max ())));
2418 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
2419 uint8_t clip_ok = 0x40;
2421 std::vector<uint8_t> clip (n);
2424 for (
int i = 0; i < n; i++)
2425 clip[i] = (clip_code (
x(i), y(i), z(i)) & clip_mask);
2430 for (
int i = 0; i < n; i++)
2431 clip[i] = (clip_code (
x(i), y(i), z_mid) & clip_mask);
2434 if (! props.linestyle_is (
"none") && ! props.color_is (
"none"))
2437 set_linestyle (props.get_linestyle (),
false, props.get_linewidth ());
2446 for (
int i = 1; i < n; i++)
2448 if ((clip[i-1] & clip[i]) == clip_ok)
2472 for (
int i = 1; i < n; i++)
2474 if ((clip[i-1] & clip[i]) == clip_ok)
2501 if (! props.marker_is (
"none")
2502 && ! (props.markeredgecolor_is (
"none")
2503 && props.markerfacecolor_is (
"none")))
2509 else if (props.markeredgecolor_is (
"auto"))
2510 lc = props.get_color_rgb ();
2511 else if (! props.markeredgecolor_is (
"none"))
2512 lc = props.get_markeredgecolor_rgb ();
2516 if (props.markerfacecolor_is (
"auto"))
2517 fc = props.get_color_rgb ();
2518 else if (! props.markerfacecolor_is (
"none"))
2519 fc = props.get_markerfacecolor_rgb ();
2521 init_marker (props.get_marker (), props.get_markersize (),
2522 props.get_linewidth ());
2524 for (
int i = 0; i < n; i++)
2526 if (clip[i] == clip_ok)
2539 octave_unused_parameter (props);
2544 error_unexpected (
"opengl_renderer::draw_line");
2552#if defined (HAVE_OPENGL)
2554 bool draw_all = m_selecting && props.pickableparts_is (
"all");
2556 const Matrix x =
m_xform.xscale (props.get_xdata ().matrix_value ());
2557 const Matrix y =
m_xform.yscale (props.get_ydata ().matrix_value ());
2558 const Matrix z =
m_xform.zscale (props.get_zdata ().matrix_value ());
2564 const NDArray vn = props.get_vertexnormals ().array_value ();
2566 bool has_vertex_normals = (vn_dims(0) == zr && vn_dims(1) == zc
2567 && vn_dims(2) == 3);
2568 const NDArray fn = props.get_facenormals ().array_value ();
2570 bool has_face_normals = (fn_dims(0) == zr - 1 && fn_dims(1) == zc - 1
2571 && fn_dims(2) == 3);
2576 int fc_mode = (props.facecolor_is_rgb () ? 0 :
2577 (props.facecolor_is (
"flat") ? 1 :
2578 (props.facecolor_is (
"interp") ? 2 :
2579 (props.facecolor_is (
"texturemap") ? 3 : -1))));
2580 int fl_mode = (props.facelighting_is (
"none") ? 0 :
2581 (props.facelighting_is (
"flat") ?
2582 (has_face_normals ? 1 : 0) :
2583 (has_vertex_normals ? 2 : 0)));
2584 int fa_mode = (props.facealpha_is_double () ? 0 :
2585 (props.facealpha_is (
"flat") ? 1 : 2));
2586 int ec_mode = (props.edgecolor_is_rgb () ? 0 :
2587 (props.edgecolor_is (
"flat") ? 1 :
2588 (props.edgecolor_is (
"interp") ? 2 : -1)));
2589 int el_mode = (props.edgelighting_is (
"none") ? 0 :
2590 (props.edgelighting_is (
"flat") ?
2591 (has_face_normals ? 1 : 0) :
2592 (has_vertex_normals ? 2 : 0)));
2593 int ea_mode = (props.edgealpha_is_double () ? 0 :
2594 (props.edgealpha_is (
"flat") ? 1 : 2));
2595 int bfl_mode = (props.backfacelighting_is (
"lit") ? 0 :
2596 (props.backfacelighting_is (
"reverselit") ? 1 : 2));
2597 bool do_lighting = props.get_do_lighting ();
2600 : props.get_facecolor_rgb ());
2601 Matrix ecolor = props.get_edgecolor_rgb ();
2604 float as = props.get_ambientstrength ();
2605 float ds = props.get_diffusestrength ();
2606 float ss = props.get_specularstrength ();
2607 float se = props.get_specularexponent () * 5;
2608 float scr = props.get_specularcolorreflectance ();
2609 float cb[4] = { 0.0, 0.0, 0.0, 1.0 };
2614 bool x_mat = (
x.rows () == z.
rows ());
2617 i1 = i2 = j1 = j2 = 0;
2619 if ((fc_mode > 0 && fc_mode < 3) || ec_mode > 0)
2620 c = props.get_color_data ().array_value ();
2624 for (
int i = 0; i < zr; i++)
2629 for (
int j = 0; j < zc; j++)
2634 clip(i, j) = is_nan_or_inf (
x(i1, j), y(i, j1), z(i, j));
2638 if (fa_mode > 0 || ea_mode > 0)
2644 if (fl_mode > 0 || el_mode > 0)
2650 tex = opengl_texture::create (
m_glfcns, props.get_color_data ());
2652 if (draw_all || ! props.facecolor_is (
"none"))
2656 fa = props.get_facealpha_double ();
2663 for (
int i = 0; i < 3; i++)
2664 cb[i] = as * fcolor(i);
2667 for (
int i = 0; i < 3; i++)
2668 cb[i] = ds * fcolor(i);
2671 for (
int i = 0; i < 3; i++)
2672 cb[i] = ss * (scr + (1-scr) * fcolor(i));
2677 if ((fl_mode > 0) && do_lighting)
2680 ? GL_SMOOTH : GL_FLAT);
2685 for (
int i = 1; i < zc; i++)
2693 for (
int j = 1; j < zr; j++)
2696 if (clip(j-1, i-1) || clip(j, i-1)
2697 || clip(j-1, i) || clip(j, i))
2700 if (fc_mode ==
FLAT)
2703 if (! math::isfinite (c(j-1, i-1)))
2706 else if (fc_mode ==
INTERP)
2709 if (! (math::isfinite (c(j-1, i-1))
2710 && math::isfinite (c(j, i-1))
2711 && math::isfinite (c(j-1, i))
2712 && math::isfinite (c(j, i))))
2726 tex.tex_coord (
double (i-1) / (zc-1),
2727 double (j-1) / (zr-1));
2728 else if (fc_mode > 0)
2731 for (
int k = 0; k < 3; k++)
2732 cb[k] = c(j-1, i-1, k);
2737 for (
int k = 0; k < 3; k++)
2741 for (
int k = 0; k < 3; k++)
2742 cb[k] = ds * c(j-1, i-1, k);
2745 for (
int k = 0; k < 3; k++)
2746 cb[k] = ss * (scr + (1-scr) * c(j-1, i-1, k));
2751 set_normal (bfl_mode, (fl_mode ==
GOURAUD ? vn : fn),
2758 tex.tex_coord (
double (i) / (zc-1),
2759 double (j-1) / (zr-1));
2760 else if (fc_mode ==
INTERP)
2762 for (
int k = 0; k < 3; k++)
2763 cb[k] = c(j-1, i, k);
2768 for (
int k = 0; k < 3; k++)
2772 for (
int k = 0; k < 3; k++)
2773 cb[k] = ds * c(j-1, i, k);
2776 for (
int k = 0; k < 3; k++)
2777 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k));
2783 set_normal (bfl_mode, vn, j-1, i);
2789 tex.tex_coord (
double (i) / (zc-1),
double (j) / (zr-1));
2790 else if (fc_mode ==
INTERP)
2792 for (
int k = 0; k < 3; k++)
2798 for (
int k = 0; k < 3; k++)
2802 for (
int k = 0; k < 3; k++)
2803 cb[k] = ds * c(j, i, k);
2806 for (
int k = 0; k < 3; k++)
2807 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
2812 set_normal (bfl_mode, vn, j, i);
2818 tex.tex_coord (
double (i-1) / (zc-1),
2819 double (j) / (zr-1));
2820 else if (fc_mode ==
INTERP)
2822 for (
int k = 0; k < 3; k++)
2823 cb[k] = c(j, i-1, k);
2828 for (
int k = 0; k < 3; k++)
2832 for (
int k = 0; k < 3; k++)
2833 cb[k] = ds * c(j, i-1, k);
2836 for (
int k = 0; k < 3; k++)
2837 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k));
2842 set_normal (bfl_mode, vn, j, i-1);
2854 if ((fl_mode > 0) && do_lighting)
2863 if (! props.edgecolor_is (
"none") && ! props.linestyle_is (
"none"))
2865 if (props.get_edgealpha_double () == 1)
2873 for (
int i = 0; i < 3; i++)
2874 cb[i] = as * ecolor(i);
2877 for (
int i = 0; i < 3; i++)
2878 cb[i] = ds * ecolor(i);
2881 for (
int i = 0; i < 3; i++)
2882 cb[i] = ss * (scr + (1-scr) * ecolor(i));
2887 if ((el_mode > 0) && do_lighting)
2890 ? GL_SMOOTH : GL_FLAT);
2893 props.get_linewidth ());
2900 if (props.meshstyle_is (
"both") || props.meshstyle_is (
"column"))
2902 for (
int i = 0; i < zc; i++)
2910 for (
int j = 1; j < zr; j++)
2912 if (clip(j-1, i) || clip(j, i))
2915 if (ec_mode ==
FLAT)
2918 if (! math::isfinite (c(j-1, i)))
2921 else if (ec_mode ==
INTERP)
2924 if (! (math::isfinite (c(j-1, i))
2925 && math::isfinite (c(j, i))))
2940 for (
int k = 0; k < 3; k++)
2941 cb[k] = c(j-1, i, k);
2946 for (
int k = 0; k < 3; k++)
2951 for (
int k = 0; k < 3; k++)
2952 cb[k] = ds * c(j-1, i, k);
2956 for (
int k = 0; k < 3; k++)
2957 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k));
2965 set_normal (bfl_mode, vn, j-1, i);
2967 set_normal (bfl_mode, fn, j-1, std::min (i, zc-2));
2975 for (
int k = 0; k < 3; k++)
2981 for (
int k = 0; k < 3; k++)
2986 for (
int k = 0; k < 3; k++)
2987 cb[k] = ds * c(j, i, k);
2991 for (
int k = 0; k < 3; k++)
2992 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
2998 set_normal (bfl_mode, vn, j, i);
3009 if (props.meshstyle_is (
"both") || props.meshstyle_is (
"row"))
3011 for (
int j = 0; j < zr; j++)
3019 for (
int i = 1; i < zc; i++)
3021 if (clip(j, i-1) || clip(j, i))
3024 if (ec_mode ==
FLAT)
3027 if (! math::isfinite (c(j, i-1)))
3030 else if (ec_mode ==
INTERP)
3033 if (! (math::isfinite (c(j, i-1))
3034 && math::isfinite (c(j, i))))
3049 for (
int k = 0; k < 3; k++)
3050 cb[k] = c(j, i-1, k);
3055 for (
int k = 0; k < 3; k++)
3060 for (
int k = 0; k < 3; k++)
3061 cb[k] = ds * c(j, i-1, k);
3065 for (
int k = 0; k < 3; k++)
3066 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k));
3074 set_normal (bfl_mode, vn, j, i-1);
3076 set_normal (bfl_mode, fn, std::min (j, zr-2), i-1);
3084 for (
int k = 0; k < 3; k++)
3090 for (
int k = 0; k < 3; k++)
3095 for (
int k = 0; k < 3; k++)
3096 cb[k] = ds * c(j, i, k);
3100 for (
int k = 0; k < 3; k++)
3101 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
3107 set_normal (bfl_mode, vn, j, i);
3119 if ((el_mode > 0) && do_lighting)
3128 if (! props.marker_is (
"none")
3129 && ! (props.markeredgecolor_is (
"none")
3130 && props.markerfacecolor_is (
"none")))
3136 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
3137 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
3140 props.get_markeredgecolor_rgb ());
3142 props.get_markerfacecolor_rgb ());
3145 if (mecolor.
isempty () && props.markeredgecolor_is (
"auto"))
3147 mecolor = props.get_edgecolor_rgb ();
3148 do_edge = ! props.edgecolor_is (
"none");
3151 if (mfcolor.
isempty () && props.markerfacecolor_is (
"auto"))
3153 mfcolor = props.get_facecolor_rgb ();
3154 do_face = ! props.facecolor_is (
"none");
3158 c = props.get_color_data ().array_value ();
3160 init_marker (props.get_marker (), props.get_markersize (),
3161 props.get_linewidth ());
3163 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
3164 uint8_t clip_ok = 0x40;
3166 for (
int i = 0; i < zc; i++)
3171 for (
int j = 0; j < zr; j++)
3176 if ((clip_code (
x(j1, i), y(j, i1), z(j, i)) & clip_mask)
3180 if ((do_edge && mecolor.
isempty ())
3181 || (do_face && mfcolor.
isempty ()))
3183 if (! math::isfinite (c(j, i)))
3186 for (
int k = 0; k < 3; k++)
3204 octave_unused_parameter (props);
3209 error_unexpected (
"opengl_renderer::draw_surface");
3219#if defined (HAVE_OPENGL)
3223 if (props.has_bad_data (msg))
3225 warning (
"opengl_renderer: %s. Not rendering.", msg.c_str ());
3229 bool draw_all = m_selecting && props.pickableparts_is (
"all");
3230 const Matrix f = props.get_faces ().matrix_value ();
3231 const Matrix v =
m_xform.scale (props.get_vertices ().matrix_value ());
3238 int fcmax =
f.columns ();
3240 bool has_z = (v.
columns () > 2);
3241 bool has_facecolor =
false;
3242 bool has_facealpha =
false;
3244 int fc_mode = ((props.facecolor_is (
"none")
3245 || props.facecolor_is_rgb () || draw_all) ? 0 :
3246 (props.facecolor_is (
"flat") ? 1 : 2));
3247 int fl_mode = (props.facelighting_is (
"none") ? 0 :
3248 (props.facelighting_is (
"flat") ? 1 : 2));
3249 int fa_mode = (props.facealpha_is_double () ? 0 :
3250 (props.facealpha_is (
"flat") ? 1 : 2));
3251 int ec_mode = ((props.edgecolor_is (
"none")
3252 || props.edgecolor_is_rgb ()) ? 0 :
3253 (props.edgecolor_is (
"flat") ? 1 : 2));
3254 int el_mode = (props.edgelighting_is (
"none") ? 0 :
3255 (props.edgelighting_is (
"flat") ? 1 : 2));
3256 int ea_mode = (props.edgealpha_is_double () ? 0 :
3257 (props.edgealpha_is (
"flat") ? 1 : 2));
3258 int bfl_mode = (props.backfacelighting_is (
"lit") ? 0 :
3259 (props.backfacelighting_is (
"reverselit") ? 1 : 2));
3260 bool do_lighting = props.get_do_lighting ();
3262 Matrix fcolor = props.get_facecolor_rgb ();
3263 Matrix ecolor = props.get_edgecolor_rgb ();
3265 float as = props.get_ambientstrength ();
3266 float ds = props.get_diffusestrength ();
3267 float ss = props.get_specularstrength ();
3268 float se = props.get_specularexponent () * 5;
3269 float scr = props.get_specularcolorreflectance ();
3271 const Matrix vn = props.get_vertexnormals ().matrix_value ();
3272 bool has_vertex_normals = (vn.
rows () == nv);
3273 const Matrix fn = props.get_facenormals ().matrix_value ();
3274 bool has_face_normals = (fn.
rows () == nf);
3279 for (
int i = 0; i < nv; i++)
3280 clip(i) = is_nan_or_inf (v(i, 0), v(i, 1), v(i, 2));
3282 for (
int i = 0; i < nv; i++)
3283 clip(i) = is_nan_or_inf (v(i, 0), v(i, 1), 0);
3288 for (
int i = 0; i < nf; i++)
3293 for (
int j = 0; j < fcmax && ! math::isnan (
f(i, j)); j++, count++)
3294 fclip = (fclip || clip(
int (
f(i, j) - 1)));
3300 if (draw_all || fc_mode > 0 || ec_mode > 0)
3305 c = props.get_color_data ().matrix_value ();
3311 if (draw_all || fc_mode > 0)
3317 if (draw_all || ec_mode > 0)
3326 has_facecolor = ((c.
numel () > 0) && (c.
rows () ==
f.rows ()));
3329 if (fa_mode > 0 || ea_mode > 0)
3333 has_facealpha = ((a.
numel () > 0) && (a.
rows () ==
f.rows ()));
3337 fa = props.get_facealpha_double ();
3340 std::vector<vertex_data> vdata (
f.numel ());
3342 for (
int i = 0; i < nf; i++)
3343 for (
int j = 0; j < count_f(i); j++)
3345 int idx =
int (
f(i, j) - 1);
3353 vv(0) = v(idx, 0); vv(1) = v(idx, 1);
3356 if (((fl_mode ==
FLAT) || (el_mode ==
FLAT)) && has_face_normals)
3360 dir = ((fn(i, 0) * m_view_vector(0)
3361 + fn(i, 1) * m_view_vector(1)
3362 + fn(i, 2) * m_view_vector(2) < 0)
3363 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
3364 fnn(0) = dir * fn(i, 0);
3365 fnn(1) = dir * fn(i, 1);
3366 fnn(2) = dir * fn(i, 2);
3368 if ((fl_mode ==
GOURAUD || el_mode ==
GOURAUD) && has_vertex_normals)
3372 dir = ((vn(idx, 0) * m_view_vector(0)
3373 + vn(idx, 1) * m_view_vector(1)
3374 + vn(idx, 2) * m_view_vector(2) < 0)
3375 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
3376 vnn(0) = dir * vn(idx, 0);
3377 vnn(1) = dir * vn(idx, 1);
3378 vnn(2) = dir * vn(idx, 2);
3384 cc(0) = c(i, 0), cc(1) = c(i, 1), cc(2) = c(i, 2);
3386 cc(0) = c(idx, 0), cc(1) = c(idx, 1), cc(2) = c(idx, 2);
3390 else if (a.
numel () > 0)
3399 = vertex_data (vv, cc, vnn, fnn, aa, as, ds, ss, se, scr);
3402 if (fl_mode > 0 || el_mode > 0)
3405 if (draw_all || ! props.facecolor_is (
"none"))
3415 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
3417 for (
int i = 0; i < 3; i++)
3418 cb[i] = as * fcolor(i);
3421 for (
int i = 0; i < 3; i++)
3422 cb[i] = ds * fcolor(i);
3425 for (
int i = 0; i < 3; i++)
3426 cb[i] = ss * (scr + (1-scr) * fcolor(i));
3431 if ((fl_mode > 0) && do_lighting)
3438 patch_tessellator tess (
this, fc_mode, fl_mode,
true, 1.0);
3440 std::vector<octave_idx_type>::const_iterator it;
3443 for (
int i = 0; i < nf; i++)
3448 bool is_non_planar =
false;
3449 if (props.m_coplanar_last_idx.size () > 0
3450 && props.m_coplanar_last_idx[i].size () > 1)
3452 is_non_planar =
true;
3453 it = props.m_coplanar_last_idx[i].end ();
3463 if (it == props.m_coplanar_last_idx[i].begin ())
3473 i_end = count_f(i) - 1;
3477 tess.begin_polygon (
true);
3478 tess.begin_contour ();
3481 for (
int j = i_end; j > i_start; j--)
3483 vertex_data::vertex_data_rep *vv
3484 = vdata[i+j*fr].get_rep ();
3486 tess.add_vertex (vv->m_coords.rwdata (), vv);
3491 vertex_data::vertex_data_rep *vv = vdata[i].get_rep ();
3493 if (fc_mode ==
FLAT)
3496 Matrix col = vv->m_color;
3498 if (col.
numel () == 3)
3503 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
3505 for (
int k = 0; k < 3; k++)
3506 cb[k] = (vv->m_ambient * col(k));
3510 for (
int k = 0; k < 3; k++)
3511 cb[k] = (vv->m_diffuse * col(k));
3515 for (
int k = 0; k < 3; k++)
3516 cb[k] = vv->m_specular *
3517 (vv->m_specular_color_refl
3518 + (1-vv->m_specular_color_refl) *
3526 tess.add_vertex (vv->m_coords.rwdata (), vv);
3529 tess.end_contour ();
3530 tess.end_polygon ();
3532 while (i_start > 0);
3535 if ((fl_mode > 0) && do_lighting)
3545 || (! props.edgecolor_is (
"none") && ! props.linestyle_is (
"none")))
3548 if (props.get_edgealpha_double () == 1)
3556 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
3560 for (
int i = 0; i < 3; i++)
3561 cb[i] = (as * ecolor(i));
3566 if ((el_mode > 0) && do_lighting)
3569 double linewidth = props.get_linewidth ();
3580 patch_tessellator tess (
this, ec_mode, el_mode,
false);
3582 for (
int i = 0; i < nf; i++)
3584 bool is_non_planar =
false;
3585 if (props.m_coplanar_last_idx.size () > 0
3586 && props.m_coplanar_last_idx[i].size () > 1)
3587 is_non_planar =
true;
3588 if (clip_f(i) || is_non_planar)
3596 ? GL_SMOOTH : GL_FLAT);
3599 for (
int j = count_f(i)-1; j >= 0; j--)
3601 if (! clip(
int (
f(i, j) - 1)))
3603 vertex_data::vertex_data_rep *vv
3604 = vdata[i+j*fr].get_rep ();
3605 const Matrix m = vv->m_coords;
3613 Matrix col = vv->m_color;
3615 if (col.
numel () == 3)
3628 int j = count_f(i)-1;
3629 if (flag && ! clip(
int (
f(i, j) - 1)))
3631 vertex_data::vertex_data_rep *vv
3632 = vdata[i+j*fr].get_rep ();
3633 const Matrix m = vv->m_coords;
3636 Matrix col = vv->m_color;
3638 if (col.
numel () == 3)
3649 tess.begin_polygon (
false);
3650 tess.begin_contour ();
3652 for (
int j = count_f(i)-1; j >= 0; j--)
3654 vertex_data::vertex_data_rep *vv
3655 = vdata[i+j*fr].get_rep ();
3656 tess.add_vertex (vv->m_coords.rwdata (), vv);
3659 tess.end_contour ();
3660 tess.end_polygon ();
3667 if ((el_mode > 0) && do_lighting)
3676 if (! props.marker_is (
"none")
3677 && ! (props.markeredgecolor_is (
"none")
3678 && props.markerfacecolor_is (
"none")))
3680 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
3681 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
3684 props.get_markeredgecolor_rgb ());
3686 props.get_markerfacecolor_rgb ());
3688 bool has_markerfacecolor = draw_all ||
false;
3690 if ((mecolor.
isempty () && ! props.markeredgecolor_is (
"none"))
3691 || (mfcolor.
isempty () && ! props.markerfacecolor_is (
"none")))
3693 Matrix mc = props.get_color_data ().matrix_value ();
3695 if (mc.
rows () == 1)
3698 if (mfcolor.
isempty () && ! props.markerfacecolor_is (
"none"))
3701 if (mecolor.
isempty () && ! props.markeredgecolor_is (
"none"))
3707 c = props.get_color_data ().matrix_value ();
3708 has_markerfacecolor = ((c.
numel () > 0)
3709 && (c.
rows () ==
f.rows ()));
3713 init_marker (props.get_marker (), props.get_markersize (),
3714 props.get_linewidth ());
3716 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
3717 uint8_t clip_ok = 0x40;
3719 for (
int i = 0; i < nf; i++)
3720 for (
int j = 0; j < count_f(i); j++)
3722 int idx =
int (
f(i, j) - 1);
3724 if ((clip_code (v(idx, 0), v(idx, 1), (has_z ? v(idx, 2) : 0))
3725 & clip_mask) != clip_ok)
3732 if (has_markerfacecolor)
3733 cc(0) = c(i, 0), cc(1) = c(i, 1), cc(2) = c(i, 2);
3735 cc(0) = c(idx, 0), cc(1) = c(idx, 1), cc(2) = c(idx, 2);
3743 draw_marker (v(idx, 0), v(idx, 1), (has_z ? v(idx, 2) : 0), lc, fc);
3751 octave_unused_parameter (props);
3756 error_unexpected (
"opengl_renderer::draw_patch");
3764#if defined (HAVE_OPENGL)
3768 if (props.has_bad_data (msg))
3770 warning (
"opengl_renderer: %s. Not rendering.", msg.c_str ());
3774 bool draw_all = m_selecting;
3776 if (draw_all || (! props.marker_is (
"none")
3777 && ! (props.markeredgecolor_is (
"none")
3778 && props.markerfacecolor_is (
"none"))))
3780 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
3781 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
3783 const Matrix x =
m_xform.xscale (props.get_xdata ().matrix_value ());
3784 const Matrix y =
m_xform.yscale (props.get_ydata ().matrix_value ());
3785 const Matrix z =
m_xform.zscale (props.get_zdata ().matrix_value ());
3786 const Matrix c = props.get_color_data ().matrix_value ();
3787 const Matrix s = props.get_sizedata ().matrix_value ();
3794 props.get_markeredgecolor_rgb ());
3796 props.get_markerfacecolor_rgb ());
3797 const double mea = props.get_markeredgealpha ();
3798 const double mfa = props.get_markerfacealpha ();
3800 if (props.markerfacecolor_is (
"auto"))
3803 graphics_object go = gh_mgr.
get_object (props.get___myhandle__ ());
3804 graphics_object ax = go.get_ancestor (
"axes");
3805 const axes::properties& ax_props
3806 =
dynamic_cast<const axes::properties&
> (ax.get_properties ());
3808 mfcolor = ax_props.get_color ().matrix_value ();
3811 init_marker (props.get_marker (), std::sqrt (s(0)),
3812 props.get_linewidth ());
3814 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
3815 uint8_t clip_ok = 0x40;
3831 for (
int i = 0; i < np; i++)
3833 if ((clip_code (
x(i), y(i), (has_z ? z(i) : 0.0)) & clip_mask)
3852 draw_marker (
x(i), y(i), (has_z ? z(i) : 0.0), lc, fc, mea, mfa);
3860 octave_unused_parameter (props);
3865 error_unexpected (
"opengl_renderer::draw_scatter");
3873#if defined (HAVE_OPENGL)
3879 float pos[4] = { 0, 0, 0, 0 };
3880 Matrix lpos = props.get_position ().matrix_value ();
3881 for (
int i = 0; i < 3; i++)
3883 if (props.style_is (
"local"))
3888 float col[4] = { 1, 1, 1, 1 };
3889 Matrix lcolor = props.get_color ().matrix_value ();
3890 for (
int i = 0; i < 3; i++)
3897 octave_unused_parameter (props);
3902 error_unexpected (
"opengl_renderer::draw_light");
3910 draw (props.get_children ());
3914opengl_renderer::set_ortho_coordinates ()
3916#if defined (HAVE_OPENGL)
3933 error_unexpected (
"opengl_renderer::set_ortho_coordinates");
3939opengl_renderer::restore_previous_coordinates ()
3941#if defined (HAVE_OPENGL)
3954 error_unexpected (
"opengl_renderer::restore_previous_coordinates");
3962#if defined (HAVE_OPENGL)
3964 if (props.get_string ().isempty () || props.color_is (
"none"))
3970 if (! props.is_clipping ()
3971 || (clip_code (pos(0), pos(1), pos.
numel () > 2 ? pos(2) : 0.0) == 0x40))
3979 render_text (props.get_pixels (), props.get_extent_matrix (),
3980 pos(0), pos(1), pos(2), props.get_rotation ());
3987 octave_unused_parameter (props);
3992 error_unexpected (
"opengl_renderer::draw_text");
4001#if defined (HAVE_OPENGL)
4003 Matrix bgcol = props.get_backgroundcolor_rgb ();
4004 Matrix ecol = props.get_edgecolor_rgb ();
4009 Matrix pos = props.get_data_position ();
4014 set_ortho_coordinates ();
4021 double rotation = props.get_rotation ();
4025 double m = points_to_pixels (props.get_margin ());
4026 const Matrix bbox = props.get_extent_matrix ();
4055 set_linestyle (props.get_linestyle (),
false, props.get_linewidth ());
4069 restore_previous_coordinates ();
4073 octave_unused_parameter (props);
4078 error_unexpected (
"opengl_renderer::draw_text_background");
4086#if defined (HAVE_OPENGL)
4089 Matrix x = props.get_xdata ().matrix_value ();
4090 Matrix y = props.get_ydata ().matrix_value ();
4092 draw_texture_image (cdata,
x, y);
4096 octave_unused_parameter (props);
4101 error_unexpected (
"opengl_renderer::draw_image");
4110#if defined (HAVE_OPENGL)
4115 double x0, x1, y0, y1;
4119 dx = (
x(1) -
x(0)) / (w - 1);
4126 dy = (y(1) - y(0)) / (h - 1);
4132 if (dv.
ndims () == 3 && (dv(2) == 3 || dv(2) == 4))
4134 opengl_texture tex = opengl_texture::create (
m_glfcns, cdata);
4135 if (tex.is_valid ())
4143 tex.tex_coord (0.0, 0.0);
4149 tex.tex_coord (1.0, 0.0);
4155 tex.tex_coord (1.0, 1.0);
4161 tex.tex_coord (0.0, 1.0);
4172 warning (
"opengl_renderer: invalid image size (expected MxNx3 or MxN)");
4176 octave_unused_parameter (cdata);
4177 octave_unused_parameter (
x);
4178 octave_unused_parameter (y);
4179 octave_unused_parameter (ortho);
4184 error_unexpected (
"opengl_renderer::draw_texture_image");
4196 for (
int i =
len-1; i >= 0; i--)
4198 graphics_object obj = gh_mgr.
get_object (hlist(i));
4201 draw (obj, toplevel);
4208#if defined (HAVE_OPENGL)
4214 octave_unused_parameter (w);
4215 octave_unused_parameter (h);
4220 error_unexpected (
"opengl_renderer::set_viewport");
4228 Matrix retval (1, 4, 0.0);
4230#if defined (HAVE_OPENGL)
4231#if defined (HAVE_FRAMEWORK_OPENGL)
4239 for (
int i = 0; i < 4; i++)
4247 error_unexpected (
"opengl_renderer::get_viewport_scaled");
4257#if defined (HAVE_OPENGL)
4266 octave_unused_parameter (c);
4271 error_unexpected (
"opengl_renderer::set_color");
4279 bool do_anti_alias = props.get (
"fontsmoothing").string_value () ==
"on";
4281 m_txt_renderer.
set_font (props.get (
"fontname").string_value (),
4282 props.get (
"fontweight").string_value (),
4283 props.get (
"fontangle").string_value (),
4284 props.get (
"__fontsize_points__").double_value ()
4291#if defined (HAVE_OPENGL)
4307 octave_unused_parameter (on);
4308 octave_unused_parameter (offset);
4313 error_unexpected (
"opengl_renderer::set_polygon_offset");
4321#if defined (HAVE_OPENGL)
4327 octave_unused_parameter (w);
4332 error_unexpected (
"opengl_renderer::set_linewidth");
4341#if defined (HAVE_OPENGL)
4343 int factor = math::round (points_to_pixels (linewidth) *
m_devpixratio);
4347 uint16_t pattern = 0xFFFF;
4379 if (solid && ! use_stipple)
4386 octave_unused_parameter (s);
4387 octave_unused_parameter (use_stipple);
4388 octave_unused_parameter (linewidth);
4393 error_unexpected (
"opengl_renderer::set_linestyle");
4400 double z1,
double z2)
4402#if defined (HAVE_OPENGL)
4404 double dx = (x2-x1);
4405 double dy = (y2-y1);
4406 double dz = (z2-z1);
4408 x1 -= 0.001*dx; x2 += 0.001*dx;
4409 y1 -= 0.001*dy; y2 += 0.001*dy;
4410 z1 -= 0.001*dz; z2 += 0.001*dz;
4414 p(0) = -1; p(3) = x2;
4416 p(0) = 1; p(3) = -x1;
4418 p(0) = 0; p(1) = -1; p(3) = y2;
4420 p(1) = 1; p(3) = -y1;
4422 p(1) = 0; p(2) = -1; p(3) = z2;
4424 p(2) = 1; p(3) = -z1;
4433 octave_unused_parameter (x1);
4434 octave_unused_parameter (x2);
4435 octave_unused_parameter (y1);
4436 octave_unused_parameter (y2);
4437 octave_unused_parameter (z1);
4438 octave_unused_parameter (z2);
4443 error_unexpected (
"opengl_renderer::set_clipbox");
4451#if defined (HAVE_OPENGL)
4455 if (enable != has_clipping)
4458 for (
int i = 0; i < 6; i++)
4461 for (
int i = 0; i < 6; i++)
4467 octave_unused_parameter (enable);
4472 error_unexpected (
"opengl_renderer::set_clipping");
4480#if defined (HAVE_OPENGL)
4493 m_marker_id = make_marker_list (m, size,
false);
4494 m_filled_marker_id = make_marker_list (m, size,
true);
4498 octave_unused_parameter (m);
4499 octave_unused_parameter (size);
4500 octave_unused_parameter (width);
4505 error_unexpected (
"opengl_renderer::init_marker");
4513#if defined (HAVE_OPENGL)
4515 m_marker_id = make_marker_list (m, size,
false);
4516 m_filled_marker_id = make_marker_list (m, size,
true);
4520 octave_unused_parameter (m);
4521 octave_unused_parameter (size);
4526 error_unexpected (
"opengl_renderer::change_marker");
4534#if defined (HAVE_OPENGL)
4550 error_unexpected (
"opengl_renderer::end_marker");
4558 const double la,
const double fa)
4560#if defined (HAVE_OPENGL)
4567 if (m_filled_marker_id > 0 && fc.
numel () > 0)
4572 if (lc.
numel () > 0)
4583 else if (m_marker_id > 0 && lc.
numel () > 0)
4591 octave_unused_parameter (
x);
4592 octave_unused_parameter (y);
4593 octave_unused_parameter (z);
4594 octave_unused_parameter (lc);
4595 octave_unused_parameter (fc);
4596 octave_unused_parameter (la);
4597 octave_unused_parameter (fa);
4602 error_unexpected (
"opengl_renderer::draw_marker");
4608opengl_renderer::init_maxlights ()
4610#if defined (HAVE_OPENGL)
4613 if (m_max_lights == 0)
4617 m_max_lights = max_lights;
4625 error_unexpected (
"opengl_renderer::init_maxlights");
4631opengl_renderer::get_string (
unsigned int id)
const
4633#if defined (HAVE_OPENGL)
4639 std::ostringstream buf;
4643 return std::string (buf.str ());
4647 octave_unused_parameter (
id);
4652 error_unexpected (
"opengl_renderer::get_string");
4653 return std::string ();
4659opengl_renderer::set_normal (
int bfl_mode,
const NDArray& n,
int j,
int i)
4661#if defined (HAVE_OPENGL)
4663 double x = n(j, i, 0);
4664 double y = n(j, i, 1);
4665 double z = n(j, i, 2);
4667 double d = sqrt (
x*
x + y*y + z*z);
4672 dir = ((
x*m_view_vector(0) + y*m_view_vector(1) + z*m_view_vector(2) < 0)
4673 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
4679 octave_unused_parameter (bfl_mode);
4680 octave_unused_parameter (n);
4681 octave_unused_parameter (j);
4682 octave_unused_parameter (i);
4687 error_unexpected (
"opengl_renderer::set_normal");
4693opengl_renderer::points_to_pixels (
const double val)
const
4699 static const double pix_per_pts =
4700 gh_mgr.
get_object (0).get (
"screenpixelsperinch").double_value () / 72.0;
4702 double retval = val;
4705 retval *= pix_per_pts;
4711opengl_renderer::make_marker_list (
const std::string& marker,
double size,
4714#if defined (HAVE_OPENGL)
4718 if (filled && (c ==
'+' || c ==
'x' || c ==
'*' || c ==
'.'
4719 || c ==
'|' || c ==
'_'))
4725 double sz = points_to_pixels (size);
4728 const double sqrt2d4 = 0.35355339059327;
4729 double tt = sz*sqrt2d4;
4780 if (sz > 0 && sz < 3)
4783 int div =
static_cast<int> (M_PI * sz / 12);
4786 div = std::max (div, 3);
4787 double ang_step = M_PI / div;
4790 for (
double ang = 0; ang < 2*M_PI; ang += ang_step)
4805 int div =
static_cast<int> (M_PI * sz / 4);
4808 div = std::max (div, 5);
4809 double ang_step = M_PI / div;
4812 for (
double ang = 0; ang < 2*M_PI; ang += ang_step)
4856 dr = 1.0 - sin (M_PI/10)/sin (3*M_PI/10)*1.02;
4859 for (
int i = 0; i < 2*5; i++)
4861 ang = (-0.5 +
double (i+1) / 5) * M_PI;
4862 r = 1.0 - (dr * fmod (
double (i+1), 2.0));
4871 dr = 1.0 - 0.5/sin (M_PI/3)*1.02;
4874 for (
int i = 0; i < 2*6; i++)
4876 ang = (0.5 +
double (i+1) / 6.0) * M_PI;
4877 r = 1.0 - (dr * fmod (
double (i+1), 2.0));
4884 warning (
"opengl_renderer: unsupported marker '%s'", marker.c_str ());
4894 octave_unused_parameter (marker);
4895 octave_unused_parameter (size);
4896 octave_unused_parameter (filled);
4901 error_unexpected (
"opengl_renderer::make_marker_list");
4910 int halign,
int valign,
double rotation)
4912 m_txt_renderer.
text_to_pixels (txt, pixels, bbox, halign, valign,
4913 rotation, m_interpreter);
4918 std::list<text_renderer::string>& lst,
4920 int halign,
int valign,
double rotation)
4923 rotation, m_interpreter);
4928 double x,
double y,
double z,
4929 int halign,
int valign,
double rotation)
4931#if defined (HAVE_OPENGL)
4938 if (m_txt_renderer.
ok ())
4950 octave_unused_parameter (txt);
4951 octave_unused_parameter (
x);
4952 octave_unused_parameter (y);
4953 octave_unused_parameter (z);
4954 octave_unused_parameter (halign);
4955 octave_unused_parameter (valign);
4956 octave_unused_parameter (rotation);
4961 error_unexpected (
"opengl_renderer::render_text");
4968 double x,
double y,
double z,
double rotation)
4970#if defined (HAVE_OPENGL)
4983 set_ortho_coordinates ();
4995 draw_texture_image (pixels.
permute (perm),
4996 xdata, ydata,
true);
4998 restore_previous_coordinates ();
5007 octave_unused_parameter (pixels);
5008 octave_unused_parameter (bbox);
5009 octave_unused_parameter (
x);
5010 octave_unused_parameter (y);
5011 octave_unused_parameter (z);
5012 octave_unused_parameter (rotation);
5017 error_unexpected (
"opengl_renderer::render_text");
5022OCTAVE_END_NAMESPACE(octave)
N Dimensional Array with copy-on-write semantics.
const dim_vector & dims() const
Return a const-reference so that dims ()(i) works efficiently.
octave_idx_type rows() const
octave_idx_type columns() const
bool isempty() const
Size of the specified dimension.
const T * data() const
Size of the specified dimension.
T * rwdata()
Size of the specified dimension.
octave_idx_type numel() const
Number of elements in the array.
MArray< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
Vector representing the dimensions (size) of an Array.
octave_idx_type ndims() const
Number of dimensions.
graphics_object get_object(double val) const
uint16NDArray uint16_array_value() const
bool is_single_type() const
bool is_uint8_type() const
bool is_uint16_type() const
NDArray array_value(bool frc_str_conv=false) const
bool is_double_type() const
uint8NDArray uint8_array_value() const
FloatNDArray float_array_value(bool frc_str_conv=false) const
virtual GLboolean glIsEnabled(GLenum cap)
virtual void glHint(GLenum target, GLenum mode)
virtual void glGetIntegerv(GLenum pname, GLint *data)
virtual void glBegin(GLenum mode)
virtual void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
virtual void glClipPlane(GLenum plane, const GLdouble *equation)
virtual void glMatrixMode(GLenum mode)
virtual void glBindTexture(GLenum target, GLuint texture)
virtual void glVertex2d(GLdouble x, GLdouble y)
virtual void glNewList(GLuint list, GLenum mode)
virtual void glPopMatrix()
virtual void glVertex3d(GLdouble x, GLdouble y, GLdouble z)
virtual void glLineStipple(GLint factor, GLushort pattern)
virtual void glLoadIdentity()
virtual void glPolygonOffset(GLfloat factor, GLfloat units)
virtual void glLineWidth(GLfloat width)
virtual void glColor3fv(const GLfloat *v)
virtual void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
virtual void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
virtual const GLubyte * glGetString(GLenum name)
virtual void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
virtual void glGenTextures(GLsizei n, GLuint *textures)
virtual void glDisable(GLenum cap)
virtual void glCallList(GLuint list)
virtual void glDepthFunc(GLenum fcn)
virtual void glClear(GLbitfield mask)
virtual void glNormal3dv(const GLdouble *v)
virtual void glColor3f(GLfloat red, GLfloat green, GLfloat blue)
virtual void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
virtual void glVertex3dv(const GLdouble *v)
virtual void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
virtual void glAlphaFunc(GLenum fcn, GLclampf ref)
virtual void glMaterialf(GLenum face, GLenum pname, GLfloat param)
virtual void glPolygonMode(GLenum face, GLenum mode)
virtual void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
virtual void glColor3dv(const GLdouble *v)
virtual GLuint glGenLists(GLsizei range)
virtual void glDeleteLists(GLuint list, GLsizei range)
virtual void glColor4fv(const GLfloat *v)
virtual void glTexParameteri(GLenum target, GLenum pname, GLint param)
virtual void glPopAttrib()
virtual void glEnable(GLenum cap)
virtual void glGetBooleanv(GLenum pname, GLboolean *data)
virtual void glBlendFunc(GLenum sfactor, GLenum dfactor)
virtual void glShadeModel(GLenum mode)
virtual void glEdgeFlag(GLboolean flag)
virtual void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val)
virtual void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
virtual void glPushAttrib(GLbitfield mask)
virtual void glMultMatrixd(const GLdouble *m)
virtual void glPixelStorei(GLenum pname, GLint param)
virtual void glPushMatrix()
virtual void glScaled(GLdouble x, GLdouble y, GLdouble z)
virtual void glLightfv(GLenum light, GLenum pname, const GLfloat *params)
virtual GLenum glGetError()
virtual void glTranslated(GLdouble x, GLdouble y, GLdouble z)
virtual void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
virtual uint8NDArray get_pixels(int width, int height)
virtual void draw_patch(const patch::properties &props)
opengl_functions & m_glfcns
virtual void init_marker(const std::string &m, double size, float width)
virtual void set_linestyle(const std::string &s, bool stipple=false, double linewidth=0.5)
virtual void set_clipping(bool on)
virtual void text_to_pixels(const std::string &txt, uint8NDArray &pixels, Matrix &bbox, int halign=0, int valign=0, double rotation=0.0)
virtual void set_linewidth(float w)
virtual void draw_scatter(const scatter::properties &props)
virtual Matrix get_viewport_scaled() const
virtual void draw_line(const line::properties &props)
virtual void draw_uibuttongroup(const uibuttongroup::properties &props, const graphics_object &go)
opengl_renderer(opengl_functions &glfcns)
virtual void draw_text_background(const text::properties &props, bool do_rotate=false)
virtual Matrix render_text(const std::string &txt, double x, double y, double z, int halign, int valign, double rotation=0.0)
virtual void draw_image(const image::properties &props)
virtual void render_grid(const double linewidth, const std::string &gridstyle, const Matrix &gridcolor, const double gridalpha, const Matrix &ticks, double lim1, double lim2, double p1, double p1N, double p2, double p2N, int xyz, bool is_3D)
virtual void draw_marker(double x, double y, double z, const Matrix &lc, const Matrix &fc, const double la=1.0, const double fa=1.0)
virtual void init_gl_context(bool enhanced, const Matrix &backgroundColor)
virtual void draw(const graphics_object &go, bool toplevel=true)
virtual void draw_hggroup(const hggroup::properties &props)
virtual void draw_axes(const axes::properties &props)
virtual void change_marker(const std::string &m, double size)
virtual void set_polygon_offset(bool on, float offset=0.0f)
virtual void draw_surface(const surface::properties &props)
virtual void draw_uipanel(const uipanel::properties &props, const graphics_object &go)
virtual void draw_zoom_rect(int x1, int y1, int x2, int y2)
virtual void set_interpreter(const caseless_str &interp)
virtual void render_ticktexts(const Matrix &ticks, const string_vector &ticklabels, double lim1, double lim2, double p1, double p2, int xyz, int ha, int va, int &wmax, int &hmax)
virtual void draw_light(const light::properties &props)
virtual void draw_zoom_box(int width, int height, int x1, int y1, int x2, int y2, const Matrix &overlaycolor, double overlayalpha, const Matrix &bordercolor, double borderalpha, double borderwidth)
virtual void end_marker()
virtual void set_viewport(int w, int h)
virtual graphics_xform get_transform() const
virtual void draw_text(const text::properties &props)
virtual void set_font(const base_properties &props)
virtual void set_linecap(const std::string &)
virtual void draw_figure(const figure::properties &props)
virtual void text_to_strlist(const std::string &txt, std::list< text_renderer::string > &lst, Matrix &bbox, int halign=0, int valign=0, double rotation=0.0)
virtual void render_tickmarks(const Matrix &ticks, double lim1, double lim2, double p1, double p1N, double p2, double p2N, double dx, double dy, double dz, int xyz, bool doubleside, bool tickdir_both)
virtual void set_clipbox(double x1, double x2, double y1, double y2, double z1, double z2)
virtual void setup_opengl_transformation(const axes::properties &props)
virtual void set_linejoin(const std::string &)
virtual void set_color(const Matrix &c)
octave_idx_type numel() const
void text_to_strlist(const std::string &txt, std::list< string > &lst, Matrix &box, int halign, int valign, double rotation=0.0, const caseless_str &interpreter="tex")
void text_to_pixels(const std::string &txt, uint8NDArray &pxls, Matrix &bbox, int halign, int valign, double rotation=0.0, const caseless_str &interpreter="tex", bool handle_rotation=true)
void set_anti_aliasing(bool val)
void set_color(const Matrix &c)
void set_font(const std::string &name, const std::string &weight, const std::string &angle, double size)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void warning(const char *fmt,...)
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
gh_manager & __get_gh_manager__()
std::complex< double > w(std::complex< double > z, double relerr=0)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x
F77_RET_T const F77_DBLE const F77_DBLE * f