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)
1239 return pix.
permute (perm).index (idx);
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)
1556 int xstate = props.get_xstate ();
1558 if (xstate != AXE_DEPTH_DIR
1559 && (props.is_visible ()
1560 || (
m_selecting && props.pickableparts_is (
"all"))))
1562 int zstate = props.get_zstate ();
1563 bool x2Dtop = props.get_x2Dtop ();
1564 bool layer2Dtop = props.get_layer2Dtop ();
1565 bool xyzSym = props.get_xyzSym ();
1566 bool nearhoriz = props.get_nearhoriz ();
1567 double xticklen = props.get_xticklen ();
1568 double xtickoffset = props.get_xtickoffset ();
1569 double fy = props.get_fy ();
1570 double fz = props.get_fz ();
1571 double x_min = props.get_x_min ();
1572 double x_max = props.get_x_max ();
1573 double y_min = props.get_y_min ();
1574 double y_max = props.get_y_max ();
1575 double yPlane = props.get_yPlane ();
1576 double yPlaneN = props.get_yPlaneN ();
1577 double ypTick = props.get_ypTick ();
1578 double ypTickN = props.get_ypTickN ();
1579 double zPlane = props.get_zPlane ();
1580 double zPlaneN = props.get_zPlaneN ();
1581 double zpTick = props.get_zpTick ();
1582 double zpTickN = props.get_zpTickN ();
1585 Matrix xticks =
m_xform.xscale (props.get_xtick ().matrix_value ());
1586 Matrix xmticks =
m_xform.xscale (props.get_xminortickvalues ().matrix_value ());
1587 bool do_xminortick = props.is_xminortick () && ! xticks.
isempty ();
1588 string_vector xticklabels = props.get_xticklabel ().string_vector_value ();
1591 bool tick_along_z = nearhoriz ||
math::isinf (fy);
1592 double linewidth = props.get_linewidth ();
1593 std::string gridstyle = props.get_gridlinestyle ();
1594 std::string minorgridstyle = props.get_minorgridlinestyle ();
1595 Matrix gridcolor = props.get_gridcolor_rgb ();
1596 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1597 double gridalpha = props.get_gridalpha ();
1598 double minorgridalpha = props.get_minorgridalpha ();
1599 bool do_xgrid = (props.is_xgrid () && (gridstyle !=
"none"));
1600 bool do_xminorgrid = (props.is_xminorgrid ()
1601 && (minorgridstyle !=
"none")
1603 bool is_origin = props.xaxislocation_is (
"origin") && props.get_is2D ()
1604 && ! props.yscale_is (
"log");
1605 bool is_origin_low = is_origin && (y_min + y_max) < 0;
1606 bool mirror = props.is_box () && xstate != AXE_ANY_DIR;
1611 if (props.gridcolormode_is (
"auto"))
1612 if (props.xcolormode_is (
"manual") && ! props.xcolor_is (
"none"))
1613 gridcolor = props.get_xcolor_rgb ();
1615 if (props.minorgridcolormode_is (
"auto"))
1616 if (props.xcolormode_is (
"manual") && ! props.xcolor_is (
"none"))
1617 minorgridcolor = props.get_xcolor_rgb ();
1622 if (minorgridcolor.
isempty ())
1623 do_xminorgrid =
false;
1626 if (do_xminorgrid && ! do_xgrid)
1628 gridstyle = minorgridstyle;
1629 gridcolor = minorgridcolor;
1630 gridalpha = minorgridalpha;
1637 minorgridstyle, minorgridcolor, minorgridalpha,
1638 xmticks, x_min, x_max,
1639 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1640 0, (zstate != AXE_DEPTH_DIR));
1645 gridstyle, gridcolor, gridalpha,
1646 xticks, x_min, x_max,
1647 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1648 0, (zstate != AXE_DEPTH_DIR));
1651 if (props.xcolor_is (
"none"))
1657 double y_axis_pos = 0.;
1673 is_origin ? y_axis_pos : ypTick, ypTick,
1674 zpTick, zpTickN, 0., 0.,
1675 (is_origin_low ? -1. : 1.) *
1677 0, ! is_origin && mirror);
1680 is_origin ? y_axis_pos : ypTick, ypTickN,
1682 (is_origin_low ? -1. : 1.) *
1684 0., 0, ! is_origin && mirror);
1690 is_origin ? y_axis_pos : ypTick, ypTick,
1691 zpTick, zpTickN, 0., 0.,
1692 (is_origin_low ? -1. : 1.) *
1694 0, ! is_origin && mirror);
1697 is_origin ? y_axis_pos : ypTick, ypTickN,
1699 (is_origin_low ? -1. : 1.) *
1701 0., 0, ! is_origin && mirror);
1704 if (xticklabels.
numel () > 0)
1706 int halign = (xstate == AXE_HORZ_DIR
1708 : (xyzSym || is_origin_low ? 0 : 2));
1709 int valign = (xstate == AXE_VERT_DIR
1711 : (x2Dtop || is_origin_low ? 0 : 2));
1715 is_origin ? y_axis_pos : ypTick,
1717 (is_origin_low ? -1. : 1.) *
1719 0, halign, valign, wmax, hmax);
1722 (is_origin ? y_axis_pos : ypTick) +
1723 (is_origin_low ? -1. : 1.) *
1725 zpTick, 0, halign, valign, wmax, hmax);
1728 gh_mgr.get_object (props.get_xlabel ()).set (
"visible",
"on");
1731 gh_mgr.get_object (props.get_xlabel ()).set (
"visible",
"off");
1735 octave_unused_parameter (props);
1748 #if defined (HAVE_OPENGL)
1752 int ystate = props.get_ystate ();
1754 if (ystate != AXE_DEPTH_DIR && props.is_visible ()
1755 && (props.is_visible ()
1756 || (
m_selecting && props.pickableparts_is (
"all"))))
1758 int zstate = props.get_zstate ();
1759 bool y2Dright = props.get_y2Dright ();
1760 bool layer2Dtop = props.get_layer2Dtop ();
1761 bool xyzSym = props.get_xyzSym ();
1762 bool nearhoriz = props.get_nearhoriz ();
1763 double yticklen = props.get_yticklen ();
1764 double ytickoffset = props.get_ytickoffset ();
1765 double fx = props.get_fx ();
1766 double fz = props.get_fz ();
1767 double xPlane = props.get_xPlane ();
1768 double xPlaneN = props.get_xPlaneN ();
1769 double xpTick = props.get_xpTick ();
1770 double xpTickN = props.get_xpTickN ();
1771 double y_min = props.get_y_min ();
1772 double y_max = props.get_y_max ();
1773 double x_min = props.get_x_min ();
1774 double x_max = props.get_x_max ();
1775 double zPlane = props.get_zPlane ();
1776 double zPlaneN = props.get_zPlaneN ();
1777 double zpTick = props.get_zpTick ();
1778 double zpTickN = props.get_zpTickN ();
1781 Matrix yticks =
m_xform.yscale (props.get_ytick ().matrix_value ());
1782 Matrix ymticks =
m_xform.yscale (props.get_yminortickvalues ().matrix_value ());
1783 bool do_yminortick = props.is_yminortick () && ! yticks.
isempty ();
1784 string_vector yticklabels = props.get_yticklabel ().string_vector_value ();
1787 bool tick_along_z = nearhoriz ||
math::isinf (fx);
1788 double linewidth = props.get_linewidth ();
1789 std::string gridstyle = props.get_gridlinestyle ();
1790 std::string minorgridstyle = props.get_minorgridlinestyle ();
1791 Matrix gridcolor = props.get_gridcolor_rgb ();
1792 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1793 double gridalpha = props.get_gridalpha ();
1794 double minorgridalpha = props.get_minorgridalpha ();
1795 bool do_ygrid = (props.is_ygrid () && (gridstyle !=
"none"));
1796 bool do_yminorgrid = (props.is_yminorgrid ()
1797 && (minorgridstyle !=
"none")
1799 bool is_origin = props.yaxislocation_is (
"origin") && props.get_is2D ()
1800 && ! props.xscale_is (
"log");
1801 bool is_origin_low = is_origin && (x_min + x_max) < 0;
1802 bool mirror = props.is_box () && ystate != AXE_ANY_DIR
1803 && (! props.has_property (
"__plotyy_axes__"));
1808 if (props.gridcolormode_is (
"auto"))
1809 if (props.ycolormode_is (
"manual") && ! props.ycolor_is (
"none"))
1810 gridcolor = props.get_ycolor_rgb ();
1812 if (props.minorgridcolormode_is (
"auto"))
1813 if (props.ycolormode_is (
"manual") && ! props.ycolor_is (
"none"))
1814 minorgridcolor = props.get_ycolor_rgb ();
1819 if (minorgridcolor.
isempty ())
1820 do_yminorgrid =
false;
1823 if (do_yminorgrid && ! do_ygrid)
1825 gridstyle = minorgridstyle;
1826 gridcolor = minorgridcolor;
1827 gridalpha = minorgridalpha;
1834 minorgridstyle, minorgridcolor, minorgridalpha,
1835 ymticks, y_min, y_max,
1836 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1837 1, (zstate != AXE_DEPTH_DIR));
1842 gridstyle, gridcolor, gridalpha,
1843 yticks, y_min, y_max,
1844 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1845 1, (zstate != AXE_DEPTH_DIR));
1848 if (props.ycolor_is (
"none"))
1854 double x_axis_pos = 0.;
1870 is_origin ? x_axis_pos : xpTick, xpTick,
1871 zpTick, zpTickN, 0., 0.,
1872 (is_origin_low ? -1. : 1.) *
1874 1, ! is_origin && mirror);
1877 is_origin ? x_axis_pos : xpTick, xpTickN,
1879 (is_origin_low ? -1. : 1.) *
1881 0., 0., 1, ! is_origin && mirror);
1887 is_origin ? x_axis_pos : xpTick, xpTick,
1888 zpTick, zpTickN, 0., 0.,
1889 (is_origin_low ? -1. : 1.) *
1891 1, ! is_origin && mirror);
1894 is_origin ? x_axis_pos : xpTick, xpTickN,
1896 (is_origin_low ? -1. : 1.) *
1898 0., 0., 1, ! is_origin && mirror);
1901 if (yticklabels.
numel () > 0)
1903 int halign = (ystate == AXE_HORZ_DIR
1905 : (! xyzSym || y2Dright || is_origin_low ? 0 : 2));
1906 int valign = (ystate == AXE_VERT_DIR
1908 : (is_origin_low ? 0 : 2));
1912 is_origin ? x_axis_pos : xpTick,
1914 (is_origin_low ? -1. : 1.) *
1916 1, halign, valign, wmax, hmax);
1919 (is_origin ? x_axis_pos : xpTick) +
1920 (is_origin_low ? -1. : 1.) *
1922 zpTick, 1, halign, valign, wmax, hmax);
1925 gh_mgr.get_object (props.get_ylabel ()).set (
"visible",
"on");
1928 gh_mgr.get_object (props.get_ylabel ()).set (
"visible",
"off");
1932 octave_unused_parameter (props);
1947 int zstate = props.get_zstate ();
1949 if (zstate != AXE_DEPTH_DIR && props.is_visible ()
1950 && (props.is_visible ()
1951 || (
m_selecting && props.pickableparts_is (
"all"))))
1953 bool xySym = props.get_xySym ();
1954 bool zSign = props.get_zSign ();
1955 double zticklen = props.get_zticklen ();
1956 double ztickoffset = props.get_ztickoffset ();
1957 double fx = props.get_fx ();
1958 double fy = props.get_fy ();
1959 double xPlane = props.get_xPlane ();
1960 double xPlaneN = props.get_xPlaneN ();
1961 double yPlane = props.get_yPlane ();
1962 double yPlaneN = props.get_yPlaneN ();
1963 double z_min = props.get_z_min ();
1964 double z_max = props.get_z_max ();
1967 Matrix zticks =
m_xform.zscale (props.get_ztick ().matrix_value ());
1968 Matrix zmticks =
m_xform.zscale (props.get_zminortickvalues ().matrix_value ());
1969 bool do_zminortick = props.is_zminortick () && ! zticks.
isempty ();
1970 string_vector zticklabels = props.get_zticklabel ().string_vector_value ();
1973 double linewidth = props.get_linewidth ();
1974 std::string gridstyle = props.get_gridlinestyle ();
1975 std::string minorgridstyle = props.get_minorgridlinestyle ();
1976 Matrix gridcolor = props.get_gridcolor_rgb ();
1977 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1978 double gridalpha = props.get_gridalpha ();
1979 double minorgridalpha = props.get_minorgridalpha ();
1980 bool do_zgrid = (props.is_zgrid () && (gridstyle !=
"none"));
1981 bool do_zminorgrid = (props.is_zminorgrid ()
1982 && (minorgridstyle !=
"none")
1984 bool mirror = props.is_box () && zstate != AXE_ANY_DIR;
1989 if (props.gridcolormode_is (
"auto"))
1990 if (props.zcolormode_is (
"manual") && ! props.zcolor_is (
"none"))
1991 gridcolor = props.get_zcolor_rgb ();
1993 if (props.minorgridcolormode_is (
"auto"))
1994 if (props.zcolormode_is (
"manual") && ! props.zcolor_is (
"none"))
1995 minorgridcolor = props.get_zcolor_rgb ();
2000 if (minorgridcolor.
isempty ())
2001 do_zminorgrid =
false;
2004 if (do_zminorgrid && ! do_zgrid)
2006 gridstyle = minorgridstyle;
2007 gridcolor = minorgridcolor;
2008 gridalpha = minorgridalpha;
2015 minorgridstyle, minorgridcolor, minorgridalpha,
2016 zmticks, z_min, z_max,
2017 xPlane, xPlaneN, yPlane, yPlaneN, 2,
true);
2022 gridstyle, gridcolor, gridalpha,
2023 zticks, z_min, z_max,
2024 xPlane, xPlaneN, yPlane, yPlaneN, 2,
true);
2027 if (props.zcolor_is (
"none"))
2052 yPlaneN, yPlane, 0.,
2081 yPlaneN, yPlane, 0.,
2092 if (zticklabels.
numel () > 0)
2095 int valign = (zstate == AXE_VERT_DIR ? 1 : (zSign ? 3 : 2));
2101 xPlaneN +
math::signum (xPlaneN-xPlane)*fx*ztickoffset,
2102 yPlane, 2, halign, valign, wmax, hmax);
2106 2, halign, valign, wmax, hmax);
2112 yPlaneN +
math::signum (yPlaneN-yPlane)*fy*ztickoffset,
2113 2, halign, valign, wmax, hmax);
2117 yPlaneN, 2, halign, valign, wmax, hmax);
2121 gh_mgr.get_object (props.get_zlabel ()).set (
"visible",
"on");
2124 gh_mgr.get_object (props.get_zlabel ()).set (
"visible",
"off");
2130 #if defined (HAVE_OPENGL)
2132 GLboolean antialias;
2136 if (antialias == GL_TRUE)
2148 if (antialias == GL_TRUE)
2152 octave_unused_parameter (props);
2164 std::list<graphics_object>& obj_list)
2166 #if defined (HAVE_OPENGL)
2169 Matrix children = props.get_all_children ();
2173 graphics_object go = gh_mgr.get_object (children(i));
2175 base_properties p = go.get_properties ();
2189 else if (go.isa (
"hggroup")
2190 && ! (
m_selecting && p.pickableparts_is (
"none")))
2192 else if (! (
m_selecting && p.pickableparts_is (
"none")))
2193 obj_list.push_back (go);
2198 octave_unused_parameter (props);
2199 octave_unused_parameter (obj_list);
2212 #if defined (HAVE_OPENGL)
2214 std::list<graphics_object> obj_list;
2215 std::list<graphics_object>::iterator it;
2231 "light: Maximum number of lights (%d) in these axes is "
2238 for (
unsigned int i = props.get_num_lights (); i <
m_max_lights; i++)
2243 m_view_vector = props.get_cameraposition ().matrix_value ();
2245 float cb[4] = { 1.0, 1.0, 1.0, 1.0 };
2246 ColumnVector ambient_color = props.get_ambientlightcolor_rgb ();
2247 for (
int i = 0; i < 3; i++)
2248 cb[i] = ambient_color(i);
2253 it = obj_list.begin ();
2254 while (it != obj_list.end ())
2256 graphics_object go = (*it);
2260 if (! go.isa (
"text") || go.get (
"units").string_value () ==
"data")
2265 it = obj_list.erase (it);
2275 for (it = obj_list.begin (); it != obj_list.end (); it++)
2277 graphics_object go = (*it);
2290 octave_unused_parameter (props);
2303 #if defined (HAVE_OPENGL)
2306 if (! props.is_visible () && props.get_tag () ==
"legend")
2311 if (
m_selecting && props.pickableparts_is (
"none"))
2316 double x_min = props.get_x_min ();
2317 double x_max = props.get_x_max ();
2318 double y_min = props.get_y_min ();
2319 double y_max = props.get_y_max ();
2320 double z_min = props.get_z_min ();
2321 double z_max = props.get_z_max ();
2323 if (x_max > floatmax || y_max > floatmax || z_max > floatmax
2324 || x_min < -floatmax || y_min < -floatmax || z_min < -floatmax)
2326 warning (
"opengl_renderer: data values greater than float capacity. (1) Scale data, or (2) Use gnuplot");
2334 bool is2D = props.get_is2D (
true);
2342 if (! is2D || props.layer_is (
"bottom"))
2345 if (props.get_tag () !=
"legend" || props.get_box () !=
"off")
2349 set_clipbox (x_min, x_max, y_min, y_max, z_min, z_max);
2353 if (is2D && props.layer_is (
"top"))
2356 if (props.get_tag () !=
"legend" || props.get_box () !=
"off")
2362 octave_unused_parameter (props);
2375 #if defined (HAVE_OPENGL)
2377 bool draw_all =
m_selecting && props.pickableparts_is (
"all");
2380 Matrix y =
m_xform.yscale (props.get_ydata ().matrix_value ());
2381 Matrix z =
m_xform.zscale (props.get_zdata ().matrix_value ());
2383 bool has_z = (z.
numel () > 0);
2387 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
2388 uint8_t clip_ok = 0x40;
2390 std::vector<uint8_t> clip (
n);
2393 for (
int i = 0; i <
n; i++)
2394 clip[i] = (
clip_code (
x(i), y(i), z(i)) & clip_mask);
2399 for (
int i = 0; i <
n; i++)
2400 clip[i] = (
clip_code (
x(i), y(i), z_mid) & clip_mask);
2403 if (! props.linestyle_is (
"none") && ! props.color_is (
"none"))
2406 set_linestyle (props.get_linestyle (),
false, props.get_linewidth ());
2415 for (
int i = 1; i <
n; i++)
2417 if ((clip[i-1] & clip[i]) == clip_ok)
2441 for (
int i = 1; i <
n; i++)
2443 if ((clip[i-1] & clip[i]) == clip_ok)
2470 if (! props.marker_is (
"none")
2471 && ! (props.markeredgecolor_is (
"none")
2472 && props.markerfacecolor_is (
"none")))
2478 else if (props.markeredgecolor_is (
"auto"))
2479 lc = props.get_color_rgb ();
2480 else if (! props.markeredgecolor_is (
"none"))
2481 lc = props.get_markeredgecolor_rgb ();
2485 if (props.markerfacecolor_is (
"auto"))
2486 fc = props.get_color_rgb ();
2487 else if (! props.markerfacecolor_is (
"none"))
2488 fc = props.get_markerfacecolor_rgb ();
2490 init_marker (props.get_marker (), props.get_markersize (),
2491 props.get_linewidth ());
2493 for (
int i = 0; i <
n; i++)
2495 if (clip[i] == clip_ok)
2508 octave_unused_parameter (props);
2521 #if defined (HAVE_OPENGL)
2523 bool draw_all =
m_selecting && props.pickableparts_is (
"all");
2525 const Matrix x =
m_xform.xscale (props.get_xdata ().matrix_value ());
2526 const Matrix y =
m_xform.yscale (props.get_ydata ().matrix_value ());
2527 const Matrix z =
m_xform.zscale (props.get_zdata ().matrix_value ());
2533 const NDArray vn = props.get_vertexnormals ().array_value ();
2535 bool has_vertex_normals = (vn_dims(0) == zr && vn_dims(1) == zc
2536 && vn_dims(2) == 3);
2537 const NDArray fn = props.get_facenormals ().array_value ();
2539 bool has_face_normals = (fn_dims(0) == zr - 1 && fn_dims(1) == zc - 1
2540 && fn_dims(2) == 3);
2545 int fc_mode = (props.facecolor_is_rgb () ? 0 :
2546 (props.facecolor_is (
"flat") ? 1 :
2547 (props.facecolor_is (
"interp") ? 2 :
2548 (props.facecolor_is (
"texturemap") ? 3 : -1))));
2549 int fl_mode = (props.facelighting_is (
"none") ? 0 :
2550 (props.facelighting_is (
"flat") ?
2551 (has_face_normals ? 1 : 0) :
2552 (has_vertex_normals ? 2 : 0)));
2553 int fa_mode = (props.facealpha_is_double () ? 0 :
2554 (props.facealpha_is (
"flat") ? 1 : 2));
2555 int ec_mode = (props.edgecolor_is_rgb () ? 0 :
2556 (props.edgecolor_is (
"flat") ? 1 :
2557 (props.edgecolor_is (
"interp") ? 2 : -1)));
2558 int el_mode = (props.edgelighting_is (
"none") ? 0 :
2559 (props.edgelighting_is (
"flat") ?
2560 (has_face_normals ? 1 : 0) :
2561 (has_vertex_normals ? 2 : 0)));
2562 int ea_mode = (props.edgealpha_is_double () ? 0 :
2563 (props.edgealpha_is (
"flat") ? 1 : 2));
2564 int bfl_mode = (props.backfacelighting_is (
"lit") ? 0 :
2565 (props.backfacelighting_is (
"reverselit") ? 1 : 2));
2566 bool do_lighting = props.get_do_lighting ();
2569 : props.get_facecolor_rgb ());
2570 Matrix ecolor = props.get_edgecolor_rgb ();
2573 float as = props.get_ambientstrength ();
2574 float ds = props.get_diffusestrength ();
2575 float ss = props.get_specularstrength ();
2576 float se = props.get_specularexponent () * 5;
2577 float scr = props.get_specularcolorreflectance ();
2578 float cb[4] = { 0.0, 0.0, 0.0, 1.0 };
2583 bool x_mat = (
x.rows () == z.
rows ());
2586 i1 = i2 = j1 = j2 = 0;
2588 if ((fc_mode > 0 && fc_mode < 3) || ec_mode > 0)
2589 c = props.get_color_data ().array_value ();
2593 for (
int i = 0; i < zr; i++)
2598 for (
int j = 0; j < zc; j++)
2607 if (fa_mode > 0 || ea_mode > 0)
2613 if (fl_mode > 0 || el_mode > 0)
2621 if (draw_all || ! props.facecolor_is (
"none"))
2625 fa = props.get_facealpha_double ();
2632 for (
int i = 0; i < 3; i++)
2633 cb[i] = as * fcolor(i);
2636 for (
int i = 0; i < 3; i++)
2637 cb[i] = ds * fcolor(i);
2640 for (
int i = 0; i < 3; i++)
2641 cb[i] = ss * (scr + (1-scr) * fcolor(i));
2646 if ((fl_mode > 0) && do_lighting)
2649 ? GL_SMOOTH : GL_FLAT);
2654 for (
int i = 1; i < zc; i++)
2662 for (
int j = 1; j < zr; j++)
2665 if (clip(j-1, i-1) || clip(j, i-1)
2666 || clip(j-1, i) || clip(j, i))
2669 if (fc_mode ==
FLAT)
2675 else if (fc_mode ==
INTERP)
2696 double (j-1) / (zr-1));
2697 else if (fc_mode > 0)
2700 for (
int k = 0; k < 3; k++)
2701 cb[k] = c(j-1, i-1, k);
2706 for (
int k = 0; k < 3; k++)
2710 for (
int k = 0; k < 3; k++)
2711 cb[k] = ds * c(j-1, i-1, k);
2714 for (
int k = 0; k < 3; k++)
2715 cb[k] = ss * (scr + (1-scr) * c(j-1, i-1, k));
2728 double (j-1) / (zr-1));
2729 else if (fc_mode ==
INTERP)
2731 for (
int k = 0; k < 3; k++)
2732 cb[k] = c(j-1, i, 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, k);
2745 for (
int k = 0; k < 3; k++)
2746 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k));
2758 tex.
tex_coord (
double (i) / (zc-1),
double (j) / (zr-1));
2759 else if (fc_mode ==
INTERP)
2761 for (
int k = 0; k < 3; k++)
2767 for (
int k = 0; k < 3; k++)
2771 for (
int k = 0; k < 3; k++)
2772 cb[k] = ds * c(j, i, k);
2775 for (
int k = 0; k < 3; k++)
2776 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
2788 double (j) / (zr-1));
2789 else if (fc_mode ==
INTERP)
2791 for (
int k = 0; k < 3; k++)
2792 cb[k] = c(j, i-1, k);
2797 for (
int k = 0; k < 3; k++)
2801 for (
int k = 0; k < 3; k++)
2802 cb[k] = ds * c(j, i-1, k);
2805 for (
int k = 0; k < 3; k++)
2806 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k));
2823 if ((fl_mode > 0) && do_lighting)
2832 if (! props.edgecolor_is (
"none") && ! props.linestyle_is (
"none"))
2834 if (props.get_edgealpha_double () == 1)
2842 for (
int i = 0; i < 3; i++)
2843 cb[i] = as * ecolor(i);
2846 for (
int i = 0; i < 3; i++)
2847 cb[i] = ds * ecolor(i);
2850 for (
int i = 0; i < 3; i++)
2851 cb[i] = ss * (scr + (1-scr) * ecolor(i));
2856 if ((el_mode > 0) && do_lighting)
2859 ? GL_SMOOTH : GL_FLAT);
2862 props.get_linewidth ());
2869 if (props.meshstyle_is (
"both") || props.meshstyle_is (
"column"))
2871 for (
int i = 0; i < zc; i++)
2879 for (
int j = 1; j < zr; j++)
2881 if (clip(j-1, i) || clip(j, i))
2884 if (ec_mode ==
FLAT)
2890 else if (ec_mode ==
INTERP)
2909 for (
int k = 0; k < 3; k++)
2910 cb[k] = c(j-1, i, k);
2915 for (
int k = 0; k < 3; k++)
2920 for (
int k = 0; k < 3; k++)
2921 cb[k] = ds * c(j-1, i, k);
2925 for (
int k = 0; k < 3; k++)
2926 cb[k] = ss * (scr + (1-scr) * c(j-1, i, k));
2944 for (
int k = 0; k < 3; k++)
2950 for (
int k = 0; k < 3; k++)
2955 for (
int k = 0; k < 3; k++)
2956 cb[k] = ds * c(j, i, k);
2960 for (
int k = 0; k < 3; k++)
2961 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
2978 if (props.meshstyle_is (
"both") || props.meshstyle_is (
"row"))
2980 for (
int j = 0; j < zr; j++)
2988 for (
int i = 1; i < zc; i++)
2990 if (clip(j, i-1) || clip(j, i))
2993 if (ec_mode ==
FLAT)
2999 else if (ec_mode ==
INTERP)
3018 for (
int k = 0; k < 3; k++)
3019 cb[k] = c(j, i-1, k);
3024 for (
int k = 0; k < 3; k++)
3029 for (
int k = 0; k < 3; k++)
3030 cb[k] = ds * c(j, i-1, k);
3034 for (
int k = 0; k < 3; k++)
3035 cb[k] = ss * (scr + (1-scr) * c(j, i-1, k));
3053 for (
int k = 0; k < 3; k++)
3059 for (
int k = 0; k < 3; k++)
3064 for (
int k = 0; k < 3; k++)
3065 cb[k] = ds * c(j, i, k);
3069 for (
int k = 0; k < 3; k++)
3070 cb[k] = ss * (scr + (1-scr) * c(j, i, k));
3088 if ((el_mode > 0) && do_lighting)
3097 if (! props.marker_is (
"none")
3098 && ! (props.markeredgecolor_is (
"none")
3099 && props.markerfacecolor_is (
"none")))
3105 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
3106 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
3109 props.get_markeredgecolor_rgb ());
3111 props.get_markerfacecolor_rgb ());
3114 if (mecolor.
isempty () && props.markeredgecolor_is (
"auto"))
3116 mecolor = props.get_edgecolor_rgb ();
3117 do_edge = ! props.edgecolor_is (
"none");
3120 if (mfcolor.
isempty () && props.markerfacecolor_is (
"auto"))
3122 mfcolor = props.get_facecolor_rgb ();
3123 do_face = ! props.facecolor_is (
"none");
3127 c = props.get_color_data ().array_value ();
3129 init_marker (props.get_marker (), props.get_markersize (),
3130 props.get_linewidth ());
3132 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
3133 uint8_t clip_ok = 0x40;
3135 for (
int i = 0; i < zc; i++)
3140 for (
int j = 0; j < zr; j++)
3145 if ((
clip_code (
x(j1, i), y(j, i1), z(j, i)) & clip_mask)
3149 if ((do_edge && mecolor.
isempty ())
3150 || (do_face && mfcolor.
isempty ()))
3155 for (
int k = 0; k < 3; k++)
3173 octave_unused_parameter (props);
3188 #if defined (HAVE_OPENGL)
3192 if (props.has_bad_data (msg))
3194 warning (
"opengl_renderer: %s. Not rendering.", msg.c_str ());
3198 bool draw_all =
m_selecting && props.pickableparts_is (
"all");
3199 const Matrix f = props.get_faces ().matrix_value ();
3200 const Matrix v =
m_xform.scale (props.get_vertices ().matrix_value ());
3207 int fcmax =
f.columns ();
3209 bool has_z = (v.
columns () > 2);
3210 bool has_facecolor =
false;
3211 bool has_facealpha =
false;
3213 int fc_mode = ((props.facecolor_is (
"none")
3214 || props.facecolor_is_rgb () || draw_all) ? 0 :
3215 (props.facecolor_is (
"flat") ? 1 : 2));
3216 int fl_mode = (props.facelighting_is (
"none") ? 0 :
3217 (props.facelighting_is (
"flat") ? 1 : 2));
3218 int fa_mode = (props.facealpha_is_double () ? 0 :
3219 (props.facealpha_is (
"flat") ? 1 : 2));
3220 int ec_mode = ((props.edgecolor_is (
"none")
3221 || props.edgecolor_is_rgb ()) ? 0 :
3222 (props.edgecolor_is (
"flat") ? 1 : 2));
3223 int el_mode = (props.edgelighting_is (
"none") ? 0 :
3224 (props.edgelighting_is (
"flat") ? 1 : 2));
3225 int ea_mode = (props.edgealpha_is_double () ? 0 :
3226 (props.edgealpha_is (
"flat") ? 1 : 2));
3227 int bfl_mode = (props.backfacelighting_is (
"lit") ? 0 :
3228 (props.backfacelighting_is (
"reverselit") ? 1 : 2));
3229 bool do_lighting = props.get_do_lighting ();
3231 Matrix fcolor = props.get_facecolor_rgb ();
3232 Matrix ecolor = props.get_edgecolor_rgb ();
3234 float as = props.get_ambientstrength ();
3235 float ds = props.get_diffusestrength ();
3236 float ss = props.get_specularstrength ();
3237 float se = props.get_specularexponent () * 5;
3238 float scr = props.get_specularcolorreflectance ();
3240 const Matrix vn = props.get_vertexnormals ().matrix_value ();
3241 bool has_vertex_normals = (vn.
rows () == nv);
3242 const Matrix fn = props.get_facenormals ().matrix_value ();
3243 bool has_face_normals = (fn.
rows () == nf);
3248 for (
int i = 0; i < nv; i++)
3251 for (
int i = 0; i < nv; i++)
3257 for (
int i = 0; i < nf; i++)
3262 for (
int j = 0; j < fcmax && !
math::isnan (
f(i, j)); j++, count++)
3263 fclip = (fclip || clip(
int (
f(i, j) - 1)));
3269 if (draw_all || fc_mode > 0 || ec_mode > 0)
3274 c = props.get_color_data ().matrix_value ();
3280 if (draw_all || fc_mode > 0)
3286 if (draw_all || ec_mode > 0)
3295 has_facecolor = ((c.
numel () > 0) && (c.
rows () ==
f.rows ()));
3298 if (fa_mode > 0 || ea_mode > 0)
3302 has_facealpha = ((a.
numel () > 0) && (a.
rows () ==
f.rows ()));
3306 fa = props.get_facealpha_double ();
3309 std::vector<vertex_data> vdata (
f.numel ());
3311 for (
int i = 0; i < nf; i++)
3312 for (
int j = 0; j < count_f(i); j++)
3314 int idx = int (
f(i, j) - 1);
3322 vv(0) = v(idx, 0); vv(1) = v(idx, 1);
3325 if (((fl_mode ==
FLAT) || (el_mode ==
FLAT)) && has_face_normals)
3332 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
3333 fnn(0) = dir * fn(i, 0);
3334 fnn(1) = dir * fn(i, 1);
3335 fnn(2) = dir * fn(i, 2);
3337 if ((fl_mode ==
GOURAUD || el_mode ==
GOURAUD) && has_vertex_normals)
3344 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
3345 vnn(0) = dir * vn(idx, 0);
3346 vnn(1) = dir * vn(idx, 1);
3347 vnn(2) = dir * vn(idx, 2);
3353 cc(0) = c(i, 0), cc(1) = c(i, 1), cc(2) = c(i, 2);
3355 cc(0) = c(idx, 0), cc(1) = c(idx, 1), cc(2) = c(idx, 2);
3359 else if (a.
numel () > 0)
3368 =
vertex_data (vv, cc, vnn, fnn, aa, as, ds, ss, se, scr);
3371 if (fl_mode > 0 || el_mode > 0)
3374 if (draw_all || ! props.facecolor_is (
"none"))
3384 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f };;
3386 for (
int i = 0; i < 3; i++)
3387 cb[i] = as * fcolor(i);
3390 for (
int i = 0; i < 3; i++)
3391 cb[i] = ds * fcolor(i);
3394 for (
int i = 0; i < 3; i++)
3395 cb[i] = ss * (scr + (1-scr) * fcolor(i));
3400 if ((fl_mode > 0) && do_lighting)
3409 std::vector<octave_idx_type>::const_iterator it;
3412 for (
int i = 0; i < nf; i++)
3417 bool is_non_planar =
false;
3418 if (props.m_coplanar_last_idx.size () > 0
3419 && props.m_coplanar_last_idx[i].size () > 1)
3421 is_non_planar =
true;
3422 it = props.m_coplanar_last_idx[i].end ();
3432 if (it == props.m_coplanar_last_idx[i].begin ())
3442 i_end = count_f(i) - 1;
3450 for (
int j = i_end; j > i_start; j--)
3453 = vdata[i+j*fr].get_rep ();
3462 if (fc_mode ==
FLAT)
3467 if (col.
numel () == 3)
3472 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
3474 for (
int k = 0; k < 3; k++)
3479 for (
int k = 0; k < 3; k++)
3484 for (
int k = 0; k < 3; k++)
3501 while (i_start > 0);
3504 if ((fl_mode > 0) && do_lighting)
3514 || (! props.edgecolor_is (
"none") && ! props.linestyle_is (
"none")))
3517 if (props.get_edgealpha_double () == 1)
3525 float cb[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
3529 for (
int i = 0; i < 3; i++)
3530 cb[i] = (as * ecolor(i));
3535 if ((el_mode > 0) && do_lighting)
3538 double linewidth = props.get_linewidth ();
3551 for (
int i = 0; i < nf; i++)
3553 bool is_non_planar =
false;
3554 if (props.m_coplanar_last_idx.size () > 0
3555 && props.m_coplanar_last_idx[i].size () > 1)
3556 is_non_planar =
true;
3557 if (clip_f(i) || is_non_planar)
3565 ? GL_SMOOTH : GL_FLAT);
3568 for (
int j = count_f(i)-1; j >= 0; j--)
3570 if (! clip(
int (
f(i, j) - 1)))
3573 = vdata[i+j*fr].get_rep ();
3584 if (col.
numel () == 3)
3597 int j = count_f(i)-1;
3598 if (flag && ! clip(
int (
f(i, j) - 1)))
3601 = vdata[i+j*fr].get_rep ();
3607 if (col.
numel () == 3)
3621 for (
int j = count_f(i)-1; j >= 0; j--)
3624 = vdata[i+j*fr].get_rep ();
3636 if ((el_mode > 0) && do_lighting)
3645 if (! props.marker_is (
"none")
3646 && ! (props.markeredgecolor_is (
"none")
3647 && props.markerfacecolor_is (
"none")))
3649 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
3650 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
3653 props.get_markeredgecolor_rgb ());
3655 props.get_markerfacecolor_rgb ());
3657 bool has_markerfacecolor = draw_all ||
false;
3659 if ((mecolor.
isempty () && ! props.markeredgecolor_is (
"none"))
3660 || (mfcolor.
isempty () && ! props.markerfacecolor_is (
"none")))
3662 Matrix mc = props.get_color_data ().matrix_value ();
3664 if (mc.
rows () == 1)
3667 if (mfcolor.
isempty () && ! props.markerfacecolor_is (
"none"))
3670 if (mecolor.
isempty () && ! props.markeredgecolor_is (
"none"))
3676 c = props.get_color_data ().matrix_value ();
3677 has_markerfacecolor = ((c.
numel () > 0)
3678 && (c.
rows () ==
f.rows ()));
3682 init_marker (props.get_marker (), props.get_markersize (),
3683 props.get_linewidth ());
3685 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
3686 uint8_t clip_ok = 0x40;
3688 for (
int i = 0; i < nf; i++)
3689 for (
int j = 0; j < count_f(i); j++)
3691 int idx = int (
f(i, j) - 1);
3693 if ((
clip_code (v(idx, 0), v(idx, 1), (has_z ? v(idx, 2) : 0))
3694 & clip_mask) != clip_ok)
3701 if (has_markerfacecolor)
3702 cc(0) = c(i, 0), cc(1) = c(i, 1), cc(2) = c(i, 2);
3704 cc(0) = c(idx, 0), cc(1) = c(idx, 1), cc(2) = c(idx, 2);
3712 draw_marker (v(idx, 0), v(idx, 1), (has_z ? v(idx, 2) : 0), lc, fc);
3720 octave_unused_parameter (props);
3733 #if defined (HAVE_OPENGL)
3737 if (props.has_bad_data (msg))
3739 warning (
"opengl_renderer: %s. Not rendering.", msg.c_str ());
3745 if (draw_all || (! props.marker_is (
"none")
3746 && ! (props.markeredgecolor_is (
"none")
3747 && props.markerfacecolor_is (
"none"))))
3749 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
3750 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
3752 const Matrix x = props.get_xdata ().matrix_value ();
3753 const Matrix y = props.get_ydata ().matrix_value ();
3754 const Matrix z = props.get_zdata ().matrix_value ();
3755 const Matrix c = props.get_color_data ().matrix_value ();
3756 const Matrix s = props.get_sizedata ().matrix_value ();
3763 props.get_markeredgecolor_rgb ());
3765 props.get_markerfacecolor_rgb ());
3766 const double mea = props.get_markeredgealpha ();
3767 const double mfa = props.get_markerfacealpha ();
3769 if (props.markerfacecolor_is (
"auto"))
3772 graphics_object go = gh_mgr.get_object (props.get___myhandle__ ());
3773 graphics_object ax = go.get_ancestor (
"axes");
3777 mfcolor = ax_props.get_color ().matrix_value ();
3780 init_marker (props.get_marker (), std::sqrt (s(0)),
3781 props.get_linewidth ());
3783 uint8_t clip_mask = (props.is_clipping () ? 0x7F : 0x40);
3784 uint8_t clip_ok = 0x40;
3800 for (
int i = 0; i < np; i++)
3802 if ((
clip_code (
x(i), y(i), (has_z ? z(i) : 0.0)) & clip_mask)
3821 draw_marker (
x(i), y(i), (has_z ? z(i) : 0.0), lc, fc, mea, mfa);
3829 octave_unused_parameter (props);
3842 #if defined (HAVE_OPENGL)
3848 float pos[4] = { 0, 0, 0, 0 };
3849 Matrix lpos = props.get_position ().matrix_value ();
3850 for (
int i = 0; i < 3; i++)
3852 if (props.style_is (
"local"))
3857 float col[4] = { 1, 1, 1, 1 };
3858 Matrix lcolor = props.get_color ().matrix_value ();
3859 for (
int i = 0; i < 3; i++)
3866 octave_unused_parameter (props);
3879 draw (props.get_children ());
3885 #if defined (HAVE_OPENGL)
3910 #if defined (HAVE_OPENGL)
3931 #if defined (HAVE_OPENGL)
3933 if (props.get_string ().isempty () || props.color_is (
"none"))
3939 if (! props.is_clipping ()
3940 || (
clip_code (pos(0), pos(1), pos.
numel () > 2 ? pos(2) : 0.0) == 0x40))
3948 render_text (props.get_pixels (), props.get_extent_matrix (),
3949 pos(0), pos(1), pos(2), props.get_rotation ());
3956 octave_unused_parameter (props);
3970 #if defined (HAVE_OPENGL)
3972 Matrix bgcol = props.get_backgroundcolor_rgb ();
3973 Matrix ecol = props.get_edgecolor_rgb ();
3978 Matrix pos = props.get_data_position ();
3990 double rotation = props.get_rotation ();
3995 const Matrix bbox = props.get_extent_matrix ();
4024 set_linestyle (props.get_linestyle (),
false, props.get_linewidth ());
4042 octave_unused_parameter (props);
4055 #if defined (HAVE_OPENGL)
4058 Matrix x = props.get_xdata ().matrix_value ();
4059 Matrix y = props.get_ydata ().matrix_value ();
4065 octave_unused_parameter (props);
4079 #if defined (HAVE_OPENGL)
4084 double x0, x1, y0, y1;
4088 dx = (
x(1) -
x(0)) / (
w - 1);
4095 dy = (y(1) - y(0)) / (h - 1);
4101 if (dv.
ndims () == 3 && (dv(2) == 3 || dv(2) == 4))
4141 warning (
"opengl_renderer: invalid image size (expected MxNx3 or MxN)");
4145 octave_unused_parameter (cdata);
4146 octave_unused_parameter (
x);
4147 octave_unused_parameter (y);
4148 octave_unused_parameter (ortho);
4164 for (
int i =
len-1; i >= 0; i--)
4166 graphics_object obj = gh_mgr.get_object (hlist(i));
4169 draw (obj, toplevel);
4176 #if defined (HAVE_OPENGL)
4182 octave_unused_parameter (
w);
4183 octave_unused_parameter (h);
4196 Matrix retval (1, 4, 0.0);
4198 #if defined (HAVE_OPENGL)
4199 #if defined (HAVE_FRAMEWORK_OPENGL)
4207 for (
int i = 0; i < 4; i++)
4225 #if defined (HAVE_OPENGL)
4234 octave_unused_parameter (c);
4247 bool do_anti_alias = props.get (
"fontsmoothing").string_value () ==
"on";
4250 props.get (
"fontweight").string_value (),
4251 props.get (
"fontangle").string_value (),
4252 props.get (
"__fontsize_points__").double_value ()
4259 #if defined (HAVE_OPENGL)
4275 octave_unused_parameter (on);
4276 octave_unused_parameter (offset);
4289 #if defined (HAVE_OPENGL)
4295 octave_unused_parameter (
w);
4309 #if defined (HAVE_OPENGL)
4315 uint16_t pattern = 0xFFFF;
4347 if (solid && ! use_stipple)
4354 octave_unused_parameter (s);
4355 octave_unused_parameter (use_stipple);
4356 octave_unused_parameter (linewidth);
4368 double z1,
double z2)
4370 #if defined (HAVE_OPENGL)
4372 double dx = (x2-x1);
4373 double dy = (y2-y1);
4374 double dz = (z2-z1);
4376 x1 -= 0.001*dx; x2 += 0.001*dx;
4377 y1 -= 0.001*dy; y2 += 0.001*dy;
4378 z1 -= 0.001*dz; z2 += 0.001*dz;
4382 p(0) = -1; p(3) = x2;
4384 p(0) = 1; p(3) = -x1;
4386 p(0) = 0; p(1) = -1; p(3) = y2;
4388 p(1) = 1; p(3) = -y1;
4390 p(1) = 0; p(2) = -1; p(3) = z2;
4392 p(2) = 1; p(3) = -z1;
4401 octave_unused_parameter (x1);
4402 octave_unused_parameter (x2);
4403 octave_unused_parameter (y1);
4404 octave_unused_parameter (y2);
4405 octave_unused_parameter (z1);
4406 octave_unused_parameter (z2);
4419 #if defined (HAVE_OPENGL)
4423 if (enable != has_clipping)
4426 for (
int i = 0; i < 6; i++)
4429 for (
int i = 0; i < 6; i++)
4435 octave_unused_parameter (enable);
4448 #if defined (HAVE_OPENGL)
4466 octave_unused_parameter (
m);
4467 octave_unused_parameter (size);
4468 octave_unused_parameter (width);
4481 #if defined (HAVE_OPENGL)
4488 octave_unused_parameter (
m);
4489 octave_unused_parameter (size);
4502 #if defined (HAVE_OPENGL)
4526 const double la,
const double fa)
4528 #if defined (HAVE_OPENGL)
4540 if (lc.
numel () > 0)
4559 octave_unused_parameter (
x);
4560 octave_unused_parameter (y);
4561 octave_unused_parameter (z);
4562 octave_unused_parameter (lc);
4563 octave_unused_parameter (fc);
4564 octave_unused_parameter (la);
4565 octave_unused_parameter (fa);
4578 #if defined (HAVE_OPENGL)
4601 #if defined (HAVE_OPENGL)
4607 std::ostringstream buf;
4611 return std::string (buf.str ());
4615 octave_unused_parameter (
id);
4621 return std::string ();
4629 #if defined (HAVE_OPENGL)
4631 double x =
n(j, i, 0);
4632 double y =
n(j, i, 1);
4633 double z =
n(j, i, 2);
4635 double d = sqrt (
x*
x + y*y + z*z);
4641 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
4647 octave_unused_parameter (bfl_mode);
4648 octave_unused_parameter (
n);
4649 octave_unused_parameter (j);
4650 octave_unused_parameter (i);
4667 static const double pix_per_pts =
4668 gh_mgr.get_object (0).get (
"screenpixelsperinch").double_value () / 72.0;
4670 double retval = val;
4673 retval *= pix_per_pts;
4682 #if defined (HAVE_OPENGL)
4686 if (filled && (c ==
'+' || c ==
'x' || c ==
'*' || c ==
'.'
4687 || c ==
'|' || c ==
'_'))
4696 const double sqrt2d4 = 0.35355339059327;
4697 double tt = sz*sqrt2d4;
4748 if (sz > 0 && sz < 3)
4751 int div =
static_cast<int> (M_PI * sz / 12);
4755 double ang_step = M_PI / div;
4758 for (
double ang = 0; ang < 2*M_PI; ang += ang_step)
4773 int div =
static_cast<int> (M_PI * sz / 4);
4777 double ang_step = M_PI / div;
4780 for (
double ang = 0; ang < 2*M_PI; ang += ang_step)
4824 dr = 1.0 - sin (M_PI/10)/sin (3*M_PI/10)*1.02;
4827 for (
int i = 0; i < 2*5; i++)
4829 ang = (-0.5 + double (i+1) / 5) * M_PI;
4830 r = 1.0 - (dr * fmod (
double (i+1), 2.0));
4839 dr = 1.0 - 0.5/sin (M_PI/3)*1.02;
4842 for (
int i = 0; i < 2*6; i++)
4844 ang = (0.5 + double (i+1) / 6.0) * M_PI;
4845 r = 1.0 - (dr * fmod (
double (i+1), 2.0));
4852 warning (
"opengl_renderer: unsupported marker '%s'",
marker.c_str ());
4862 octave_unused_parameter (
marker);
4863 octave_unused_parameter (size);
4864 octave_unused_parameter (filled);
4878 int halign,
int valign,
double rotation)
4886 std::list<text_renderer::string>& lst,
4888 int halign,
int valign,
double rotation)
4896 double x,
double y,
double z,
4897 int halign,
int valign,
double rotation)
4899 #if defined (HAVE_OPENGL)
4918 octave_unused_parameter (txt);
4919 octave_unused_parameter (
x);
4920 octave_unused_parameter (y);
4921 octave_unused_parameter (z);
4922 octave_unused_parameter (halign);
4923 octave_unused_parameter (valign);
4924 octave_unused_parameter (rotation);
4936 double x,
double y,
double z,
double rotation)
4938 #if defined (HAVE_OPENGL)
4964 xdata, ydata,
true);
4975 octave_unused_parameter (pixels);
4976 octave_unused_parameter (bbox);
4977 octave_unused_parameter (
x);
4978 octave_unused_parameter (y);
4979 octave_unused_parameter (z);
4980 octave_unused_parameter (rotation);
charNDArray max(char d, const charNDArray &m)
charNDArray min(char d, const charNDArray &m)
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type columns(void) const
OCTARRAY_OVERRIDABLE_FUNC_API const T * data(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API bool isempty(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
OCTARRAY_OVERRIDABLE_FUNC_API const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type rows(void) const
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 const idx_vector colon
static idx_vector make_range(octave_idx_type start, octave_idx_type step, octave_idx_type len)
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
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 const GLubyte * glGetString(GLenum name)
virtual GLenum glGetError(void)
virtual void glVertex2d(GLdouble x, GLdouble y)
virtual void glNewList(GLuint list, GLenum mode)
virtual void glDeleteTextures(GLsizei n, const GLuint *textures)
virtual void glVertex3d(GLdouble x, GLdouble y, GLdouble z)
virtual void glLineStipple(GLint factor, GLushort pattern)
virtual void glPopMatrix(void)
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 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 glTexCoord2d(GLdouble s, GLdouble t)
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 glLoadIdentity(void)
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 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 glEndList(void)
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(void)
virtual void glScaled(GLdouble x, GLdouble y, GLdouble z)
virtual void glLightfv(GLenum light, GLenum pname, const GLfloat *params)
virtual void glTranslated(GLdouble x, GLdouble y, GLdouble z)
virtual void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
virtual void glFinish(void)
virtual void glPopAttrib(void)
patch_tessellator(opengl_renderer *r, int cmode, int lmode, bool fl, float idx=0.0)
opengl_renderer * m_renderer
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)
double points_to_pixels(const double val) const
virtual graphics_xform get_transform(void) const
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)
caseless_str m_interpreter
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 end_marker(void)
virtual void set_linewidth(float w)
ColumnVector m_view_vector
void draw_axes_planes(const axes::properties &props)
void set_normal(int bfl_mode, const NDArray &n, int j, int i)
virtual void draw_scatter(const scatter::properties &props)
void draw_axes_children(const axes::properties &props)
void set_ortho_coordinates(void)
virtual void draw_line(const line::properties &props)
void draw_all_lights(const base_properties &props, std::list< graphics_object > &obj_list)
unsigned int m_current_light
virtual void draw_uibuttongroup(const uibuttongroup::properties &props, const graphics_object &go)
opengl_renderer(opengl_functions &glfcns)
void init_maxlights(void)
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)
text_renderer m_txt_renderer
graphics_toolkit m_toolkit
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)
void draw_axes_x_grid(const axes::properties &props)
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)
void draw_axes_y_grid(const axes::properties &props)
void draw_axes_boxes(const axes::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)
uint8_t clip_code(double x, double y, double z) const
virtual void draw_zoom_rect(int x1, int y1, int x2, int y2)
virtual void set_interpreter(const caseless_str &interp)
std::string get_string(unsigned int id) 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)
virtual void finish(void)
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)
void draw_axes_grids(const axes::properties &props)
unsigned int make_marker_list(const std::string &m, double size, bool filled) const
virtual void set_viewport(int w, int h)
void restore_previous_coordinates(void)
unsigned int m_filled_marker_id
virtual void draw_text(const text::properties &props)
unsigned int m_max_lights
virtual void set_font(const base_properties &props)
void draw_axes_z_grid(const axes::properties &props)
virtual void set_linecap(const std::string &)
virtual void draw_figure(const figure::properties &props)
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)
virtual Matrix get_viewport_scaled(void) const
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)
bool is_nan_or_inf(double x, double y, double z) const
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 &)
void draw_texture_image(const octave_value cdata, Matrix x, Matrix y, bool ortho=false)
virtual void set_color(const Matrix &c)
static void tess_begin(GLenum type, void *t)
opengl_tessellator(const opengl_tessellator &)=delete
void end_contour(void) const
void end_polygon(void) const
virtual void error(GLenum err)
bool is_filled(void) const
void begin_contour(void) const
virtual ~opengl_tessellator(void)
void add_vertex(double *loc, void *data) const
void begin_polygon(bool filled=true)
static void tess_error(GLenum err, void *t)
static void tess_vertex(void *v, void *t)
static void tess_end(void *t)
static void tess_combine(GLdouble c[3], void *v[4], GLfloat w[4], void **out, void *t)
virtual void vertex(void *)
GLUtesselator * m_glu_tess
virtual void edge_flag(GLboolean)
virtual void begin(GLenum)
static void tess_edge_flag(GLboolean flag, void *t)
virtual void combine(GLdouble[3], void *[4], GLfloat[4], void **)
texture_rep(opengl_functions &glfcns, GLuint id, int w, int h, int tw, int th)
opengl_functions & m_glfcns
void tex_coord(double q, double r) const
texture_rep(opengl_functions &glfcns)
void bind(int mode) const
opengl_texture(opengl_functions &glfcns)
opengl_texture(const opengl_texture &)=default
opengl_texture & operator=(const opengl_texture &)=default
static opengl_texture create(opengl_functions &glfcns, const octave_value &data)
std::shared_ptr< texture_rep > m_rep
bool is_valid(void) const
opengl_texture(const std::shared_ptr< texture_rep > &new_rep)
~opengl_texture(void)=default
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
octave_idx_type numel(void) 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)
float m_specular_color_refl
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)
std::shared_ptr< vertex_data_rep > m_rep
vertex_data & operator=(const vertex_data &)=default
vertex_data_rep * get_rep(void) const
~vertex_data(void)=default
static std::shared_ptr< vertex_data_rep > nil_rep(void)
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(const vertex_data &)=default
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,...)
#define panic_impossible()
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
static int next_power_of_2(int n)
gh_manager & __get_gh_manager__(void)
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
std::complex< double > w(std::complex< double > z, double relerr=0)
T::properties & properties(graphics_object obj)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)