26#if defined (HAVE_CONFIG_H)
34#if defined (HAVE_WINDOWS_H)
35# define WIN32_LEAN_AND_MEAN
50#if defined (HAVE_OPENGL)
63#define LIGHT_MODE GL_FRONT_AND_BACK
93#if ! defined (CALLBACK)
162 void bind (
int mode = GL_TEXTURE_2D)
const {
m_rep->bind (mode); }
185 if (dv.
ndims () == 3 && (dv(2) == 3 || dv(2) == 4))
190 h = dv(0),
w = dv(1);
195 glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_size);
196 static bool warned =
false;
197 if (h > max_size ||
w > max_size)
201 warning (
"opengl_texture::create: the opengl library in use "
202 "doesn't support images with either dimension larger "
203 "than %d. Not rendering.", max_size);
225 for (
int i = 0; i < h; i++)
227 for (
int j = 0, idx = i*tw*3; j <
w; j++, idx += 3)
229 a[idx] = xdata(i,j,0);
230 a[idx+1] = xdata(i,j,1);
231 a[idx+2] = xdata(i,j,2);
235 glfcns.
glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB,
245 for (
int i = 0; i < h; i++)
247 for (
int j = 0, idx = i*tw*3; j <
w; j++, idx += 3)
249 a[idx] = xdata(i,j,0);
250 a[idx+1] = xdata(i,j,1);
251 a[idx+2] = xdata(i,j,2);
255 glfcns.
glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB,
264 for (
int i = 0; i < h; i++)
266 for (
int j = 0, idx = i*tw*3; j <
w; j++, idx += 3)
268 a[idx] = xdata(i,j,0);
269 a[idx+1] = xdata(i,j,1);
270 a[idx+2] = xdata(i,j,2);
275 GL_RGB, GL_UNSIGNED_SHORT, a);
283 for (
int i = 0; i < h; i++)
285 for (
int j = 0, idx = i*tw*3; j <
w; j++, idx += 3)
287 a[idx] = xdata(i,j,0);
288 a[idx+1] = xdata(i,j,1);
289 a[idx+2] = xdata(i,j,2);
294 GL_RGB, GL_UNSIGNED_BYTE, a);
302 for (
int i = 0; i < h; i++)
304 for (
int j = 0, idx = i*tw*4; j <
w; j++, idx += 4)
306 a[idx] = xdata(i,j,0);
307 a[idx+1] = xdata(i,j,1);
308 a[idx+2] = xdata(i,j,2);
309 a[idx+3] = xdata(i,j,3);
313 glfcns.
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0,
314 GL_RGBA, GL_UNSIGNED_BYTE, a);
319 warning (
"opengl_texture::create: invalid image data type, expected double, single, uint8, or uint16");
330 warning (
"opengl_texture::create: OpenGL error while generating texture data");
336 warning (
"opengl_texture::create: invalid texture data size");
345#if defined (HAVE_FRAMEWORK_OPENGL) && defined (HAVE_GLUTESSCALLBACK_THREEDOTS)
346 typedef GLvoid (
CALLBACK *fcn) (...);
362 {
if (m_glu_tess) gluDeleteTess (m_glu_tess); }
366 gluTessProperty (m_glu_tess, GLU_TESS_BOUNDARY_ONLY,
367 (filled ? GL_FALSE : GL_TRUE));
369 gluTessBeginPolygon (m_glu_tess,
this);
373 { gluTessEndPolygon (m_glu_tess); }
376 { gluTessBeginContour (m_glu_tess); }
379 { gluTessEndContour (m_glu_tess); }
382 { gluTessVertex (m_glu_tess,
loc, data); }
387 virtual void end (
void) { }
391 virtual void combine (GLdouble [3] ,
void * [4] ,
392 GLfloat [4] ,
void ** ) { }
397 {
::error (
"OpenGL tessellation error (%d)", err); }
401 m_glu_tess = gluNewTess ();
403 gluTessCallback (m_glu_tess, GLU_TESS_BEGIN_DATA,
404 reinterpret_cast<fcn
> (tess_begin));
405 gluTessCallback (m_glu_tess, GLU_TESS_END_DATA,
406 reinterpret_cast<fcn
> (tess_end));
407 gluTessCallback (m_glu_tess, GLU_TESS_VERTEX_DATA,
408 reinterpret_cast<fcn
> (tess_vertex));
409 gluTessCallback (m_glu_tess, GLU_TESS_COMBINE_DATA,
410 reinterpret_cast<fcn
> (tess_combine));
411 gluTessCallback (m_glu_tess, GLU_TESS_EDGE_FLAG_DATA,
412 reinterpret_cast<fcn
> (tess_edge_flag));
413 gluTessCallback (m_glu_tess, GLU_TESS_ERROR_DATA,
414 reinterpret_cast<fcn
> (tess_error));
460 const Matrix& fn,
double a,
float as,
float ds,
float ss,
485 const Matrix& fn,
double a,
float as,
float ds,
float ss,
500 static std::shared_ptr<vertex_data_rep>
nil_rep (
void)
507 std::shared_ptr<vertex_data_rep>
m_rep;
517 m_color_mode (cmode), m_light_mode (lmode), m_face_lighting (fl),
518 m_index (idx), m_first (true), m_tmp_vdata ()
535 m_renderer->set_polygon_offset (
true, m_index);
546 m_renderer->set_polygon_offset (
false);
560 if (m_color_mode ==
INTERP || (m_color_mode ==
FLAT && ! is_filled ()))
564 if (col.
numel () == 3)
567 if (m_light_mode > 0)
570 float buf[4] = { 0.0f, 0.0f, 0.0f, 1.0f };;
573 for (
int k = 0; k < 3; k++)
580 for (
int k = 0; k < 3; k++)
584 for (
int k = 0; k < 3; k++)
591 if (m_light_mode ==
FLAT && m_first)
593 else if (m_light_mode ==
GOURAUD)
601 void combine (GLdouble xyz[3],
void *data[4], GLfloat
w[4],
void **out_data)
606 for (
int i = 0; i < 4; i++)
610 if (vmax == 4 && ! v[i])
624 if (v[0]->m_color.numel ())
627 for (
int ic = 0; ic < 3; ic++)
628 for (
int iv = 0; iv < vmax; iv++)
629 cc(ic) += (
w[iv] * v[iv]->
m_color (ic));
632 if (v[0]->m_vertex_normal.numel () > 0)
634 for (
int in = 0; in < 3; in++)
635 for (
int iv = 0; iv < vmax; iv++)
639 if (v[0]->m_face_normal.numel () > 0)
641 for (
int in = 0; in < 3; in++)
642 for (
int iv = 0; iv < vmax; iv++)
646 for (
int iv = 0; iv < vmax; iv++)
647 aa += (
w[iv] * v[iv]->m_alpha);
649 vertex_data new_v (vv, cc, vnn, fnn, aa, v[0]->m_ambient, v[0]->m_diffuse,
650 v[0]->m_specular, v[0]->m_specular_exp,
651 v[0]->m_specular_color_refl);
652 m_tmp_vdata.push_back (new_v);
685 : m_glfcns (glfcns), m_xmin (), m_xmax (), m_ymin (), m_ymax (),
686 m_zmin (), m_zmax (), m_devpixratio (1.0), m_xform (), m_toolkit (),
687 m_xZ1 (), m_xZ2 (), m_marker_id (), m_filled_marker_id (),
688 m_camera_pos (), m_camera_dir (), m_view_vector (),
689 m_interpreter (
"none"), m_txt_renderer (), m_current_light (0),
690 m_max_lights (0), m_selecting (false), m_printing (false)
696#if defined (HAVE_OPENGL)
701 static bool ok = (
sizeof (
int) <=
sizeof (GLsizei));
704 error (
"the size of GLsizei is smaller than the size of int");
716 if (! go.valid_object ())
719 const base_properties& props = go.get_properties ();
724 if (go.isa (
"figure"))
726 else if (go.isa (
"axes"))
728 else if (go.isa (
"line"))
730 else if (go.isa (
"surface"))
732 else if (go.isa (
"patch"))
734 else if (go.isa (
"scatter"))
736 else if (go.isa (
"light"))
738 else if (go.isa (
"hggroup"))
740 else if (go.isa (
"text"))
742 else if (go.isa (
"image"))
744 else if (go.isa (
"uimenu") || go.isa (
"uicontrol")
745 || go.isa (
"uicontextmenu") || go.isa (
"uitoolbar")
746 || go.isa (
"uipushtool") || go.isa (
"uitoggletool")
747 || go.isa (
"uitable"))
749 else if (go.isa (
"uipanel"))
754 else if (go.isa (
"uibuttongroup"))
761 warning (
"opengl_renderer: cannot render object of type '%s'",
762 props.graphics_object_name ().c_str ());
765#if defined (HAVE_OPENGL)
769 warning (
"opengl_renderer: Error '%s' (%d) occurred drawing '%s' object",
770 gluErrorString (gl_error), gl_error,
771 props.graphics_object_name ().c_str ());
782 init_gl_context (props.is_graphicssmoothing (), props.get_color_rgb ());
784#if defined (HAVE_OPENGL)
786 props.set___gl_extensions__ (
get_string (GL_EXTENSIONS));
787 props.set___gl_renderer__ (
get_string (GL_RENDERER));
788 props.set___gl_vendor__ (
get_string (GL_VENDOR));
789 props.set___gl_version__ (
get_string (GL_VERSION));
795 draw (props.get_all_children (),
false);
800 const graphics_object& go)
802 graphics_object fig = go.get_ancestor (
"figure");
809 props.get_backgroundcolor_rgb ());
813 draw (props.get_all_children (),
false);
818 const graphics_object& go)
820 graphics_object fig = go.get_ancestor (
"figure");
827 props.get_backgroundcolor_rgb ());
831 draw (props.get_all_children (),
false);
837#if defined (HAVE_OPENGL)
851 bool has_multisample =
false;
854 GLint iMultiSample, iNumSamples;
857 if (iMultiSample == GL_TRUE && iNumSamples > 0)
858 has_multisample =
true;
861 if (! has_multisample)
888 warning (
"opengl_renderer: Error '%s' (%d) occurred in init_gl_context",
889 gluErrorString (gl_error), gl_error);
893 octave_unused_parameter (enhanced);
894 octave_unused_parameter (c);
906 const std::string& gridstyle,
907 const Matrix& gridcolor,
const double gridalpha,
908 const Matrix& ticks,
double lim1,
double lim2,
909 double p1,
double p1N,
double p2,
double p2N,
912#if defined (HAVE_OPENGL)
917 for (
int i = 0; i < ticks.
numel (); i++)
919 double val = ticks(i);
920 if (lim1 <= val && val <= lim2)
953 double black[3] = {0, 0, 0};
958 octave_unused_parameter (linewidth);
959 octave_unused_parameter (gridstyle);
960 octave_unused_parameter (gridcolor);
961 octave_unused_parameter (gridalpha);
962 octave_unused_parameter (ticks);
963 octave_unused_parameter (lim1);
964 octave_unused_parameter (lim2);
965 octave_unused_parameter (p1);
966 octave_unused_parameter (p1N);
967 octave_unused_parameter (p2);
968 octave_unused_parameter (p2N);
969 octave_unused_parameter (xyz);
970 octave_unused_parameter (is_3D);
982 double lim1,
double lim2,
983 double p1,
double p1N,
984 double p2,
double p2N,
985 double dx,
double dy,
double dz,
986 int xyz,
bool mirror)
988#if defined (HAVE_OPENGL)
992 for (
int i = 0; i < ticks.
numel (); i++)
994 double val = ticks(i);
996 if (lim1 <= val && val <= lim2)
1035 octave_unused_parameter (ticks);
1036 octave_unused_parameter (lim1);
1037 octave_unused_parameter (lim2);
1038 octave_unused_parameter (p1);
1039 octave_unused_parameter (p1N);
1040 octave_unused_parameter (p2);
1041 octave_unused_parameter (p2N);
1042 octave_unused_parameter (dx);
1043 octave_unused_parameter (dy);
1044 octave_unused_parameter (dz);
1045 octave_unused_parameter (xyz);
1046 octave_unused_parameter (mirror);
1059 double lim1,
double lim2,
1060 double p1,
double p2,
1061 int xyz,
int ha,
int va,
1062 int& wmax,
int& hmax)
1064#if defined (HAVE_OPENGL)
1066 int nticks = ticks.
numel ();
1067 int nlabels = ticklabels.
numel ();
1072 for (
int i = 0; i < nticks; i++)
1074 double val = ticks(i);
1076 if (lim1 <= val && val <= lim2)
1080 std::string label (ticklabels(i % nlabels));
1081 label.erase (0, label.find_first_not_of (
' '));
1082 label = label.substr (0, label.find_last_not_of (
' ')+1);
1099 wmax =
std::max (wmax,
static_cast<int> (b(2)));
1100 hmax =
std::max (hmax,
static_cast<int> (b(3)));
1106 octave_unused_parameter (ticks);
1107 octave_unused_parameter (ticklabels);
1108 octave_unused_parameter (lim1);
1109 octave_unused_parameter (lim2);
1110 octave_unused_parameter (p1);
1111 octave_unused_parameter (p2);
1112 octave_unused_parameter (xyz);
1113 octave_unused_parameter (ha);
1114 octave_unused_parameter (va);
1115 octave_unused_parameter (wmax);
1116 octave_unused_parameter (hmax);
1129#if defined (HAVE_OPENGL)
1139 octave_unused_parameter (x1);
1140 octave_unused_parameter (x2);
1141 octave_unused_parameter (y1);
1142 octave_unused_parameter (y2);
1154 int x1,
int y1,
int x2,
int y2,
1155 const Matrix& overlaycolor,
1156 double overlayalpha,
1157 const Matrix& bordercolor,
1158 double borderalpha,
double borderwidth)
1160#if defined (HAVE_OPENGL)
1197 octave_unused_parameter (width);
1198 octave_unused_parameter (height);
1199 octave_unused_parameter (x1);
1200 octave_unused_parameter (x2);
1201 octave_unused_parameter (y1);
1202 octave_unused_parameter (y2);
1203 octave_unused_parameter (overlaycolor);
1204 octave_unused_parameter (overlayalpha);
1205 octave_unused_parameter (bordercolor);
1206 octave_unused_parameter (borderalpha);
1207 octave_unused_parameter (borderwidth);
1220#if defined (HAVE_OPENGL)
1246 octave_unused_parameter (width);
1247 octave_unused_parameter (height);
1257#if defined (HAVE_OPENGL)
1274#if defined (HAVE_OPENGL)
1278 Matrix x_zlim = props.get_transform_zlim ();
1282 const double expansion_fac = 100.0;
1286 const double single_prec_fac = 10.0;
1288 double avgZ = x_zlim(0) / 2.0 + x_zlim(1) / 2.0;
1290 =
std::max (expansion_fac * (x_zlim(1)-x_zlim(0)),
1292 * std::numeric_limits<float>::epsilon ());
1293 m_xZ1 = avgZ - span;
1294 m_xZ2 = avgZ + span;
1296 Matrix x_mat1 = props.get_opengl_matrix_1 ();
1297 Matrix x_mat2 = props.get_opengl_matrix_2 ();
1315 m_xform = props.get_transform ();
1319 octave_unused_parameter (props);
1332#if defined (HAVE_OPENGL)
1334 Matrix axe_color = props.get_color_rgb ();
1335 if (axe_color.
isempty () || ! props.is_visible ())
1338 double xPlane = props.get_xPlane ();
1339 double yPlane = props.get_yPlane ();
1340 double zPlane = props.get_zPlane ();
1341 double xPlaneN = props.get_xPlaneN ();
1342 double yPlaneN = props.get_yPlaneN ();
1343 double zPlaneN = props.get_zPlaneN ();
1344 bool is2D = props.get_is2D ();
1379 octave_unused_parameter (props);
1392#if defined (HAVE_OPENGL)
1394 if (! props.is_visible ())
1397 bool xySym = props.get_xySym ();
1398 bool layer2Dtop = props.get_layer2Dtop ();
1399 bool is2D = props.get_is2D ();
1400 bool isXOrigin = props.xaxislocation_is (
"origin")
1401 && ! props.yscale_is (
"log");
1402 bool isYOrigin = props.yaxislocation_is (
"origin")
1403 && ! props.xscale_is (
"log");
1404 bool boxFull = (props.get_boxstyle () ==
"full");
1405 double linewidth = props.get_linewidth ();
1406 double xPlane = props.get_xPlane ();
1407 double yPlane = props.get_yPlane ();
1408 double zPlane = props.get_zPlane ();
1409 double xPlaneN = props.get_xPlaneN ();
1410 double yPlaneN = props.get_yPlaneN ();
1411 double zPlaneN = props.get_zPlaneN ();
1412 double xpTick = props.get_xpTick ();
1413 double ypTick = props.get_ypTick ();
1414 double zpTick = props.get_zpTick ();
1415 double xpTickN = props.get_xpTickN ();
1416 double ypTickN = props.get_ypTickN ();
1417 double zpTickN = props.get_zpTickN ();
1419 bool plotyy = (props.has_property (
"__plotyy_axes__"));
1429 std::swap (zpTick, zpTickN);
1432 Matrix color = props.get_xcolor_rgb ();
1438 if (! isXOrigin || props.is_box() || ! is2D)
1444 if (props.is_box ())
1462 color = props.get_ycolor_rgb ();
1467 if (! isYOrigin || props.is_box() || ! is2D)
1473 if (props.is_box () && ! plotyy)
1492 color = props.get_zcolor_rgb ();
1494 if (! color.
isempty () && ! is2D)
1509 if (props.is_box ())
1539 octave_unused_parameter (props);
1552#if defined (HAVE_OPENGL)
1557 int xstate = props.get_xstate ();
1559 if (xstate != AXE_DEPTH_DIR
1560 && (props.is_visible ()
1561 || (
m_selecting && props.pickableparts_is (
"all"))))
1563 int zstate = props.get_zstate ();
1564 bool x2Dtop = props.get_x2Dtop ();
1565 bool layer2Dtop = props.get_layer2Dtop ();
1566 bool xyzSym = props.get_xyzSym ();
1567 bool nearhoriz = props.get_nearhoriz ();
1568 double xticklen = props.get_xticklen ();
1569 double xtickoffset = props.get_xtickoffset ();
1570 double fy = props.get_fy ();
1571 double fz = props.get_fz ();
1572 double x_min = props.get_x_min ();
1573 double x_max = props.get_x_max ();
1574 double y_min = props.get_y_min ();
1575 double y_max = props.get_y_max ();
1576 double yPlane = props.get_yPlane ();
1577 double yPlaneN = props.get_yPlaneN ();
1578 double ypTick = props.get_ypTick ();
1579 double ypTickN = props.get_ypTickN ();
1580 double zPlane = props.get_zPlane ();
1581 double zPlaneN = props.get_zPlaneN ();
1582 double zpTick = props.get_zpTick ();
1583 double zpTickN = props.get_zpTickN ();
1586 Matrix xticks =
m_xform.xscale (props.get_xtick ().matrix_value ());
1587 Matrix xmticks =
m_xform.xscale (props.get_xminortickvalues ().matrix_value ());
1588 bool do_xminortick = props.is_xminortick () && ! xticks.
isempty ();
1589 string_vector xticklabels = props.get_xticklabel ().string_vector_value ();
1592 bool tick_along_z = nearhoriz ||
math::isinf (fy);
1593 double linewidth = props.get_linewidth ();
1594 std::string gridstyle = props.get_gridlinestyle ();
1595 std::string minorgridstyle = props.get_minorgridlinestyle ();
1596 Matrix gridcolor = props.get_gridcolor_rgb ();
1597 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1598 double gridalpha = props.get_gridalpha ();
1599 double minorgridalpha = props.get_minorgridalpha ();
1600 bool do_xgrid = (props.is_xgrid () && (gridstyle !=
"none"));
1601 bool do_xminorgrid = (props.is_xminorgrid ()
1602 && (minorgridstyle !=
"none")
1604 bool is_origin = props.xaxislocation_is (
"origin") && props.get_is2D ()
1605 && ! props.yscale_is (
"log");
1606 bool is_origin_low = is_origin && (y_min + y_max) < 0;
1607 bool mirror = props.is_box () && xstate != AXE_ANY_DIR;
1612 if (props.gridcolormode_is (
"auto"))
1613 if (props.xcolormode_is (
"manual") && ! props.xcolor_is (
"none"))
1614 gridcolor = props.get_xcolor_rgb ();
1616 if (props.minorgridcolormode_is (
"auto"))
1617 if (props.xcolormode_is (
"manual") && ! props.xcolor_is (
"none"))
1618 minorgridcolor = props.get_xcolor_rgb ();
1623 if (minorgridcolor.
isempty ())
1624 do_xminorgrid =
false;
1627 if (do_xminorgrid && ! do_xgrid)
1629 gridstyle = minorgridstyle;
1630 gridcolor = minorgridcolor;
1631 gridalpha = minorgridalpha;
1638 minorgridstyle, minorgridcolor, minorgridalpha,
1639 xmticks, x_min, x_max,
1640 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1641 0, (zstate != AXE_DEPTH_DIR));
1646 gridstyle, gridcolor, gridalpha,
1647 xticks, x_min, x_max,
1648 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1649 0, (zstate != AXE_DEPTH_DIR));
1652 if (props.xcolor_is (
"none"))
1658 double y_axis_pos = 0.;
1674 is_origin ? y_axis_pos : ypTick, ypTick,
1675 zpTick, zpTickN, 0., 0.,
1676 (is_origin_low ? -1. : 1.) *
1678 0, ! is_origin && mirror);
1681 is_origin ? y_axis_pos : ypTick, ypTickN,
1683 (is_origin_low ? -1. : 1.) *
1685 0., 0, ! is_origin && mirror);
1691 is_origin ? y_axis_pos : ypTick, ypTick,
1692 zpTick, zpTickN, 0., 0.,
1693 (is_origin_low ? -1. : 1.) *
1695 0, ! is_origin && mirror);
1698 is_origin ? y_axis_pos : ypTick, ypTickN,
1700 (is_origin_low ? -1. : 1.) *
1702 0., 0, ! is_origin && mirror);
1705 if (xticklabels.
numel () > 0)
1707 int halign = (xstate == AXE_HORZ_DIR
1709 : (xyzSym || is_origin_low ? 0 : 2));
1710 int valign = (xstate == AXE_VERT_DIR
1712 : (x2Dtop || is_origin_low ? 0 : 2));
1716 is_origin ? y_axis_pos : ypTick,
1718 (is_origin_low ? -1. : 1.) *
1720 0, halign, valign, wmax, hmax);
1723 (is_origin ? y_axis_pos : ypTick) +
1724 (is_origin_low ? -1. : 1.) *
1726 zpTick, 0, halign, valign, wmax, hmax);
1729 gh_mgr.get_object (props.get_xlabel ()).set (
"visible",
"on");
1732 gh_mgr.get_object (props.get_xlabel ()).set (
"visible",
"off");
1736 octave_unused_parameter (props);
1749#if defined (HAVE_OPENGL)
1754 int ystate = props.get_ystate ();
1756 if (ystate != AXE_DEPTH_DIR && props.is_visible ()
1757 && (props.is_visible ()
1758 || (
m_selecting && props.pickableparts_is (
"all"))))
1760 int zstate = props.get_zstate ();
1761 bool y2Dright = props.get_y2Dright ();
1762 bool layer2Dtop = props.get_layer2Dtop ();
1763 bool xyzSym = props.get_xyzSym ();
1764 bool nearhoriz = props.get_nearhoriz ();
1765 double yticklen = props.get_yticklen ();
1766 double ytickoffset = props.get_ytickoffset ();
1767 double fx = props.get_fx ();
1768 double fz = props.get_fz ();
1769 double xPlane = props.get_xPlane ();
1770 double xPlaneN = props.get_xPlaneN ();
1771 double xpTick = props.get_xpTick ();
1772 double xpTickN = props.get_xpTickN ();
1773 double y_min = props.get_y_min ();
1774 double y_max = props.get_y_max ();
1775 double x_min = props.get_x_min ();
1776 double x_max = props.get_x_max ();
1777 double zPlane = props.get_zPlane ();
1778 double zPlaneN = props.get_zPlaneN ();
1779 double zpTick = props.get_zpTick ();
1780 double zpTickN = props.get_zpTickN ();
1783 Matrix yticks =
m_xform.yscale (props.get_ytick ().matrix_value ());
1784 Matrix ymticks =
m_xform.yscale (props.get_yminortickvalues ().matrix_value ());
1785 bool do_yminortick = props.is_yminortick () && ! yticks.
isempty ();
1786 string_vector yticklabels = props.get_yticklabel ().string_vector_value ();
1789 bool tick_along_z = nearhoriz ||
math::isinf (fx);
1790 double linewidth = props.get_linewidth ();
1791 std::string gridstyle = props.get_gridlinestyle ();
1792 std::string minorgridstyle = props.get_minorgridlinestyle ();
1793 Matrix gridcolor = props.get_gridcolor_rgb ();
1794 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1795 double gridalpha = props.get_gridalpha ();
1796 double minorgridalpha = props.get_minorgridalpha ();
1797 bool do_ygrid = (props.is_ygrid () && (gridstyle !=
"none"));
1798 bool do_yminorgrid = (props.is_yminorgrid ()
1799 && (minorgridstyle !=
"none")
1801 bool is_origin = props.yaxislocation_is (
"origin") && props.get_is2D ()
1802 && ! props.xscale_is (
"log");
1803 bool is_origin_low = is_origin && (x_min + x_max) < 0;
1804 bool mirror = props.is_box () && ystate != AXE_ANY_DIR
1805 && (! props.has_property (
"__plotyy_axes__"));
1810 if (props.gridcolormode_is (
"auto"))
1811 if (props.ycolormode_is (
"manual") && ! props.ycolor_is (
"none"))
1812 gridcolor = props.get_ycolor_rgb ();
1814 if (props.minorgridcolormode_is (
"auto"))
1815 if (props.ycolormode_is (
"manual") && ! props.ycolor_is (
"none"))
1816 minorgridcolor = props.get_ycolor_rgb ();
1821 if (minorgridcolor.
isempty ())
1822 do_yminorgrid =
false;
1825 if (do_yminorgrid && ! do_ygrid)
1827 gridstyle = minorgridstyle;
1828 gridcolor = minorgridcolor;
1829 gridalpha = minorgridalpha;
1836 minorgridstyle, minorgridcolor, minorgridalpha,
1837 ymticks, y_min, y_max,
1838 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1839 1, (zstate != AXE_DEPTH_DIR));
1844 gridstyle, gridcolor, gridalpha,
1845 yticks, y_min, y_max,
1846 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1847 1, (zstate != AXE_DEPTH_DIR));
1850 if (props.ycolor_is (
"none"))
1856 double x_axis_pos = 0.;
1872 is_origin ? x_axis_pos : xpTick, xpTick,
1873 zpTick, zpTickN, 0., 0.,
1874 (is_origin_low ? -1. : 1.) *
1876 1, ! is_origin && mirror);
1879 is_origin ? x_axis_pos : xpTick, xpTickN,
1881 (is_origin_low ? -1. : 1.) *
1883 0., 0., 1, ! is_origin && mirror);
1889 is_origin ? x_axis_pos : xpTick, xpTick,
1890 zpTick, zpTickN, 0., 0.,
1891 (is_origin_low ? -1. : 1.) *
1893 1, ! is_origin && mirror);
1896 is_origin ? x_axis_pos : xpTick, xpTickN,
1898 (is_origin_low ? -1. : 1.) *
1900 0., 0., 1, ! is_origin && mirror);
1903 if (yticklabels.
numel () > 0)
1905 int halign = (ystate == AXE_HORZ_DIR
1907 : (! xyzSym || y2Dright || is_origin_low ? 0 : 2));
1908 int valign = (ystate == AXE_VERT_DIR
1910 : (is_origin_low ? 0 : 2));
1914 is_origin ? x_axis_pos : xpTick,
1916 (is_origin_low ? -1. : 1.) *
1918 1, halign, valign, wmax, hmax);
1921 (is_origin ? x_axis_pos : xpTick) +
1922 (is_origin_low ? -1. : 1.) *
1924 zpTick, 1, halign, valign, wmax, hmax);
1927 gh_mgr.get_object (props.get_ylabel ()).set (
"visible",
"on");
1930 gh_mgr.get_object (props.get_ylabel ()).set (
"visible",
"off");
1934 octave_unused_parameter (props);
1950 int zstate = props.get_zstate ();
1952 if (zstate != AXE_DEPTH_DIR && props.is_visible ()
1953 && (props.is_visible ()
1954 || (
m_selecting && props.pickableparts_is (
"all"))))
1956 bool xySym = props.get_xySym ();
1957 bool zSign = props.get_zSign ();
1958 double zticklen = props.get_zticklen ();
1959 double ztickoffset = props.get_ztickoffset ();
1960 double fx = props.get_fx ();
1961 double fy = props.get_fy ();
1962 double xPlane = props.get_xPlane ();
1963 double xPlaneN = props.get_xPlaneN ();
1964 double yPlane = props.get_yPlane ();
1965 double yPlaneN = props.get_yPlaneN ();
1966 double z_min = props.get_z_min ();
1967 double z_max = props.get_z_max ();
1970 Matrix zticks =
m_xform.zscale (props.get_ztick ().matrix_value ());
1971 Matrix zmticks =
m_xform.zscale (props.get_zminortickvalues ().matrix_value ());
1972 bool do_zminortick = props.is_zminortick () && ! zticks.
isempty ();
1973 string_vector zticklabels = props.get_zticklabel ().string_vector_value ();
1976 double linewidth = props.get_linewidth ();
1977 std::string gridstyle = props.get_gridlinestyle ();
1978 std::string minorgridstyle = props.get_minorgridlinestyle ();
1979 Matrix gridcolor = props.get_gridcolor_rgb ();
1980 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1981 double gridalpha = props.get_gridalpha ();
1982 double minorgridalpha = props.get_minorgridalpha ();
1983 bool do_zgrid = (props.is_zgrid () && (gridstyle !=
"none"));
1984 bool do_zminorgrid = (props.is_zminorgrid ()
1985 && (minorgridstyle !=
"none")
1987 bool mirror = props.is_box () && zstate != AXE_ANY_DIR;
1992 if (props.gridcolormode_is (
"auto"))
1993 if (props.zcolormode_is (
"manual") && ! props.zcolor_is (
"none"))
1994 gridcolor = props.get_zcolor_rgb ();
1996 if (props.minorgridcolormode_is (
"auto"))
1997 if (props.zcolormode_is (
"manual") && ! props.zcolor_is (
"none"))
1998 minorgridcolor = props.get_zcolor_rgb ();
2003 if (minorgridcolor.
isempty ())
2004 do_zminorgrid =
false;
2007 if (do_zminorgrid && ! do_zgrid)
2009 gridstyle = minorgridstyle;
2010 gridcolor = minorgridcolor;
2011 gridalpha = minorgridalpha;
2018 minorgridstyle, minorgridcolor, minorgridalpha,
2019 zmticks, z_min, z_max,
2020 xPlane, xPlaneN, yPlane, yPlaneN, 2,
true);
2025 gridstyle, gridcolor, gridalpha,
2026 zticks, z_min, z_max,
2027 xPlane, xPlaneN, yPlane, yPlaneN, 2,
true);
2030 if (props.zcolor_is (
"none"))
2055 yPlaneN, yPlane, 0.,
2084 yPlaneN, yPlane, 0.,
2095 if (zticklabels.
numel () > 0)
2098 int valign = (zstate == AXE_VERT_DIR ? 1 : (zSign ? 3 : 2));
2104 xPlaneN +
math::signum (xPlaneN-xPlane)*fx*ztickoffset,
2105 yPlane, 2, halign, valign, wmax, hmax);
2109 2, halign, valign, wmax, hmax);
2115 yPlaneN +
math::signum (yPlaneN-yPlane)*fy*ztickoffset,
2116 2, halign, valign, wmax, hmax);
2120 yPlaneN, 2, halign, valign, wmax, hmax);
2124 gh_mgr.get_object (props.get_zlabel ()).set (
"visible",
"on");
2127 gh_mgr.get_object (props.get_zlabel ()).set (
"visible",
"off");
2133#if defined (HAVE_OPENGL)
2135 GLboolean antialias;
2139 if (antialias == GL_TRUE)
2151 if (antialias == GL_TRUE)
2155 octave_unused_parameter (props);
2167 std::list<graphics_object>& obj_list)
2169#if defined (HAVE_OPENGL)
2173 Matrix children = props.get_all_children ();
2177 graphics_object go = gh_mgr.get_object (children(i));
2179 base_properties p = go.get_properties ();
2193 else if (go.isa (
"hggroup")
2194 && ! (
m_selecting && p.pickableparts_is (
"none")))
2196 else if (! (
m_selecting && p.pickableparts_is (
"none")))
2197 obj_list.push_back (go);
2202 octave_unused_parameter (props);
2203 octave_unused_parameter (obj_list);
2216#if defined (HAVE_OPENGL)
2218 std::list<graphics_object> obj_list;
2219 std::list<graphics_object>::iterator it;
2235 "light: Maximum number of lights (%d) in these axes is "
2242 for (
unsigned int i = props.get_num_lights (); i <
m_max_lights; i++)
2247 m_view_vector = props.get_cameraposition ().matrix_value ();
2249 float cb[4] = { 1.0, 1.0, 1.0, 1.0 };
2250 ColumnVector ambient_color = props.get_ambientlightcolor_rgb ();
2251 for (
int i = 0; i < 3; i++)
2252 cb[i] = ambient_color(i);
2257 it = obj_list.begin ();
2258 while (it != obj_list.end ())
2260 graphics_object go = (*it);
2264 if (! go.isa (
"text") || go.get (
"units").string_value () ==
"data")
2269 it = obj_list.erase (it);
2279 for (it = obj_list.begin (); it != obj_list.end (); it++)
2281 graphics_object go = (*it);
2294 octave_unused_parameter (props);
2307#if defined (HAVE_OPENGL)
2310 if (! props.is_visible () && props.get_tag () ==
"legend")
2315 if (
m_selecting && props.pickableparts_is (
"none"))
2320 double x_min = props.get_x_min ();
2321 double x_max = props.get_x_max ();
2322 double y_min = props.get_y_min ();
2323 double y_max = props.get_y_max ();
2324 double z_min = props.get_z_min ();
2325 double z_max = props.get_z_max ();
2327 if (x_max > floatmax || y_max > floatmax || z_max > floatmax
2328 || x_min < -floatmax || y_min < -floatmax || z_min < -floatmax)
2330 warning (
"opengl_renderer: data values greater than float capacity. (1) Scale data, or (2) Use gnuplot");
2338 bool is2D = props.get_is2D (
true);
2346 if (! is2D || props.layer_is (
"bottom"))
2349 if (props.get_tag () !=
"legend" || props.get_box () !=
"off")
2353 set_clipbox (x_min, x_max, y_min, y_max, z_min, z_max);
2357 if (is2D && props.layer_is (
"top"))
2360 if (props.get_tag () !=
"legend" || props.get_box () !=
"off")
2366 octave_unused_parameter (props);
2379#if defined (HAVE_OPENGL)
2381 bool draw_all =
m_selecting && props.pickableparts_is (
"all");
2384 Matrix y =
m_xform.yscale (props.get_ydata ().matrix_value ());
2385 Matrix z =
m_xform.zscale (props.get_zdata ().matrix_value ());
2387 bool has_z = (z.
numel () > 0);
2391 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
2392 uint8_t clip_ok = 0x40;
2394 std::vector<uint8_t> clip (n);
2397 for (
int i = 0; i < n; i++)
2398 clip[i] = (
clip_code (
x(i), y(i), z(i)) & clip_mask);
2403 for (
int i = 0; i < n; i++)
2404 clip[i] = (
clip_code (
x(i), y(i), z_mid) & clip_mask);
2407 if (! props.linestyle_is (
"none") && ! props.color_is (
"none"))
2410 set_linestyle (props.get_linestyle (),
false, props.get_linewidth ());
2419 for (
int i = 1; i < n; i++)
2421 if ((clip[i-1] & clip[i]) == clip_ok)
2445 for (
int i = 1; i < n; i++)
2447 if ((clip[i-1] & clip[i]) == clip_ok)
2474 if (! props.marker_is (
"none")
2475 && ! (props.markeredgecolor_is (
"none")
2476 && props.markerfacecolor_is (
"none")))
2482 else if (props.markeredgecolor_is (
"auto"))
2483 lc = props.get_color_rgb ();
2484 else if (! props.markeredgecolor_is (
"none"))
2485 lc = props.get_markeredgecolor_rgb ();
2489 if (props.markerfacecolor_is (
"auto"))
2490 fc = props.get_color_rgb ();
2491 else if (! props.markerfacecolor_is (
"none"))
2492 fc = props.get_markerfacecolor_rgb ();
2494 init_marker (props.get_marker (), props.get_markersize (),
2495 props.get_linewidth ());
2497 for (
int i = 0; i < n; i++)
2499 if (clip[i] == clip_ok)
2512 octave_unused_parameter (props);
2525#if defined (HAVE_OPENGL)
2527 bool draw_all =
m_selecting && props.pickableparts_is (
"all");
2529 const Matrix x =
m_xform.xscale (props.get_xdata ().matrix_value ());
2530 const Matrix y =
m_xform.yscale (props.get_ydata ().matrix_value ());
2531 const Matrix z =
m_xform.zscale (props.get_zdata ().matrix_value ());
2537 const NDArray vn = props.get_vertexnormals ().array_value ();
2539 bool has_vertex_normals = (vn_dims(0) == zr && vn_dims(1) == zc
2540 && vn_dims(2) == 3);
2541 const NDArray fn = props.get_facenormals ().array_value ();
2543 bool has_face_normals = (fn_dims(0) == zr - 1 && fn_dims(1) == zc - 1
2544 && fn_dims(2) == 3);
2549 int fc_mode = (props.facecolor_is_rgb () ? 0 :
2550 (props.facecolor_is (
"flat") ? 1 :
2551 (props.facecolor_is (
"interp") ? 2 :
2552 (props.facecolor_is (
"texturemap") ? 3 : -1))));
2553 int fl_mode = (props.facelighting_is (
"none") ? 0 :
2554 (props.facelighting_is (
"flat") ?
2555 (has_face_normals ? 1 : 0) :
2556 (has_vertex_normals ? 2 : 0)));
2557 int fa_mode = (props.facealpha_is_double () ? 0 :
2558 (props.facealpha_is (
"flat") ? 1 : 2));
2559 int ec_mode = (props.edgecolor_is_rgb () ? 0 :
2560 (props.edgecolor_is (
"flat") ? 1 :
2561 (props.edgecolor_is (
"interp") ? 2 : -1)));
2562 int el_mode = (props.edgelighting_is (
"none") ? 0 :
2563 (props.edgelighting_is (
"flat") ?
2564 (has_face_normals ? 1 : 0) :
2565 (has_vertex_normals ? 2 : 0)));
2566 int ea_mode = (props.edgealpha_is_double () ? 0 :
2567 (props.edgealpha_is (
"flat") ? 1 : 2));
2568 int bfl_mode = (props.backfacelighting_is (
"lit") ? 0 :
2569 (props.backfacelighting_is (
"reverselit") ? 1 : 2));
2570 bool do_lighting = props.get_do_lighting ();
2573 : props.get_facecolor_rgb ());
2574 Matrix ecolor = props.get_edgecolor_rgb ();
2577 float as = props.get_ambientstrength ();
2578 float ds = props.get_diffusestrength ();
2579 float ss = props.get_specularstrength ();
2580 float se = props.get_specularexponent () * 5;
2581 float scr = props.get_specularcolorreflectance ();
2582 float cb[4] = { 0.0, 0.0, 0.0, 1.0 };
2587 bool x_mat = (
x.rows () == z.
rows ());
2590 i1 = i2 = j1 = j2 = 0;
2592 if ((fc_mode > 0 && fc_mode < 3) || ec_mode > 0)
2593 c = props.get_color_data ().array_value ();
2597 for (
int i = 0; i < zr; i++)
2602 for (
int j = 0; j < zc; j++)
2611 if (fa_mode > 0 || ea_mode > 0)
2617 if (fl_mode > 0 || el_mode > 0)
2625 if (draw_all || ! props.facecolor_is (
"none"))
2629 fa = props.get_facealpha_double ();
2636 for (
int i = 0; i < 3; i++)
2637 cb[i] = as * fcolor(i);
2640 for (
int i = 0; i < 3; i++)
2641 cb[i] = ds * fcolor(i);
2644 for (
int i = 0; i < 3; i++)
2645 cb[i] = ss * (scr + (1-scr) * fcolor(i));
2650 if ((fl_mode > 0) && do_lighting)
2653 ? GL_SMOOTH : GL_FLAT);
2658 for (
int i = 1; i < zc; i++)
2666 for (
int j = 1; j < zr; j++)
2669 if (clip(j-1, i-1) || clip(j, i-1)
2670 || clip(j-1, i) || clip(j, i))
2673 if (fc_mode ==
FLAT)
2679 else if (fc_mode ==
INTERP)
2700 double (j-1) / (zr-1));
2701 else if (fc_mode > 0)
2704 for (
int k = 0; k < 3; k++)
2705 cb[k] = c(j-1, i-1, k);
2710 for (
int k = 0; k < 3; k++)
2714 for (
int k = 0; k < 3; k++)
2715 cb[k] = ds * c(j-1, i-1, k);
2718 for (
int k = 0; k < 3; k++)
2719 cb[k] = ss * (scr + (1-scr) * c(j-1, i-1, k));
2732 double (j-1) / (zr-1));
2733 else if (fc_mode ==
INTERP)
2735 for (
int k = 0; k < 3; k++)
2736 cb[k] = c(j-1, i, k);
2741 for (
int k = 0; k < 3; k++)
2745 for (
int k = 0; k < 3; k++)
2746 cb[k] = ds * c(j-1, i, k);
2749 for (
int k = 0; k < 3; k++)
2750 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k));
2762 tex.
tex_coord (
double (i) / (zc-1),
double (j) / (zr-1));
2763 else if (fc_mode ==
INTERP)
2765 for (
int k = 0; k < 3; k++)
2771 for (
int k = 0; k < 3; k++)
2775 for (
int k = 0; k < 3; k++)
2776 cb[k] = ds * c(j, i, k);
2779 for (
int k = 0; k < 3; k++)
2780 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
2792 double (j) / (zr-1));
2793 else if (fc_mode ==
INTERP)
2795 for (
int k = 0; k < 3; k++)
2796 cb[k] = c(j, i-1, k);
2801 for (
int k = 0; k < 3; k++)
2805 for (
int k = 0; k < 3; k++)
2806 cb[k] = ds * c(j, i-1, k);
2809 for (
int k = 0; k < 3; k++)
2810 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k));
2827 if ((fl_mode > 0) && do_lighting)
2836 if (! props.edgecolor_is (
"none") && ! props.linestyle_is (
"none"))
2838 if (props.get_edgealpha_double () == 1)
2846 for (
int i = 0; i < 3; i++)
2847 cb[i] = as * ecolor(i);
2850 for (
int i = 0; i < 3; i++)
2851 cb[i] = ds * ecolor(i);
2854 for (
int i = 0; i < 3; i++)
2855 cb[i] = ss * (scr + (1-scr) * ecolor(i));
2860 if ((el_mode > 0) && do_lighting)
2863 ? GL_SMOOTH : GL_FLAT);
2866 props.get_linewidth ());
2873 if (props.meshstyle_is (
"both") || props.meshstyle_is (
"column"))
2875 for (
int i = 0; i < zc; i++)
2883 for (
int j = 1; j < zr; j++)
2885 if (clip(j-1,i) || clip(j,i))
2888 if (ec_mode ==
FLAT)
2894 else if (ec_mode ==
INTERP)
2913 for (
int k = 0; k < 3; k++)
2914 cb[k] = c(j-1, i, k);
2919 for (
int k = 0; k < 3; k++)
2924 for (
int k = 0; k < 3; k++)
2925 cb[k] = ds * c(j-1, i, k);
2929 for (
int k = 0; k < 3; k++)
2930 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k));
2948 for (
int k = 0; k < 3; k++)
2954 for (
int k = 0; k < 3; k++)
2959 for (
int k = 0; k < 3; k++)
2960 cb[k] = ds * c(j, i, k);
2964 for (
int k = 0; k < 3; k++)
2965 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
2982 if (props.meshstyle_is (
"both") || props.meshstyle_is (
"row"))
2984 for (
int j = 0; j < zr; j++)
2992 for (
int i = 1; i < zc; i++)
2994 if (clip(j,i-1) || clip(j,i))
2997 if (ec_mode ==
FLAT)
3003 else if (ec_mode ==
INTERP)
3022 for (
int k = 0; k < 3; k++)
3023 cb[k] = c(j, i-1, k);
3028 for (
int k = 0; k < 3; k++)
3033 for (
int k = 0; k < 3; k++)
3034 cb[k] = ds * c(j, i-1, k);
3038 for (
int k = 0; k < 3; k++)
3039 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k));
3057 for (
int k = 0; k < 3; k++)
3063 for (
int k = 0; k < 3; k++)
3068 for (
int k = 0; k < 3; k++)
3069 cb[k] = ds * c(j, i, k);
3073 for (
int k = 0; k < 3; k++)
3074 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
3092 if ((el_mode > 0) && do_lighting)
3101 if (! props.marker_is (
"none")
3102 && ! (props.markeredgecolor_is (
"none")
3103 && props.markerfacecolor_is (
"none")))
3109 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
3110 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
3113 props.get_markeredgecolor_rgb ());
3115 props.get_markerfacecolor_rgb ());
3118 if (mecolor.
isempty () && props.markeredgecolor_is (
"auto"))
3120 mecolor = props.get_edgecolor_rgb ();
3121 do_edge = ! props.edgecolor_is (
"none");
3124 if (mfcolor.
isempty () && props.markerfacecolor_is (
"auto"))
3126 mfcolor = props.get_facecolor_rgb ();
3127 do_face = ! props.facecolor_is (
"none");
3131 c = props.get_color_data ().array_value ();
3133 init_marker (props.get_marker (), props.get_markersize (),
3134 props.get_linewidth ());
3136 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
3137 uint8_t clip_ok = 0x40;
3139 for (
int i = 0; i < zc; i++)
3144 for (
int j = 0; j < zr; j++)
3149 if ((
clip_code (
x(j1,i), y(j,i1), z(j,i)) & clip_mask)
3153 if ((do_edge && mecolor.
isempty ())
3154 || (do_face && mfcolor.
isempty ()))
3159 for (
int k = 0; k < 3; k++)
3177 octave_unused_parameter (props);
3192#if defined (HAVE_OPENGL)
3196 if (props.has_bad_data (msg))
3198 warning (
"opengl_renderer: %s. Not rendering.", msg.c_str ());
3202 bool draw_all =
m_selecting && props.pickableparts_is (
"all");
3203 const Matrix f = props.get_faces ().matrix_value ();
3204 const Matrix v =
m_xform.scale (props.get_vertices ().matrix_value ());
3211 int fcmax =
f.columns ();
3213 bool has_z = (v.
columns () > 2);
3214 bool has_facecolor =
false;
3215 bool has_facealpha =
false;
3217 int fc_mode = ((props.facecolor_is (
"none")
3218 || props.facecolor_is_rgb () || draw_all) ? 0 :
3219 (props.facecolor_is (
"flat") ? 1 : 2));
3220 int fl_mode = (props.facelighting_is (
"none") ? 0 :
3221 (props.facelighting_is (
"flat") ? 1 : 2));
3222 int fa_mode = (props.facealpha_is_double () ? 0 :
3223 (props.facealpha_is (
"flat") ? 1 : 2));
3224 int ec_mode = ((props.edgecolor_is (
"none")
3225 || props.edgecolor_is_rgb ()) ? 0 :
3226 (props.edgecolor_is (
"flat") ? 1 : 2));
3227 int el_mode = (props.edgelighting_is (
"none") ? 0 :
3228 (props.edgelighting_is (
"flat") ? 1 : 2));
3229 int ea_mode = (props.edgealpha_is_double () ? 0 :
3230 (props.edgealpha_is (
"flat") ? 1 : 2));
3231 int bfl_mode = (props.backfacelighting_is (
"lit") ? 0 :
3232 (props.backfacelighting_is (
"reverselit") ? 1 : 2));
3233 bool do_lighting = props.get_do_lighting ();
3235 Matrix fcolor = props.get_facecolor_rgb ();
3236 Matrix ecolor = props.get_edgecolor_rgb ();
3238 float as = props.get_ambientstrength ();
3239 float ds = props.get_diffusestrength ();
3240 float ss = props.get_specularstrength ();
3241 float se = props.get_specularexponent () * 5;
3242 float scr = props.get_specularcolorreflectance ();
3244 const Matrix vn = props.get_vertexnormals ().matrix_value ();
3245 bool has_vertex_normals = (vn.
rows () == nv);
3246 const Matrix fn = props.get_facenormals ().matrix_value ();
3247 bool has_face_normals = (fn.
rows () == nf);
3252 for (
int i = 0; i < nv; i++)
3255 for (
int i = 0; i < nv; i++)
3261 for (
int i = 0; i < nf; i++)
3266 for (
int j = 0; j < fcmax && !
math::isnan (
f(i,j)); j++, count++)
3267 fclip = (fclip || clip(
int (
f(i,j) - 1)));
3273 if (draw_all || fc_mode > 0 || ec_mode > 0)
3278 c = props.get_color_data ().matrix_value ();
3284 if (draw_all || fc_mode > 0)
3290 if (draw_all || ec_mode > 0)
3299 has_facecolor = ((c.
numel () > 0) && (c.
rows () ==
f.rows ()));
3302 if (fa_mode > 0 || ea_mode > 0)
3306 has_facealpha = ((a.
numel () > 0) && (a.
rows () ==
f.rows ()));
3310 fa = props.get_facealpha_double ();
3313 std::vector<vertex_data> vdata (
f.numel ());
3315 for (
int i = 0; i < nf; i++)
3316 for (
int j = 0; j < count_f(i); j++)
3318 int idx =
int (
f(i,j) - 1);
3326 vv(0) = v(idx,0); vv(1) = v(idx,1);
3329 if (((fl_mode ==
FLAT) || (el_mode ==
FLAT)) && has_face_normals)
3336 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
3337 fnn(0) = dir * fn(i,0);
3338 fnn(1) = dir * fn(i,1);
3339 fnn(2) = dir * fn(i,2);
3341 if ((fl_mode ==
GOURAUD || el_mode ==
GOURAUD) && has_vertex_normals)
3348 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
3349 vnn(0) = dir * vn(idx,0);
3350 vnn(1) = dir * vn(idx,1);
3351 vnn(2) = dir * vn(idx,2);
3357 cc(0) = c(i,0), cc(1) = c(i,1), cc(2) = c(i,2);
3359 cc(0) = c(idx,0), cc(1) = c(idx,1), cc(2) = c(idx,2);
3363 else if (a.
numel () > 0)
3372 =
vertex_data (vv, cc, vnn, fnn, aa, as, ds, ss, se, scr);
3375 if (fl_mode > 0 || el_mode > 0)
3378 if (draw_all || ! props.facecolor_is (
"none"))
3388 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f };;
3390 for (
int i = 0; i < 3; i++)
3391 cb[i] = as * fcolor(i);
3394 for (
int i = 0; i < 3; i++)
3395 cb[i] = ds * fcolor(i);
3398 for (
int i = 0; i < 3; i++)
3399 cb[i] = ss * (scr + (1-scr) * fcolor(i));
3404 if ((fl_mode > 0) && do_lighting)
3413 std::vector<octave_idx_type>::const_iterator it;
3416 for (
int i = 0; i < nf; i++)
3421 bool is_non_planar =
false;
3422 if (props.m_coplanar_last_idx.size () > 0
3423 && props.m_coplanar_last_idx[i].size () > 1)
3425 is_non_planar =
true;
3426 it = props.m_coplanar_last_idx[i].end ();
3436 if (it == props.m_coplanar_last_idx[i].begin ())
3446 i_end = count_f(i) - 1;
3454 for (
int j = i_end; j > i_start; j--)
3457 = vdata[i+j*fr].get_rep ();
3466 if (fc_mode ==
FLAT)
3471 if (col.
numel () == 3)
3476 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
3478 for (
int k = 0; k < 3; k++)
3483 for (
int k = 0; k < 3; k++)
3488 for (
int k = 0; k < 3; k++)
3504 }
while (i_start > 0);
3507 if ((fl_mode > 0) && do_lighting)
3517 || (! props.edgecolor_is (
"none") && ! props.linestyle_is (
"none")))
3520 if (props.get_edgealpha_double () == 1)
3528 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
3532 for (
int i = 0; i < 3; i++)
3533 cb[i] = (as * ecolor(i));
3538 if ((el_mode > 0) && do_lighting)
3541 double linewidth = props.get_linewidth ();
3554 for (
int i = 0; i < nf; i++)
3556 bool is_non_planar =
false;
3557 if (props.m_coplanar_last_idx.size () > 0
3558 && props.m_coplanar_last_idx[i].size () > 1)
3559 is_non_planar =
true;
3560 if (clip_f(i) || is_non_planar)
3568 ? GL_SMOOTH : GL_FLAT);
3571 for (
int j = count_f(i)-1; j >= 0; j--)
3573 if (! clip(
int (
f(i,j) - 1)))
3576 = vdata[i+j*fr].get_rep ();
3587 if (col.
numel () == 3)
3600 int j = count_f(i)-1;
3601 if (flag && ! clip(
int (
f(i,j) - 1)))
3604 = vdata[i+j*fr].get_rep ();
3610 if (col.
numel () == 3)
3624 for (
int j = count_f(i)-1; j >= 0; j--)
3627 = vdata[i+j*fr].get_rep ();
3639 if ((el_mode > 0) && do_lighting)
3648 if (! props.marker_is (
"none")
3649 && ! (props.markeredgecolor_is (
"none")
3650 && props.markerfacecolor_is (
"none")))
3652 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
3653 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
3656 props.get_markeredgecolor_rgb ());
3658 props.get_markerfacecolor_rgb ());
3660 bool has_markerfacecolor = draw_all ||
false;
3662 if ((mecolor.
isempty () && ! props.markeredgecolor_is (
"none"))
3663 || (mfcolor.
isempty () && ! props.markerfacecolor_is (
"none")))
3665 Matrix mc = props.get_color_data ().matrix_value ();
3667 if (mc.
rows () == 1)
3670 if (mfcolor.
isempty () && ! props.markerfacecolor_is (
"none"))
3673 if (mecolor.
isempty () && ! props.markeredgecolor_is (
"none"))
3679 c = props.get_color_data ().matrix_value ();
3680 has_markerfacecolor = ((c.
numel () > 0)
3681 && (c.
rows () ==
f.rows ()));
3685 init_marker (props.get_marker (), props.get_markersize (),
3686 props.get_linewidth ());
3688 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
3689 uint8_t clip_ok = 0x40;
3691 for (
int i = 0; i < nf; i++)
3692 for (
int j = 0; j < count_f(i); j++)
3694 int idx =
int (
f(i,j) - 1);
3696 if ((
clip_code (v(idx,0), v(idx,1), (has_z ? v(idx,2) : 0))
3697 & clip_mask) != clip_ok)
3704 if (has_markerfacecolor)
3705 cc(0) = c(i,0), cc(1) = c(i,1), cc(2) = c(i,2);
3707 cc(0) = c(idx,0), cc(1) = c(idx,1), cc(2) = c(idx,2);
3715 draw_marker (v(idx,0), v(idx,1), (has_z ? v(idx,2) : 0), lc, fc);
3723 octave_unused_parameter (props);
3736#if defined (HAVE_OPENGL)
3740 if (props.has_bad_data (msg))
3742 warning (
"opengl_renderer: %s. Not rendering.", msg.c_str ());
3748 if (draw_all || (! props.marker_is (
"none")
3749 && ! (props.markeredgecolor_is (
"none")
3750 && props.markerfacecolor_is (
"none"))))
3752 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
3753 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
3755 const Matrix x = props.get_xdata ().matrix_value ();
3756 const Matrix y = props.get_ydata ().matrix_value ();
3757 const Matrix z = props.get_zdata ().matrix_value ();
3758 const Matrix c = props.get_color_data ().matrix_value ();
3759 const Matrix s = props.get_sizedata ().matrix_value ();
3766 props.get_markeredgecolor_rgb ());
3768 props.get_markerfacecolor_rgb ());
3769 const double mea = props.get_markeredgealpha ();
3770 const double mfa = props.get_markerfacealpha ();
3772 if (props.markerfacecolor_is (
"auto"))
3776 graphics_object go = gh_mgr.get_object (props.get___myhandle__ ());
3777 graphics_object ax = go.get_ancestor (
"axes");
3781 mfcolor = ax_props.get_color ().matrix_value ();
3784 init_marker (props.get_marker (), std::sqrt (s(0)),
3785 props.get_linewidth ());
3787 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
3788 uint8_t clip_ok = 0x40;
3804 for (
int i = 0; i < np; i++)
3806 if ((
clip_code (
x(i), y(i), (has_z ? z(i) : 0.0)) & clip_mask)
3825 draw_marker (
x(i), y(i), (has_z ? z(i) : 0.0), lc, fc, mea, mfa);
3833 octave_unused_parameter (props);
3846#if defined (HAVE_OPENGL)
3852 float pos[4] = { 0, 0, 0, 0 };
3853 Matrix lpos = props.get_position ().matrix_value ();
3854 for (
int i = 0; i < 3; i++)
3856 if (props.style_is (
"local"))
3861 float col[4] = { 1, 1, 1, 1 };
3862 Matrix lcolor = props.get_color ().matrix_value ();
3863 for (
int i = 0; i < 3; i++)
3870 octave_unused_parameter (props);
3883 draw (props.get_children ());
3889#if defined (HAVE_OPENGL)
3914#if defined (HAVE_OPENGL)
3935#if defined (HAVE_OPENGL)
3937 if (props.get_string ().isempty () || props.color_is (
"none"))
3943 if (! props.is_clipping ()
3944 || (
clip_code (pos(0), pos(1), pos.
numel () > 2 ? pos(2) : 0.0) == 0x40))
3952 render_text (props.get_pixels (), props.get_extent_matrix (),
3953 pos(0), pos(1), pos(2), props.get_rotation ());
3960 octave_unused_parameter (props);
3974#if defined (HAVE_OPENGL)
3976 Matrix bgcol = props.get_backgroundcolor_rgb ();
3977 Matrix ecol = props.get_edgecolor_rgb ();
3982 Matrix pos = props.get_data_position ();
3994 double rotation = props.get_rotation ();
3999 const Matrix bbox = props.get_extent_matrix ();
4028 set_linestyle (props.get_linestyle (),
false, props.get_linewidth ());
4046 octave_unused_parameter (props);
4059#if defined (HAVE_OPENGL)
4062 Matrix x = props.get_xdata ().matrix_value ();
4063 Matrix y = props.get_ydata ().matrix_value ();
4069 octave_unused_parameter (props);
4083#if defined (HAVE_OPENGL)
4088 double x0, x1, y0, y1;
4092 dx = (
x(1) -
x(0)) / (
w - 1);
4099 dy = (y(1) - y(0)) / (h - 1);
4105 if (dv.
ndims () == 3 && (dv(2) == 3 || dv(2) == 4))
4145 warning (
"opengl_renderer: invalid image size (expected MxNx3 or MxN)");
4149 octave_unused_parameter (cdata);
4150 octave_unused_parameter (
x);
4151 octave_unused_parameter (y);
4152 octave_unused_parameter (ortho);
4168 for (
int i =
len-1; i >= 0; i--)
4170 graphics_object obj = gh_mgr.get_object (hlist(i));
4173 draw (obj, toplevel);
4180#if defined (HAVE_OPENGL)
4186 octave_unused_parameter (
w);
4187 octave_unused_parameter (h);
4200 Matrix retval (1, 4, 0.0);
4202#if defined (HAVE_OPENGL)
4203#if defined (HAVE_FRAMEWORK_OPENGL)
4211 for (
int i = 0; i < 4; i++)
4229#if defined (HAVE_OPENGL)
4238 octave_unused_parameter (c);
4251 bool do_anti_alias = props.get (
"fontsmoothing").string_value () ==
"on";
4254 props.get (
"fontweight").string_value (),
4255 props.get (
"fontangle").string_value (),
4256 props.get (
"__fontsize_points__").double_value ()
4263#if defined (HAVE_OPENGL)
4279 octave_unused_parameter (on);
4280 octave_unused_parameter (offset);
4293#if defined (HAVE_OPENGL)
4299 octave_unused_parameter (
w);
4313#if defined (HAVE_OPENGL)
4319 uint16_t pattern = 0xFFFF;
4351 if (solid && ! use_stipple)
4358 octave_unused_parameter (s);
4359 octave_unused_parameter (use_stipple);
4360 octave_unused_parameter (linewidth);
4372 double z1,
double z2)
4374#if defined (HAVE_OPENGL)
4376 double dx = (x2-x1);
4377 double dy = (y2-y1);
4378 double dz = (z2-z1);
4380 x1 -= 0.001*dx; x2 += 0.001*dx;
4381 y1 -= 0.001*dy; y2 += 0.001*dy;
4382 z1 -= 0.001*dz; z2 += 0.001*dz;
4386 p(0) = -1; p(3) = x2;
4388 p(0) = 1; p(3) = -x1;
4390 p(0) = 0; p(1) = -1; p(3) = y2;
4392 p(1) = 1; p(3) = -y1;
4394 p(1) = 0; p(2) = -1; p(3) = z2;
4396 p(2) = 1; p(3) = -z1;
4405 octave_unused_parameter (x1);
4406 octave_unused_parameter (x2);
4407 octave_unused_parameter (y1);
4408 octave_unused_parameter (y2);
4409 octave_unused_parameter (z1);
4410 octave_unused_parameter (z2);
4423#if defined (HAVE_OPENGL)
4427 if (enable != has_clipping)
4430 for (
int i = 0; i < 6; i++)
4433 for (
int i = 0; i < 6; i++)
4439 octave_unused_parameter (enable);
4452#if defined (HAVE_OPENGL)
4470 octave_unused_parameter (m);
4471 octave_unused_parameter (size);
4472 octave_unused_parameter (width);
4485#if defined (HAVE_OPENGL)
4492 octave_unused_parameter (m);
4493 octave_unused_parameter (size);
4506#if defined (HAVE_OPENGL)
4530 const double la,
const double fa)
4532#if defined (HAVE_OPENGL)
4544 if (lc.
numel () > 0)
4563 octave_unused_parameter (
x);
4564 octave_unused_parameter (y);
4565 octave_unused_parameter (z);
4566 octave_unused_parameter (lc);
4567 octave_unused_parameter (fc);
4568 octave_unused_parameter (la);
4569 octave_unused_parameter (fa);
4582#if defined (HAVE_OPENGL)
4605#if defined (HAVE_OPENGL)
4611 std::ostringstream buf;
4615 return std::string (buf.str ());
4619 octave_unused_parameter (
id);
4625 return std::string ();
4633#if defined (HAVE_OPENGL)
4635 double x = n(j,i,0);
4636 double y = n(j,i,1);
4637 double z = n(j,i,2);
4639 double d = sqrt (
x*
x + y*y + z*z);
4645 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
4651 octave_unused_parameter (bfl_mode);
4652 octave_unused_parameter (n);
4653 octave_unused_parameter (j);
4654 octave_unused_parameter (i);
4671 static const double pix_per_pts =
4672 gh_mgr.get_object (0).get (
"screenpixelsperinch").double_value () / 72.0;
4674 double retval = val;
4677 retval *= pix_per_pts;
4686#if defined (HAVE_OPENGL)
4690 if (filled && (c ==
'+' || c ==
'x' || c ==
'*' || c ==
'.'
4691 || c ==
'|' || c ==
'_'))
4700 const double sqrt2d4 = 0.35355339059327;
4701 double tt = sz*sqrt2d4;
4752 if (sz > 0 && sz < 3)
4755 int div =
static_cast<int> (M_PI * sz / 12);
4759 double ang_step = M_PI / div;
4762 for (
double ang = 0; ang < 2*M_PI; ang += ang_step)
4777 int div =
static_cast<int> (M_PI * sz / 4);
4781 double ang_step = M_PI / div;
4784 for (
double ang = 0; ang < 2*M_PI; ang += ang_step)
4828 dr = 1.0 - sin (M_PI/10)/sin (3*M_PI/10)*1.02;
4831 for (
int i = 0; i < 2*5; i++)
4833 ang = (-0.5 +
double (i+1) / 5) * M_PI;
4834 r = 1.0 - (dr * fmod (
double (i+1), 2.0));
4843 dr = 1.0 - 0.5/sin (M_PI/3)*1.02;
4846 for (
int i = 0; i < 2*6; i++)
4848 ang = (0.5 +
double (i+1) / 6.0) * M_PI;
4849 r = 1.0 - (dr * fmod (
double (i+1), 2.0));
4856 warning (
"opengl_renderer: unsupported marker '%s'",
marker.c_str ());
4866 octave_unused_parameter (
marker);
4867 octave_unused_parameter (size);
4868 octave_unused_parameter (filled);
4882 int halign,
int valign,
double rotation)
4890 std::list<text_renderer::string>& lst,
4892 int halign,
int valign,
double rotation)
4900 double x,
double y,
double z,
4901 int halign,
int valign,
double rotation)
4903#if defined (HAVE_OPENGL)
4922 octave_unused_parameter (txt);
4923 octave_unused_parameter (
x);
4924 octave_unused_parameter (y);
4925 octave_unused_parameter (z);
4926 octave_unused_parameter (halign);
4927 octave_unused_parameter (valign);
4928 octave_unused_parameter (rotation);
4940 double x,
double y,
double z,
double rotation)
4942#if defined (HAVE_OPENGL)
4968 xdata, ydata,
true);
4979 octave_unused_parameter (pixels);
4980 octave_unused_parameter (bbox);
4981 octave_unused_parameter (
x);
4982 octave_unused_parameter (y);
4983 octave_unused_parameter (z);
4984 octave_unused_parameter (rotation);
charNDArray max(char d, const charNDArray &m)
charNDArray min(char d, const charNDArray &m)
OCTARRAY_API Array< T, Alloc > index(const octave::idx_vector &i) const
Indexing without resizing.
octave_idx_type numel(void) const
Number of elements in the array.
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
octave_idx_type rows(void) const
bool isempty(void) const
Size of the specified dimension.
octave_idx_type columns(void) const
const T * data(void) const
Size of the specified dimension.
OCTARRAY_API T * fortran_vec(void)
Size of the specified dimension.
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(void) const
Number of dimensions.
static idx_vector make_range(octave_idx_type start, octave_idx_type step, octave_idx_type len)
static const idx_vector colon
virtual void glBindTexture(GLenum target, GLuint texture)
virtual void glPolygonMode(GLenum face, GLenum mode)
virtual void glMultMatrixd(const GLdouble *m)
virtual void glBegin(GLenum mode)
virtual void glDisable(GLenum cap)
virtual void glNormal3dv(const GLdouble *v)
virtual void glGenTextures(GLsizei n, GLuint *textures)
virtual void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
virtual void glPolygonOffset(GLfloat factor, GLfloat units)
virtual void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val)
virtual void glVertex2d(GLdouble x, GLdouble y)
virtual void glDepthFunc(GLenum func)
virtual const GLubyte * glGetString(GLenum name)
virtual void glPixelStorei(GLenum pname, GLint param)
virtual void glColor3dv(const GLdouble *v)
virtual void glLineStipple(GLint factor, GLushort pattern)
virtual void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
virtual void glShadeModel(GLenum mode)
virtual void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
virtual void glAlphaFunc(GLenum func, GLclampf ref)
virtual void glBlendFunc(GLenum sfactor, GLenum dfactor)
virtual void glGetIntegerv(GLenum pname, GLint *data)
virtual void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
virtual GLboolean glIsEnabled(GLenum cap)
virtual void glDeleteTextures(GLsizei n, const GLuint *textures)
virtual void glClipPlane(GLenum plane, const GLdouble *equation)
virtual void glColor3f(GLfloat red, GLfloat green, GLfloat blue)
virtual void glEdgeFlag(GLboolean flag)
virtual void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
virtual void glPopMatrix(void)
virtual void glScaled(GLdouble x, GLdouble y, GLdouble z)
virtual void glGetBooleanv(GLenum pname, GLboolean *data)
virtual void glLineWidth(GLfloat width)
virtual void glEnable(GLenum cap)
virtual void glPushAttrib(GLbitfield mask)
virtual void glVertex3d(GLdouble x, GLdouble y, GLdouble z)
virtual void glDeleteLists(GLuint list, GLsizei range)
virtual void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
virtual void glCallList(GLuint list)
virtual GLuint glGenLists(GLsizei range)
virtual void glEndList(void)
virtual void glLoadIdentity(void)
virtual void glNewList(GLuint list, GLenum mode)
virtual void glTranslated(GLdouble x, GLdouble y, GLdouble z)
virtual void glFinish(void)
virtual void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
virtual void glPopAttrib(void)
virtual GLenum glGetError(void)
virtual void glHint(GLenum target, GLenum mode)
virtual void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
virtual void glMaterialf(GLenum face, GLenum pname, GLfloat param)
virtual void glMatrixMode(GLenum mode)
virtual void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
virtual void glColor3fv(const GLfloat *v)
virtual void glColor4fv(const GLfloat *v)
virtual void glPushMatrix(void)
virtual void glTexCoord2d(GLdouble s, GLdouble t)
virtual void glTexParameteri(GLenum target, GLenum pname, GLint param)
virtual void glClear(GLbitfield mask)
virtual void glVertex3dv(const GLdouble *v)
virtual void glLightfv(GLenum light, GLenum pname, const GLfloat *params)
std::list< vertex_data > m_tmp_vdata
patch_tessellator(const patch_tessellator &)=delete
void combine(GLdouble xyz[3], void *data[4], GLfloat w[4], void **out_data)
opengl_renderer * m_renderer
patch_tessellator(opengl_renderer *r, int cmode, int lmode, bool fl, float idx=0.0)
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 end_marker(void)
virtual void change_marker(const std::string &m, double size)
virtual void draw_hggroup(const hggroup::properties &props)
virtual void draw_surface(const surface::properties &props)
virtual void draw_text_background(const text::properties &props, bool do_rotate=false)
virtual void set_interpreter(const caseless_str &interp)
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)
void draw_axes_grids(const axes::properties &props)
virtual void set_clipbox(double x1, double x2, double y1, double y2, double z1, double z2)
bool is_nan_or_inf(double x, double y, double z) const
unsigned int m_filled_marker_id
void restore_previous_coordinates(void)
virtual void draw_text(const text::properties &props)
opengl_functions & m_glfcns
void draw_axes_boxes(const axes::properties &props)
virtual void draw_line(const line::properties &props)
virtual Matrix render_text(const std::string &txt, double x, double y, double z, int halign, int valign, double rotation=0.0)
unsigned int m_max_lights
void draw_all_lights(const base_properties &props, std::list< graphics_object > &obj_list)
void draw_axes_children(const axes::properties &props)
virtual void set_linewidth(float w)
virtual void set_linejoin(const std::string &)
virtual void draw_uibuttongroup(const uibuttongroup::properties &props, const graphics_object &go)
virtual void draw_axes(const axes::properties &props)
virtual void draw(const graphics_object &go, bool toplevel=true)
unsigned int m_current_light
void draw_axes_z_grid(const axes::properties &props)
void draw_axes_planes(const axes::properties &props)
virtual void init_gl_context(bool enhanced, const Matrix &backgroundColor)
virtual uint8NDArray get_pixels(int width, int height)
virtual void set_polygon_offset(bool on, float offset=0.0f)
virtual void init_marker(const std::string &m, double size, float width)
virtual void draw_patch(const patch::properties &props)
void init_maxlights(void)
virtual graphics_xform get_transform(void) const
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 set_linestyle(const std::string &s, bool stipple=false, double linewidth=0.5)
virtual void set_font(const base_properties &props)
void draw_axes_y_grid(const axes::properties &props)
virtual void draw_image(const image::properties &props)
virtual void text_to_pixels(const std::string &txt, uint8NDArray &pixels, Matrix &bbox, int halign=0, int valign=0, double rotation=0.0)
ColumnVector m_view_vector
uint8_t clip_code(double x, double y, double z) const
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)
unsigned int make_marker_list(const std::string &m, double size, bool filled) const
std::string get_string(unsigned int id) const
virtual void set_viewport(int w, int h)
void draw_texture_image(const octave_value cdata, Matrix x, Matrix y, bool ortho=false)
text_renderer m_txt_renderer
void set_normal(int bfl_mode, const NDArray &n, int j, int i)
opengl_renderer(opengl_functions &glfcns)
virtual void draw_scatter(const scatter::properties &props)
graphics_toolkit m_toolkit
virtual void set_linecap(const std::string &)
virtual void set_clipping(bool on)
virtual void set_color(const Matrix &c)
virtual void setup_opengl_transformation(const axes::properties &props)
void draw_axes_x_grid(const axes::properties &props)
double points_to_pixels(const double val) const
virtual void draw_uipanel(const uipanel::properties &props, const graphics_object &go)
virtual void draw_light(const light::properties &props)
virtual void finish(void)
virtual void draw_figure(const figure::properties &props)
void set_ortho_coordinates(void)
caseless_str m_interpreter
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 Matrix get_viewport_scaled(void) const
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 draw_zoom_rect(int x1, int y1, int x2, int y2)
virtual ~opengl_tessellator(void)
static void tess_vertex(void *v, void *t)
virtual void vertex(void *)
void end_polygon(void) const
static void tess_combine(GLdouble c[3], void *v[4], GLfloat w[4], void **out, void *t)
static void tess_end(void *t)
virtual void edge_flag(GLboolean)
static void tess_edge_flag(GLboolean flag, void *t)
void begin_polygon(bool filled=true)
virtual void combine(GLdouble[3], void *[4], GLfloat[4], void **)
static void tess_begin(GLenum type, void *t)
static void tess_error(GLenum err, void *t)
GLUtesselator * m_glu_tess
virtual void error(GLenum err)
void add_vertex(double *loc, void *data) const
void begin_contour(void) const
opengl_tessellator(const opengl_tessellator &)=delete
virtual void begin(GLenum)
bool is_filled(void) const
void end_contour(void) const
opengl_functions & m_glfcns
void tex_coord(double q, double r) const
void bind(int mode) const
texture_rep(opengl_functions &glfcns, GLuint id, int w, int h, int tw, int th)
texture_rep(opengl_functions &glfcns)
opengl_texture(const std::shared_ptr< texture_rep > &new_rep)
opengl_texture(opengl_functions &glfcns)
~opengl_texture(void)=default
bool is_valid(void) const
std::shared_ptr< texture_rep > m_rep
opengl_texture & operator=(const opengl_texture &)=default
static opengl_texture create(opengl_functions &glfcns, const octave_value &data)
opengl_texture(opengl_functions &glfcns, GLuint id, int w, int h, int tw, int th)
void tex_coord(double q, double r) const
void bind(int mode=GL_TEXTURE_2D) const
opengl_texture(const opengl_texture &)=default
void set_anti_aliasing(bool val)
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_color(const Matrix &c)
void set_font(const std::string &name, const std::string &weight, const std::string &angle, double size)
vertex_data_rep(const Matrix &c, const Matrix &col, const Matrix &vn, const Matrix &fn, double a, float as, float ds, float ss, float se, float scr)
float m_specular_color_refl
static std::shared_ptr< vertex_data_rep > nil_rep(void)
vertex_data_rep * get_rep(void) const
vertex_data(const Matrix &c, const Matrix &col, const Matrix &vn, const Matrix &fn, double a, float as, float ds, float ss, float se, float scr)
~vertex_data(void)=default
std::shared_ptr< vertex_data_rep > m_rep
vertex_data(const vertex_data &)=default
vertex_data & operator=(const vertex_data &)=default
uint16NDArray uint16_array_value(void) const
bool is_uint16_type(void) const
bool is_double_type(void) const
uint8NDArray uint8_array_value(void) const
NDArray array_value(bool frc_str_conv=false) const
bool is_single_type(void) const
FloatNDArray float_array_value(bool frc_str_conv=false) const
bool is_uint8_type(void) const
dim_vector dims(void) const
octave_idx_type numel(void) const
void warning(const char *fmt,...)
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
#define panic_impossible()
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x
std::complex< double > w(std::complex< double > z, double relerr=0)
T::properties & properties(graphics_object obj)
static int next_power_of_2(int n)
static double f(double k, double l_nu, double c_pm)
gh_manager & __get_gh_manager__(const std::string &who)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)