23 #if defined (HAVE_CONFIG_H) 29 #if defined (HAVE_WINDOWS_H) 30 # define WIN32_LEAN_AND_MEAN 45 #if defined (HAVE_OPENGL) 58 #define LIGHT_MODE GL_FRONT_AND_BACK 88 #if ! defined (CALLBACK) 100 :
id (),
w (),
h (), tw (), th (), tx (), ty (),
101 valid (
false), count (1)
104 texture_rep (GLuint id_arg,
int w_arg,
int h_arg,
int tw_arg,
int th_arg)
105 :
id (id_arg),
w (w_arg),
h (h_arg), tw (tw_arg), th (th_arg),
112 glDeleteTextures (1, &
id);
116 {
if (valid) glBindTexture (
mode,
id); }
119 {
if (valid) glTexCoord2d (q*tx, r*ty); }
145 if (--rep->
count == 0)
151 if (--rep->
count == 0)
169 {
return rep->
valid; }
192 glGenTextures (1, &
id);
193 glBindTexture (GL_TEXTURE_2D,
id);
201 for (
int i = 0;
i <
h;
i++)
203 for (
int j = 0, idx =
i*tw*3; j <
w; j++, idx += 3)
205 a[idx] = xdata(
i,j,0);
206 a[idx+1] = xdata(
i,j,1);
207 a[idx+2] = xdata(
i,j,2);
211 glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0, GL_RGB, GL_FLOAT,
a);
219 for (
int i = 0;
i <
h;
i++)
221 for (
int j = 0, idx =
i*tw*3; j <
w; j++, idx += 3)
223 a[idx] = xdata(
i,j,0);
224 a[idx+1] = xdata(
i,j,1);
225 a[idx+2] = xdata(
i,j,2);
229 glTexImage2D (GL_TEXTURE_2D, 0, 3, tw, th, 0,
230 GL_RGB, GL_UNSIGNED_BYTE,
a);
235 warning (
"opengl_texture::create: invalid texture data type (double or uint8 required)");
240 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
241 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
243 if (glGetError () != GL_NO_ERROR)
244 warning (
"opengl_texture::create: OpenGL error while generating texture data");
250 warning (
"opengl_texture::create: invalid texture data size");
259 #if defined (HAVE_FRAMEWORK_OPENGL) && defined (HAVE_GLUTESSCALLBACK_THREEDOTS) 276 {
if (glu_tess) gluDeleteTess (glu_tess); }
280 gluTessProperty (glu_tess, GLU_TESS_BOUNDARY_ONLY,
281 (filled ? GL_FALSE : GL_TRUE));
283 gluTessBeginPolygon (glu_tess,
this);
287 { gluTessEndPolygon (glu_tess); }
290 { gluTessBeginContour (glu_tess); }
293 { gluTessEndContour (glu_tess); }
296 { gluTessVertex (glu_tess,
loc, data); }
301 virtual void end (
void) { }
305 virtual void combine (GLdouble [3] ,
void * [4] ,
306 GLfloat [4] ,
void ** ) { }
311 {
::error (
"OpenGL tesselation error (%d)",
err); }
315 glu_tess = gluNewTess ();
317 gluTessCallback (glu_tess, GLU_TESS_BEGIN_DATA,
318 reinterpret_cast<fcn> (tess_begin));
319 gluTessCallback (glu_tess, GLU_TESS_END_DATA,
320 reinterpret_cast<fcn> (tess_end));
321 gluTessCallback (glu_tess, GLU_TESS_VERTEX_DATA,
322 reinterpret_cast<fcn> (tess_vertex));
323 gluTessCallback (glu_tess, GLU_TESS_COMBINE_DATA,
324 reinterpret_cast<fcn> (tess_combine));
325 gluTessCallback (glu_tess, GLU_TESS_EDGE_FLAG_DATA,
326 reinterpret_cast<fcn> (tess_edge_flag));
327 gluTessCallback (glu_tess, GLU_TESS_ERROR_DATA,
328 reinterpret_cast<fcn> (tess_error));
380 : coords (), color (), normal (), alpha (),
381 ambient (), diffuse (), specular (), specular_exp (),
382 specular_color_refl (), count (1) { }
385 double a,
float as,
float ds,
float ss,
float se,
387 : coords (
c), color (col), normal (n), alpha (
a),
388 ambient (as), diffuse (ds), specular (ss), specular_exp (se),
389 specular_color_refl (scr), count (1) { }
410 double a,
float as,
float ds,
float ss,
float se,
420 if (--rep->
count == 0)
426 if (--rep->
count == 0)
444 color_mode (cmode), light_mode (lmode), index (idx),
445 first (true), tmp_vdata ()
455 glShadeModel (GL_SMOOTH);
457 glShadeModel (GL_FLAT);
460 renderer->set_polygon_offset (
true, index);
469 renderer->set_polygon_offset (
false);
481 if (color_mode ==
INTERP || (color_mode ==
FLAT && ! is_filled ()))
485 if (col.
numel () == 3)
487 glColor4d (col(0), col(1), col(2), v->
alpha);
490 float buf[4] = { 0, 0, 0, 1 };
492 for (
int k = 0;
k < 3;
k++)
496 for (
int k = 0;
k < 3;
k++)
500 for (
int k = 0;
k < 3;
k++)
517 void combine (GLdouble xyz[3],
void *data[4], GLfloat
w[4],
void **out_data)
524 for (
int i = 0;
i < 4;
i++)
528 if (vmax == 4 && ! v[
i])
541 if (v[0]->color.numel ())
544 for (
int ic = 0; ic < 3; ic++)
545 for (
int iv = 0; iv < vmax; iv++)
546 cc(ic) += (
w[iv] * v[iv]->
color (ic));
549 if (v[0]->normal.numel () > 0)
551 for (
int in = 0; in < 3; in++)
552 for (
int iv = 0; iv < vmax; iv++)
556 for (
int iv = 0; iv < vmax; iv++)
557 aa += (
w[iv] * v[iv]->alpha);
559 vertex_data new_v (vv, cc,
nn, aa, v[0]->ambient, v[0]->diffuse,
560 v[0]->specular, v[0]->specular_exp, v[0]->specular_color_refl);
561 tmp_vdata.push_back (new_v);
594 zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (),
595 camera_pos (), camera_dir (),
interpreter (
"none"), txt_renderer (),
602 #if defined (HAVE_OPENGL) 607 static bool ok = (
sizeof (int) <=
sizeof (GLsizei));
610 error (
"the size of GLsizei is smaller than the size of int");
630 if (go.
isa (
"figure"))
631 draw_figure (dynamic_cast<const figure::properties&> (props));
632 else if (go.
isa (
"axes"))
633 draw_axes (dynamic_cast<const axes::properties&> (props));
634 else if (go.
isa (
"line"))
635 draw_line (dynamic_cast<const line::properties&> (props));
636 else if (go.
isa (
"surface"))
637 draw_surface (dynamic_cast<const surface::properties&> (props));
638 else if (go.
isa (
"patch"))
639 draw_patch (dynamic_cast<const patch::properties&> (props));
640 else if (go.
isa (
"light"))
641 draw_light (dynamic_cast<const light::properties&> (props));
642 else if (go.
isa (
"hggroup"))
643 draw_hggroup (dynamic_cast<const hggroup::properties&> (props));
644 else if (go.
isa (
"text"))
645 draw_text (dynamic_cast<const text::properties&> (props));
646 else if (go.
isa (
"image"))
647 draw_image (dynamic_cast<const image::properties&> (props));
648 else if (go.
isa (
"uimenu") || go.
isa (
"uicontrol")
649 || go.
isa (
"uicontextmenu") || go.
isa (
"uitoolbar")
650 || go.
isa (
"uipushtool") || go.
isa (
"uitoggletool"))
652 else if (go.
isa (
"uipanel"))
655 draw_uipanel (dynamic_cast<const uipanel::properties&> (props), go);
657 else if (go.
isa (
"uibuttongroup"))
664 warning (
"opengl_renderer: cannot render object of type '%s'",
668 #if defined (HAVE_OPENGL) 670 GLenum gl_error = glGetError ();
672 warning (
"opengl_renderer: Error '%s' (%d) occurred drawing '%s' object",
678 #if defined (HAVE_OPENGL) 687 std::ostringstream buf;
688 buf << glGetString (
id);
699 init_gl_context (props.is_graphicssmoothing (), props.get_color_rgb ());
701 #if defined (HAVE_OPENGL) 726 props.get_backgroundcolor_rgb ());
744 props.get_backgroundcolor_rgb ());
754 #if defined (HAVE_OPENGL) 758 glEnable (GL_DEPTH_TEST);
759 glDepthFunc (GL_LEQUAL);
760 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
761 glAlphaFunc (GL_GREATER, 0.0
f);
762 glEnable (GL_NORMALIZE);
767 glEnable (GL_MULTISAMPLE);
768 bool has_multisample =
false;
771 GLint iMultiSample, iNumSamples;
772 glGetIntegerv (GL_SAMPLE_BUFFERS, &iMultiSample);
773 glGetIntegerv (GL_SAMPLES, &iNumSamples);
774 if (iMultiSample == GL_TRUE && iNumSamples > 0)
775 has_multisample =
true;
778 if (! has_multisample)
781 glDisable (GL_MULTISAMPLE);
786 glEnable (GL_LINE_SMOOTH);
787 glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
792 glDisable (GL_BLEND);
793 glDisable (GL_LINE_SMOOTH);
800 glClearColor (
c(0),
c(1),
c(2), 1);
801 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
804 GLenum gl_error = glGetError ();
806 warning (
"opengl_renderer: Error '%s' (%d) occurred in init_gl_context",
807 gluErrorString (gl_error), gl_error);
811 octave_unused_parameter (enhanced);
812 octave_unused_parameter (
c);
825 const Matrix& gridcolor,
const double gridalpha,
826 const Matrix& ticks,
double lim1,
double lim2,
827 double p1,
double p1N,
double p2,
double p2N,
830 #if defined (HAVE_OPENGL) 832 glColor4d (gridcolor(0), gridcolor(1), gridcolor(2), gridalpha);
835 for (
int i = 0;
i < ticks.
numel ();
i++)
837 double val = ticks(
i);
838 if (lim1 <=
val &&
val <= lim2)
842 glVertex3d (
val, p1N, p2);
843 glVertex3d (
val, p1, p2);
846 glVertex3d (
val, p1, p2N);
847 glVertex3d (
val, p1, p2);
852 glVertex3d (p1N,
val, p2);
853 glVertex3d (p1,
val, p2);
856 glVertex3d (p1,
val, p2N);
857 glVertex3d (p1,
val, p2);
862 glVertex3d (p1N, p2,
val);
863 glVertex3d (p1, p2,
val);
864 glVertex3d (p1, p2N,
val);
865 glVertex3d (p1, p2,
val);
871 double black[3] = {0, 0, 0};
876 octave_unused_parameter (linewidth);
877 octave_unused_parameter (gridstyle);
878 octave_unused_parameter (gridcolor);
879 octave_unused_parameter (gridalpha);
880 octave_unused_parameter (ticks);
881 octave_unused_parameter (lim1);
882 octave_unused_parameter (lim2);
883 octave_unused_parameter (p1);
884 octave_unused_parameter (p1N);
885 octave_unused_parameter (p2);
886 octave_unused_parameter (p2N);
887 octave_unused_parameter (xyz);
888 octave_unused_parameter (is_3D);
900 double lim1,
double lim2,
901 double p1,
double p1N,
902 double p2,
double p2N,
903 double dx,
double dy,
double dz,
904 int xyz,
bool mirror)
906 #if defined (HAVE_OPENGL) 910 for (
int i = 0;
i < ticks.
numel ();
i++)
912 double val = ticks(
i);
914 if (lim1 <=
val &&
val <= lim2)
918 glVertex3d (
val, p1, p2);
919 glVertex3d (
val, p1+dy, p2+dz);
922 glVertex3d (
val, p1N, p2N);
923 glVertex3d (
val, p1N-dy, p2N-dz);
928 glVertex3d (p1,
val, p2);
929 glVertex3d (p1+dx,
val, p2+dz);
932 glVertex3d (p1N,
val, p2N);
933 glVertex3d (p1N-dx,
val, p2N-dz);
938 glVertex3d (p1, p2,
val);
939 glVertex3d (p1+dx, p2+dy,
val);
942 glVertex3d (p1N, p2N,
val);
943 glVertex3d (p1N-dx, p2N-dy,
val);
953 octave_unused_parameter (ticks);
954 octave_unused_parameter (lim1);
955 octave_unused_parameter (lim2);
956 octave_unused_parameter (p1);
957 octave_unused_parameter (p1N);
958 octave_unused_parameter (p2);
959 octave_unused_parameter (p2N);
960 octave_unused_parameter (dx);
961 octave_unused_parameter (dy);
962 octave_unused_parameter (dz);
963 octave_unused_parameter (xyz);
964 octave_unused_parameter (mirror);
977 double lim1,
double lim2,
978 double p1,
double p2,
979 int xyz,
int ha,
int va,
980 int& wmax,
int& hmax)
982 #if defined (HAVE_OPENGL) 984 int nticks = ticks.
numel ();
985 int nlabels = ticklabels.
numel ();
990 for (
int i = 0;
i < nticks;
i++)
992 double val = ticks(
i);
994 if (lim1 <=
val &&
val <= lim2)
999 label.erase (0, label.find_first_not_of (
' '));
1000 label = label.substr (0, label.find_last_not_of (
' ')+1);
1017 wmax =
std::max (wmax, static_cast<int> (
b(2)));
1018 hmax =
std::max (hmax, static_cast<int> (
b(3)));
1024 octave_unused_parameter (ticks);
1025 octave_unused_parameter (ticklabels);
1026 octave_unused_parameter (lim1);
1027 octave_unused_parameter (lim2);
1028 octave_unused_parameter (p1);
1029 octave_unused_parameter (p2);
1030 octave_unused_parameter (xyz);
1031 octave_unused_parameter (ha);
1032 octave_unused_parameter (va);
1033 octave_unused_parameter (wmax);
1034 octave_unused_parameter (hmax);
1047 #if defined (HAVE_OPENGL) 1049 glPixelStorei (GL_PACK_ALIGNMENT, 1);
1051 glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE,
1065 return pix.
permute (perm).index (idx);
1072 octave_unused_parameter (width);
1073 octave_unused_parameter (height);
1083 #if defined (HAVE_OPENGL) 1100 #if defined (HAVE_OPENGL) 1106 xZ1 = x_zlim(0)-(x_zlim(1)-x_zlim(0))/2;
1107 xZ2 = x_zlim(1)+(x_zlim(1)-x_zlim(0))/2;
1112 #if defined (HAVE_FRAMEWORK_OPENGL) 1118 glGetIntegerv (GL_VIEWPORT, vw);
1120 glMatrixMode (GL_MODELVIEW);
1122 glScaled (1, 1, -1);
1123 glMultMatrixd (x_mat1.
data ());
1124 glMatrixMode (GL_PROJECTION);
1126 glOrtho (0, vw[2], vw[3], 0,
xZ1,
xZ2);
1127 glMultMatrixd (x_mat2.
data ());
1128 glMatrixMode (GL_MODELVIEW);
1130 glClear (GL_DEPTH_BUFFER_BIT);
1138 octave_unused_parameter (props);
1151 #if defined (HAVE_OPENGL) 1153 Matrix axe_color = props.get_color_rgb ();
1154 if (axe_color.
isempty () || ! props.is_visible ())
1174 glVertex3d (xPlane, yPlaneN, zPlaneN);
1175 glVertex3d (xPlane, yPlane, zPlaneN);
1176 glVertex3d (xPlane, yPlane, zPlane);
1177 glVertex3d (xPlane, yPlaneN, zPlane);
1180 glVertex3d (xPlaneN, yPlane, zPlaneN);
1181 glVertex3d (xPlane, yPlane, zPlaneN);
1182 glVertex3d (xPlane, yPlane, zPlane);
1183 glVertex3d (xPlaneN, yPlane, zPlane);
1187 glVertex3d (xPlaneN, yPlaneN, zPlane);
1188 glVertex3d (xPlane, yPlaneN, zPlane);
1189 glVertex3d (xPlane, yPlane, zPlane);
1190 glVertex3d (xPlaneN, yPlane, zPlane);
1198 octave_unused_parameter (props);
1211 #if defined (HAVE_OPENGL) 1213 if (! props.is_visible ())
1220 && ! props.yscale_is (
"log");
1222 && ! props.xscale_is (
"log");
1223 bool boxFull = (props.get_boxstyle () ==
"full");
1224 double linewidth = props.get_linewidth ();
1238 bool plotyy = (props.
has_property (
"__plotyy_axes__"));
1253 if (! isXOrigin || props.is_box() || ! is2d)
1255 glVertex3d (xPlaneN, ypTick, zpTick);
1256 glVertex3d (xPlane, ypTick, zpTick);
1259 if (props.is_box ())
1261 glVertex3d (xPlaneN, ypTickN, zpTick);
1262 glVertex3d (xPlane, ypTickN, zpTick);
1265 glVertex3d (xPlaneN, ypTickN, zpTickN);
1266 glVertex3d (xPlane, ypTickN, zpTickN);
1269 glVertex3d (xPlaneN, ypTick, zpTickN);
1270 glVertex3d (xPlane, ypTick, zpTickN);
1277 if (! isYOrigin || props.is_box() || ! is2d)
1279 glVertex3d (xpTick, yPlaneN, zpTick);
1280 glVertex3d (xpTick, yPlane, zpTick);
1283 if (props.is_box () && ! plotyy)
1285 glVertex3d (xpTickN, yPlaneN, zpTick);
1286 glVertex3d (xpTickN, yPlane, zpTick);
1290 glVertex3d (xpTickN, yPlaneN, zpTickN);
1291 glVertex3d (xpTickN, yPlane, zpTickN);
1294 glVertex3d (xpTick, yPlaneN, zpTickN);
1295 glVertex3d (xpTick, yPlane, zpTickN);
1307 glVertex3d (xPlaneN, yPlane, zPlaneN);
1308 glVertex3d (xPlaneN, yPlane, zPlane);
1312 glVertex3d (xPlane, yPlaneN, zPlaneN);
1313 glVertex3d (xPlane, yPlaneN, zPlane);
1316 if (props.is_box ())
1318 glVertex3d (xPlane, yPlane, zPlaneN);
1319 glVertex3d (xPlane, yPlane, zPlane);
1323 glVertex3d (xPlane, yPlaneN, zPlaneN);
1324 glVertex3d (xPlane, yPlaneN, zPlane);
1328 glVertex3d (xPlaneN, yPlane, zPlaneN);
1329 glVertex3d (xPlaneN, yPlane, zPlane);
1334 glVertex3d (xPlaneN, yPlaneN, zPlaneN);
1335 glVertex3d (xPlaneN, yPlaneN, zPlane);
1346 octave_unused_parameter (props);
1359 #if defined (HAVE_OPENGL) 1364 && (props.is_visible ()
1365 || (
selecting && props.pickableparts_is (
"all"))))
1374 double fy = props.
get_fy ();
1375 double fz = props.
get_fz ();
1391 double linewidth = props.get_linewidth ();
1392 std::string gridstyle = props.get_gridlinestyle ();
1393 std::string minorgridstyle = props.get_minorgridlinestyle ();
1394 Matrix gridcolor = props.get_gridcolor_rgb ();
1395 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1396 double gridalpha = props.get_gridalpha ();
1397 double minorgridalpha = props.get_minorgridalpha ();
1398 bool do_xgrid = (props.is_xgrid () && (gridstyle !=
"none"));
1399 bool do_xminorgrid = (props.is_xminorgrid ()
1400 && (minorgridstyle !=
"none"));
1401 bool do_xminortick = props.is_xminortick ();
1403 && ! props.yscale_is (
"log");
1404 bool is_origin_low = is_origin && (y_min + y_max) < 0;
1407 string_vector xticklabels = props.get_xticklabel ().string_vector_value ();
1410 bool tick_along_z = nearhoriz ||
math::isinf (fy);
1411 bool mirror = props.is_box () && xstate !=
AXE_ANY_DIR;
1413 if (props.xcolormode_is (
"manual"))
1416 if (props.gridcolormode_is (
"auto"))
1417 gridcolor = props.get_xcolor_rgb ();
1418 if (props.minorgridcolormode_is (
"auto"))
1419 minorgridcolor = props.get_xcolor_rgb ();
1423 if (do_xminorgrid && ! do_xgrid)
1425 gridstyle = minorgridstyle;
1426 gridcolor = minorgridcolor;
1427 gridalpha = minorgridalpha;
1434 minorgridstyle, minorgridcolor, minorgridalpha,
1435 xmticks, x_min, x_max,
1436 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1442 gridstyle, gridcolor, gridalpha,
1443 xticks, x_min, x_max,
1444 yPlane, yPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1450 double y_axis_pos = 0.;
1456 glVertex3d (x_min, y_axis_pos, zpTick);
1457 glVertex3d (x_max, y_axis_pos, zpTick);
1466 is_origin ? y_axis_pos : ypTick, ypTick,
1467 zpTick, zpTickN, 0., 0.,
1468 (is_origin_low ? -1. : 1.) *
1470 0, ! is_origin && mirror);
1473 is_origin ? y_axis_pos : ypTick, ypTickN,
1475 (is_origin_low ? -1. : 1.) *
1477 0., 0, ! is_origin && mirror);
1483 is_origin ? y_axis_pos : ypTick, ypTick,
1484 zpTick, zpTickN, 0., 0.,
1485 (is_origin_low ? -1. : 1.) *
1487 0, ! is_origin && mirror);
1490 is_origin ? y_axis_pos : ypTick, ypTickN,
1492 (is_origin_low ? -1. : 1.) *
1494 0., 0, ! is_origin && mirror);
1497 if (xticklabels.
numel () > 0)
1501 : (xyzSym || is_origin_low ? 0 : 2));
1504 : (x2Dtop || is_origin_low ? 0 : 2));
1508 is_origin ? y_axis_pos : ypTick,
1510 (is_origin_low ? -1. : 1.) *
1512 0, halign, valign, wmax, hmax);
1515 (is_origin ? y_axis_pos : ypTick) +
1516 (is_origin_low ? -1. : 1.) *
1518 zpTick, 0, halign, valign, wmax, hmax);
1528 octave_unused_parameter (props);
1541 #if defined (HAVE_OPENGL) 1546 && (props.is_visible ()
1547 || (
selecting && props.pickableparts_is (
"all"))))
1556 double fx = props.
get_fx ();
1557 double fz = props.
get_fz ();
1573 double linewidth = props.get_linewidth ();
1574 std::string gridstyle = props.get_gridlinestyle ();
1575 std::string minorgridstyle = props.get_minorgridlinestyle ();
1576 Matrix gridcolor = props.get_gridcolor_rgb ();
1577 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1578 double gridalpha = props.get_gridalpha ();
1579 double minorgridalpha = props.get_minorgridalpha ();
1580 bool do_ygrid = (props.is_ygrid () && (gridstyle !=
"none"));
1581 bool do_yminorgrid = (props.is_yminorgrid ()
1582 && (minorgridstyle !=
"none"));
1583 bool do_yminortick = props.is_yminortick ();
1585 && ! props.xscale_is (
"log");
1586 bool is_origin_low = is_origin && (x_min + x_max) < 0;
1589 string_vector yticklabels = props.get_yticklabel ().string_vector_value ();
1592 bool tick_along_z = nearhoriz ||
math::isinf (fx);
1593 bool mirror = props.is_box () && ystate !=
AXE_ANY_DIR 1596 if (props.ycolormode_is (
"manual"))
1599 if (props.gridcolormode_is (
"auto"))
1600 gridcolor = props.get_ycolor_rgb ();
1601 if (props.minorgridcolormode_is (
"auto"))
1602 minorgridcolor = props.get_ycolor_rgb ();
1606 if (do_yminorgrid && ! do_ygrid)
1608 gridstyle = minorgridstyle;
1609 gridcolor = minorgridcolor;
1610 gridalpha = minorgridalpha;
1617 minorgridstyle, minorgridcolor, minorgridalpha,
1618 ymticks, y_min, y_max,
1619 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1625 gridstyle, gridcolor, gridalpha,
1626 yticks, y_min, y_max,
1627 xPlane, xPlaneN, layer2Dtop ? zPlaneN : zPlane, zPlaneN,
1633 double x_axis_pos = 0.;
1639 glVertex3d (x_axis_pos, y_min, zpTick);
1640 glVertex3d (x_axis_pos, y_max, zpTick);
1649 is_origin ? x_axis_pos : xpTick, xpTick,
1650 zpTick, zpTickN, 0., 0.,
1651 (is_origin_low ? -1. : 1.) *
1653 1, ! is_origin && mirror);
1656 is_origin ? x_axis_pos : xpTick, xpTickN,
1658 (is_origin_low ? -1. : 1.) *
1660 0., 0., 1, ! is_origin && mirror);
1666 is_origin ? x_axis_pos : xpTick, xpTick,
1667 zpTick, zpTickN, 0., 0.,
1668 (is_origin_low ? -1. : 1.) *
1670 1, ! is_origin && mirror);
1673 is_origin ? x_axis_pos : xpTick, xpTickN,
1675 (is_origin_low ? -1. : 1.) *
1677 0., 0., 1, ! is_origin && mirror);
1680 if (yticklabels.
numel () > 0)
1684 : (! xyzSym || y2Dright || is_origin_low ? 0 : 2));
1687 : (is_origin_low ? 0 : 2));
1691 is_origin ? x_axis_pos : xpTick,
1693 (is_origin_low ? -1. : 1.) *
1695 1, halign, valign, wmax, hmax);
1698 (is_origin ? x_axis_pos : xpTick) +
1699 (is_origin_low ? -1. : 1.) *
1701 zpTick, 1, halign, valign, wmax, hmax);
1711 octave_unused_parameter (props);
1727 && (props.is_visible ()
1728 || (
selecting && props.pickableparts_is (
"all"))))
1734 double fx = props.
get_fx ();
1735 double fy = props.
get_fy ();
1745 double linewidth = props.get_linewidth ();
1746 std::string gridstyle = props.get_gridlinestyle ();
1747 std::string minorgridstyle = props.get_minorgridlinestyle ();
1748 Matrix gridcolor = props.get_gridcolor_rgb ();
1749 Matrix minorgridcolor = props.get_minorgridcolor_rgb ();
1750 double gridalpha = props.get_gridalpha ();
1751 double minorgridalpha = props.get_minorgridalpha ();
1752 bool do_zgrid = (props.is_zgrid () && (gridstyle !=
"none"));
1753 bool do_zminorgrid = (props.is_zminorgrid ()
1754 && (minorgridstyle !=
"none"));
1755 bool do_zminortick = props.is_zminortick ();
1758 string_vector zticklabels = props.get_zticklabel ().string_vector_value ();
1761 bool mirror = props.is_box () && zstate !=
AXE_ANY_DIR;
1763 if (props.zcolormode_is (
"manual"))
1766 if (props.gridcolormode_is (
"auto"))
1767 gridcolor = props.get_zcolor_rgb ();
1768 if (props.minorgridcolormode_is (
"auto"))
1769 minorgridcolor = props.get_zcolor_rgb ();
1773 if (do_zminorgrid && ! do_zgrid)
1775 gridstyle = minorgridstyle;
1776 gridcolor = minorgridcolor;
1777 gridalpha = minorgridalpha;
1784 minorgridstyle, minorgridcolor, minorgridalpha,
1785 zmticks, z_min, z_max,
1786 xPlane, xPlaneN, yPlane, yPlaneN, 2,
true);
1791 gridstyle, gridcolor, gridalpha,
1792 zticks, z_min, z_max,
1793 xPlane, xPlaneN, yPlane, yPlaneN, 2,
true);
1817 yPlaneN, yPlane, 0.,
1846 yPlaneN, yPlane, 0.,
1857 if (zticklabels.
numel () > 0)
1860 int valign = (zstate ==
AXE_VERT_DIR ? 1 : (zSign ? 3 : 2));
1866 xPlaneN +
math::signum (xPlaneN-xPlane)*fx*ztickoffset,
1867 yPlane, 2, halign, valign, wmax, hmax);
1871 2, halign, valign, wmax, hmax);
1877 yPlaneN +
math::signum (yPlaneN-yPlane)*fy*ztickoffset,
1878 2, halign, valign, wmax, hmax);
1882 yPlaneN, 2, halign, valign, wmax, hmax);
1895 #if defined (HAVE_OPENGL) 1897 GLboolean antialias;
1899 glGetBooleanv (GL_LINE_SMOOTH, &antialias);
1901 if (antialias == GL_TRUE)
1902 glDisable (GL_LINE_SMOOTH);
1913 if (antialias == GL_TRUE)
1914 glEnable (GL_LINE_SMOOTH);
1917 octave_unused_parameter (props);
1929 std::list<graphics_object>& obj_list)
1931 #if defined (HAVE_OPENGL) 1941 || (
selecting &&
p.pickableparts_is (
"all")))
1954 "light: Maximum number of lights (%d) in these axes is " 1957 else if (go.
isa (
"hggroup")
1958 && ! (
selecting &&
p.pickableparts_is (
"none")))
1960 else if (! (
selecting &&
p.pickableparts_is (
"none")))
1961 obj_list.push_back (go);
1966 octave_unused_parameter (props);
1967 octave_unused_parameter (obj_list);
1977 #if defined (HAVE_OPENGL) 1982 static int max_lights = 0;
1985 if (max_lights == 0)
1987 for (max_lights = 0; max_lights < GL_MAX_LIGHTS; max_lights++)
1989 glDisable (GL_LIGHT0 + max_lights);
2003 #if defined (HAVE_OPENGL) 2005 std::list<graphics_object> obj_list;
2006 std::list<graphics_object>::iterator it;
2026 glDisable (GL_LIGHT0 +
i);
2030 view_vector = props.get_cameraposition ().matrix_value ();
2032 float cb[4] = { 1.0, 1.0, 1.0, 1.0 };
2033 ColumnVector ambient_color = props.get_ambientlightcolor_rgb ();
2034 for (
int i = 0;
i < 3;
i++)
2035 cb[
i] = ambient_color(
i);
2036 glLightfv (GL_LIGHT0, GL_AMBIENT, cb);
2040 it = obj_list.begin ();
2041 while (it != obj_list.end ())
2052 it = obj_list.erase (it);
2060 glDisable (GL_DEPTH_TEST);
2062 for (it = obj_list.begin (); it != obj_list.end (); it++)
2077 octave_unused_parameter (props);
2090 #if defined (HAVE_OPENGL) 2093 if (! props.is_visible () && props.get_tag () ==
"legend")
2098 if (
selecting && props.pickableparts_is (
"none"))
2110 if (x_max > floatmax || y_max > floatmax || z_max > floatmax
2111 || x_min < -floatmax || y_min < -floatmax || z_min < -floatmax)
2113 warning (
"opengl_renderer: data values greater than float capacity. (1) Scale data, or (2) Use gnuplot");
2123 glDisable (GL_DEPTH_TEST);
2125 glEnable (GL_DEPTH_TEST);
2129 if (! is2D || props.layer_is (
"bottom"))
2132 if (props.get_tag () !=
"legend" || props.get_box () !=
"off")
2136 set_clipbox (x_min, x_max, y_min, y_max, z_min, z_max);
2140 if (is2D && props.layer_is (
"top"))
2143 if (props.get_tag () !=
"legend" || props.get_box () !=
"off")
2149 octave_unused_parameter (props);
2162 #if defined (HAVE_OPENGL) 2164 bool draw_all =
selecting && props.pickableparts_is (
"all");
2170 bool has_z = (z.
numel () > 0);
2174 octave_uint8 clip_mask = (props.is_clipping () ? 0x7F : 0x40), clip_ok (0x40);
2176 std::vector<octave_uint8> clip (n);
2179 for (
int i = 0;
i < n;
i++)
2185 for (
int i = 0;
i < n;
i++)
2189 if (! props.linestyle_is (
"none") && ! props.color_is (
"none"))
2192 set_linestyle (props.get_linestyle (),
false, props.get_linewidth ());
2201 for (
int i = 1;
i < n;
i++)
2203 if ((clip[
i-1] & clip[
i]) == clip_ok)
2208 glBegin (GL_LINE_STRIP);
2209 glVertex3d (
x(
i-1),
y(
i-1), z(
i-1));
2211 glVertex3d (
x(
i),
y(
i), z(
i));
2227 for (
int i = 1;
i < n;
i++)
2229 if ((clip[
i-1] & clip[
i]) == clip_ok)
2234 glBegin (GL_LINE_STRIP);
2235 glVertex2d (
x(
i-1),
y(
i-1));
2237 glVertex2d (
x(
i),
y(
i));
2256 if (! props.marker_is (
"none")
2257 && ! (props.markeredgecolor_is (
"none")
2258 && props.markerfacecolor_is (
"none")))
2264 else if (props.markeredgecolor_is (
"auto"))
2265 lc = props.get_color_rgb ();
2266 else if (! props.markeredgecolor_is (
"none"))
2267 lc = props.get_markeredgecolor_rgb ();
2271 if (props.markerfacecolor_is (
"auto"))
2272 fc = props.get_color_rgb ();
2273 else if (! props.markerfacecolor_is (
"none"))
2274 fc = props.get_markerfacecolor_rgb ();
2276 init_marker (props.get_marker (), props.get_markersize (),
2277 props.get_linewidth ());
2279 for (
int i = 0;
i < n;
i++)
2281 if (clip[
i] == clip_ok)
2294 octave_unused_parameter (props);
2307 #if defined (HAVE_OPENGL) 2309 bool draw_all =
selecting && props.pickableparts_is (
"all");
2319 const NDArray n = props.get_vertexnormals ().array_value ();
2324 int fc_mode = (props.facecolor_is_rgb () ? 0 :
2325 (props.facecolor_is (
"flat") ? 1 :
2326 (props.facecolor_is (
"interp") ? 2 :
2327 (props.facecolor_is (
"texturemap") ? 3 : -1))));
2328 int fl_mode = (props.facelighting_is (
"none") ? 0 :
2329 (props.facelighting_is (
"flat") ? 1 : 2));
2330 int fa_mode = (props.facealpha_is_double () ? 0 :
2331 (props.facealpha_is (
"flat") ? 1 : 2));
2332 int ec_mode = (props.edgecolor_is_rgb () ? 0 :
2333 (props.edgecolor_is (
"flat") ? 1 :
2334 (props.edgecolor_is (
"interp") ? 2 : -1)));
2335 int el_mode = (props.edgelighting_is (
"none") ? 0 :
2336 (props.edgelighting_is (
"flat") ? 1 : 2));
2337 int ea_mode = (props.edgealpha_is_double () ? 0 :
2338 (props.edgealpha_is (
"flat") ? 1 : 2));
2339 int bfl_mode = (props.backfacelighting_is (
"lit") ? 0 :
2340 (props.backfacelighting_is (
"reverselit") ? 1 : 2));
2343 : props.get_facecolor_rgb ());
2344 Matrix ecolor = props.get_edgecolor_rgb ();
2347 float as = props.get_ambientstrength ();
2348 float ds = props.get_diffusestrength ();
2349 float ss = props.get_specularstrength ();
2350 float se = props.get_specularexponent () * 5;
2351 float scr = props.get_specularcolorreflectance ();
2352 float cb[4] = { 0.0, 0.0, 0.0, 1.0 };
2357 bool x_mat = (
x.rows () == z.
rows ());
2358 bool y_mat = (
y.columns () == z.
columns ());
2360 i1 = i2 = j1 = j2 = 0;
2362 if ((fc_mode > 0 && fc_mode < 3) || ec_mode > 0)
2367 for (
int i = 0;
i < zr;
i++)
2372 for (
int j = 0; j < zc; j++)
2381 if (fa_mode > 0 || ea_mode > 0)
2387 if (fl_mode > 0 || el_mode > 0)
2395 if (draw_all || ! props.facecolor_is (
"none"))
2399 fa = props.get_facealpha_double ();
2402 glColor4d (fcolor(0), fcolor(1), fcolor(2), fa);
2405 for (
int i = 0;
i < 3;
i++)
2406 cb[
i] = as * fcolor(
i);
2409 for (
int i = 0;
i < 3;
i++)
2410 cb[
i] = ds * fcolor(
i);
2413 for (
int i = 0;
i < 3;
i++)
2414 cb[
i] = ss * (scr + (1-scr) * fcolor(
i));
2420 glEnable (GL_LIGHTING);
2422 ? GL_SMOOTH : GL_FLAT);
2425 glEnable (GL_TEXTURE_2D);
2427 for (
int i = 1;
i < zc;
i++)
2435 for (
int j = 1; j < zr; j++)
2438 if (clip(j-1,
i-1) || clip(j,
i-1)
2439 || clip(j-1,
i) || clip(j,
i))
2442 if (fc_mode ==
FLAT)
2448 else if (fc_mode ==
INTERP)
2467 double (j-1) / (zr-1));
2468 else if (fc_mode > 0)
2471 for (
int k = 0;
k < 3;
k++)
2472 cb[
k] =
c(j-1,
i-1,
k);
2478 for (
int k = 0;
k < 3;
k++)
2482 for (
int k = 0;
k < 3;
k++)
2483 cb[
k] = ds *
c(j-1,
i-1,
k);
2486 for (
int k = 0;
k < 3;
k++)
2487 cb[
k] = ss * (scr + (1-scr) *
c(j-1,
i-1,
k));
2494 glVertex3d (
x(j1,
i-1),
y(j-1,i1), z(j-1,
i-1));
2498 tex.
tex_coord (
double (
i) / (zc-1),
double (j-1) / (zr-1));
2499 else if (fc_mode ==
INTERP)
2501 for (
int k = 0;
k < 3;
k++)
2502 cb[
k] =
c(j-1,
i,
k);
2508 for (
int k = 0;
k < 3;
k++)
2512 for (
int k = 0;
k < 3;
k++)
2513 cb[
k] = ds *
c(j-1,
i,
k);
2516 for (
int k = 0;
k < 3;
k++)
2517 cb[
k] = ss * (scr + (1-scr) *
c(j-1,
i,
k));
2525 glVertex3d (
x(j1,
i),
y(j-1,i2), z(j-1,
i));
2529 tex.
tex_coord (
double (
i) / (zc-1),
double (j) / (zr-1));
2530 else if (fc_mode ==
INTERP)
2532 for (
int k = 0;
k < 3;
k++)
2539 for (
int k = 0;
k < 3;
k++)
2543 for (
int k = 0;
k < 3;
k++)
2544 cb[
k] = ds *
c(j,
i,
k);
2547 for (
int k = 0;
k < 3;
k++)
2548 cb[
k] = ss * (scr + (1-scr) *
c(j,
i,
k));
2555 glVertex3d (
x(j2,
i),
y(j,i2), z(j,
i));
2559 tex.
tex_coord (
double (
i-1) / (zc-1),
double (j) / (zr-1));
2560 else if (fc_mode ==
INTERP)
2562 for (
int k = 0;
k < 3;
k++)
2563 cb[
k] =
c(j,
i-1,
k);
2569 for (
int k = 0;
k < 3;
k++)
2573 for (
int k = 0;
k < 3;
k++)
2574 cb[
k] = ds *
c(j,
i-1,
k);
2577 for (
int k = 0;
k < 3;
k++)
2578 cb[
k] = ss * (scr + (1-scr) *
c(j,
i-1,
k));
2585 glVertex3d (
x(j2,
i-1),
y(j,i1), z(j,
i-1));
2593 glDisable (GL_TEXTURE_2D);
2596 glDisable (GL_LIGHTING);
2604 if (! props.edgecolor_is (
"none") && ! props.linestyle_is (
"none"))
2606 if (props.get_edgealpha_double () == 1)
2610 glColor3dv (ecolor.
data ());
2613 for (
int i = 0;
i < 3;
i++)
2614 cb[
i] = as * ecolor(
i);
2617 for (
int i = 0;
i < 3;
i++)
2618 cb[
i] = ds * ecolor(
i);
2621 for (
int i = 0;
i < 3;
i++)
2622 cb[
i] = ss * (scr + (1-scr) * ecolor(
i));
2628 glEnable (GL_LIGHTING);
2630 ? GL_SMOOTH : GL_FLAT);
2633 props.get_linewidth ());
2640 if (props.meshstyle_is (
"both") || props.meshstyle_is (
"column"))
2642 for (
int i = 0;
i < zc;
i++)
2650 for (
int j = 1; j < zr; j++)
2652 if (clip(j-1,
i) || clip(j,
i))
2655 if (ec_mode ==
FLAT)
2661 else if (ec_mode ==
INTERP)
2679 for (
int k = 0;
k < 3;
k++)
2680 cb[
k] =
c(j-1,
i,
k);
2685 for (
int k = 0;
k < 3;
k++)
2689 for (
int k = 0;
k < 3;
k++)
2690 cb[
k] = ds *
c(j-1,
i,
k);
2693 for (
int k = 0;
k < 3;
k++)
2694 cb[
k] = ss * (scr + (1-scr) *
c(j-1,
i,
k));
2701 glVertex3d (
x(j1,
i),
y(j-1,i2), z(j-1,
i));
2706 for (
int k = 0;
k < 3;
k++)
2712 for (
int k = 0;
k < 3;
k++)
2716 for (
int k = 0;
k < 3;
k++)
2717 cb[
k] = ds *
c(j,
i,
k);
2720 for (
int k = 0;
k < 3;
k++)
2721 cb[
k] = ss * (scr + (1-scr) *
c(j,
i,
k));
2728 glVertex3d (
x(j2,
i),
y(j,i2), z(j,
i));
2737 if (props.meshstyle_is (
"both") || props.meshstyle_is (
"row"))
2739 for (
int j = 0; j < zr; j++)
2747 for (
int i = 1;
i < zc;
i++)
2749 if (clip(j,
i-1) || clip(j,
i))
2752 if (ec_mode ==
FLAT)
2758 else if (ec_mode ==
INTERP)
2776 for (
int k = 0;
k < 3;
k++)
2777 cb[
k] =
c(j,
i-1,
k);
2782 for (
int k = 0;
k < 3;
k++)
2786 for (
int k = 0;
k < 3;
k++)
2787 cb[
k] = ds *
c(j,
i-1,
k);
2790 for (
int k = 0;
k < 3;
k++)
2791 cb[
k] = ss * (scr + (1-scr) *
c(j,
i-1,
k));
2798 glVertex3d (
x(j2,
i-1),
y(j,i1), z(j,
i-1));
2803 for (
int k = 0;
k < 3;
k++)
2809 for (
int k = 0;
k < 3;
k++)
2813 for (
int k = 0;
k < 3;
k++)
2814 cb[
k] = ds *
c(j,
i,
k);
2817 for (
int k = 0;
k < 3;
k++)
2818 cb[
k] = ss * (scr + (1-scr) *
c(j,
i,
k));
2825 glVertex3d (
x(j2,
i),
y(j,i2), z(j,
i));
2836 glDisable (GL_LIGHTING);
2844 if (! props.marker_is (
"none")
2845 && ! (props.markeredgecolor_is (
"none")
2846 && props.markerfacecolor_is (
"none")))
2852 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
2853 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
2856 props.get_markeredgecolor_rgb ());
2858 props.get_markerfacecolor_rgb ());
2861 if (mecolor.
isempty () && props.markeredgecolor_is (
"auto"))
2863 mecolor = props.get_edgecolor_rgb ();
2864 do_edge = ! props.edgecolor_is (
"none");
2867 if (mfcolor.
isempty () && props.markerfacecolor_is (
"auto"))
2869 mfcolor = props.get_facecolor_rgb ();
2870 do_face = ! props.facecolor_is (
"none");
2876 init_marker (props.get_marker (), props.get_markersize (),
2877 props.get_linewidth ());
2879 for (
int i = 0;
i < zc;
i++)
2884 for (
int j = 0; j < zr; j++)
2892 if ((do_edge && mecolor.
isempty ())
2893 || (do_face && mfcolor.
isempty ()))
2898 for (
int k = 0;
k < 3;
k++)
2916 octave_unused_parameter (props);
2931 #if defined (HAVE_OPENGL) 2937 warning (
"opengl_renderer: %s. Not rendering.", msg.c_str ());
2941 bool draw_all =
selecting && props.pickableparts_is (
"all");
2942 const Matrix f = props.get_faces ().matrix_value ();
2945 const Matrix n = props.get_vertexnormals ().matrix_value ();
2951 int fcmax =
f.columns ();
2953 bool has_z = (v.
columns () > 2);
2954 bool has_facecolor =
false;
2955 bool has_facealpha =
false;
2957 bool has_normals = (n.
rows () == nv);
2959 int fc_mode = ((props.facecolor_is (
"none")
2960 || props.facecolor_is_rgb () || draw_all) ? 0 :
2961 (props.facecolor_is (
"flat") ? 1 : 2));
2962 int fl_mode = (props.facelighting_is (
"none") ? 0 :
2963 (props.facelighting_is (
"flat") ? 1 : 2));
2964 int fa_mode = (props.facealpha_is_double () ? 0 :
2965 (props.facealpha_is (
"flat") ? 1 : 2));
2966 int ec_mode = ((props.edgecolor_is (
"none")
2967 || props.edgecolor_is_rgb ()) ? 0 :
2968 (props.edgecolor_is (
"flat") ? 1 : 2));
2969 int el_mode = (props.edgelighting_is (
"none") ? 0 :
2970 (props.edgelighting_is (
"flat") ? 1 : 2));
2971 int ea_mode = (props.edgealpha_is_double () ? 0 :
2972 (props.edgealpha_is (
"flat") ? 1 : 2));
2973 int bfl_mode = (props.backfacelighting_is (
"lit") ? 0 :
2974 (props.backfacelighting_is (
"reverselit") ? 1 : 2));
2976 Matrix fcolor = props.get_facecolor_rgb ();
2977 Matrix ecolor = props.get_edgecolor_rgb ();
2979 float as = props.get_ambientstrength ();
2980 float ds = props.get_diffusestrength ();
2981 float ss = props.get_specularstrength ();
2982 float se = props.get_specularexponent () * 5;
2983 float scr = props.get_specularcolorreflectance ();
2988 for (
int i = 0;
i < nv;
i++)
2991 for (
int i = 0;
i < nv;
i++)
2997 for (
int i = 0;
i < nf;
i++)
3002 for (
int j = 0; j < fcmax && !
math::isnan (
f(
i,j)); j++, count++)
3003 fclip = (fclip || clip(
int (
f(
i,j) - 1)));
3009 if (draw_all || fc_mode > 0 || ec_mode > 0)
3020 if (draw_all || fc_mode > 0)
3026 if (draw_all || ec_mode > 0)
3035 has_facecolor = ((
c.numel () > 0) && (
c.rows () ==
f.rows ()));
3038 if (fa_mode > 0 || ea_mode > 0)
3042 has_facealpha = ((
a.numel () > 0) && (
a.rows () ==
f.rows ()));
3046 fa = props.get_facealpha_double ();
3049 std::vector<vertex_data> vdata (
f.numel ());
3051 for (
int i = 0;
i < nf;
i++)
3052 for (
int j = 0; j < count_f(
i); j++)
3054 int idx = int (
f(
i,j) - 1);
3061 vv(0) = v(idx,0); vv(1) = v(idx,1);
3071 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
3072 nn(0) = dir * n(idx,0);
3073 nn(1) = dir * n(idx,1);
3074 nn(2) = dir * n(idx,2);
3080 cc(0) =
c(
i,0), cc(1) =
c(
i,1), cc(2) =
c(
i,2);
3082 cc(0) =
c(idx,0), cc(1) =
c(idx,1), cc(2) =
c(idx,2);
3086 else if (
a.numel () > 0)
3094 vdata[
i+j*fr] =
vertex_data (vv, cc,
nn, aa, as, ds, ss, se, scr);
3097 if (fl_mode > 0 || el_mode > 0)
3100 if (draw_all || ! props.facecolor_is (
"none"))
3107 glColor4d (fcolor(0), fcolor(1), fcolor(2), fa);
3110 float cb[4] = { 0, 0, 0, 1 };
3112 for (
int i = 0;
i < 3;
i++)
3113 cb[
i] = as * fcolor(
i);
3116 for (
int i = 0;
i < 3;
i++)
3117 cb[
i] = ds * fcolor(
i);
3120 for (
int i = 0;
i < 3;
i++)
3121 cb[
i] = ss * (scr + (1-scr) * fcolor(
i));
3126 if ((fl_mode > 0) && (
num_lights > 0) && has_normals)
3127 glEnable (GL_LIGHTING);
3135 for (
int i = 0;
i < nf;
i++)
3144 for (
int j = count_f(
i)-1; j > 0; j--)
3155 if (fc_mode ==
FLAT)
3160 if (col.
numel () == 3)
3162 glColor4d (col(0), col(1), col(2), fa);
3165 float cb[4] = { 0, 0, 0, 1 };
3167 for (
int k = 0;
k < 3;
k++)
3171 for (
int k = 0;
k < 3;
k++)
3175 for (
int k = 0;
k < 3;
k++)
3190 if ((fl_mode > 0) && (
num_lights > 0) && has_normals)
3191 glDisable (GL_LIGHTING);
3200 || (! props.edgecolor_is (
"none") && ! props.linestyle_is (
"none")))
3203 if (props.get_edgealpha_double () == 1)
3207 glColor3dv (ecolor.
data ());
3210 float cb[4] = { 0, 0, 0, 1 };
3212 for (
int i = 0;
i < 3;
i++)
3213 cb[
i] = (as * ecolor(
i));
3216 for (
int i = 0;
i < 3;
i++)
3217 cb[
i] = ds * ecolor(
i);
3220 for (
int i = 0;
i < 3;
i++)
3221 cb[
i] = ss * (scr + (1-scr) * ecolor(
i));
3226 if ((el_mode > 0) && (
num_lights > 0) && has_normals)
3227 glEnable (GL_LIGHTING);
3229 double linewidth = props.get_linewidth ();
3242 for (
int i = 0;
i < nf;
i++)
3250 ? GL_SMOOTH : GL_FLAT);
3253 for (
int j = count_f(
i)-1; j >= 0; j--)
3255 if (! clip(
int (
f(
i,j) - 1)))
3258 = vdata[
i+j*fr].get_rep ();
3263 glBegin (GL_LINE_STRIP);
3269 if (col.
numel () == 3)
3270 glColor3dv (col.
data ());
3272 glVertex3d (m(0), m(1), m(2));
3282 int j = count_f(
i)-1;
3283 if (flag && ! clip(
int (
f(
i,j) - 1)))
3286 = vdata[
i+j*fr].get_rep ();
3292 if (col.
numel () == 3)
3293 glColor3dv (col.
data ());
3295 glVertex3d (m(0), m(1), m(2));
3306 for (
int j = count_f(
i)-1; j >= 0; j--)
3309 = vdata[
i+j*fr].get_rep ();
3321 if ((el_mode > 0) && (
num_lights > 0) && has_normals)
3322 glDisable (GL_LIGHTING);
3330 if (! props.marker_is (
"none")
3331 && ! (props.markeredgecolor_is (
"none")
3332 && props.markerfacecolor_is (
"none")))
3334 bool do_edge = draw_all || ! props.markeredgecolor_is (
"none");
3335 bool do_face = draw_all || ! props.markerfacecolor_is (
"none");
3338 props.get_markeredgecolor_rgb ());
3340 props.get_markerfacecolor_rgb ());
3342 bool has_markerfacecolor = draw_all ||
false;
3344 if ((mecolor.
isempty () && ! props.markeredgecolor_is (
"none"))
3345 || (mfcolor.
isempty () && ! props.markerfacecolor_is (
"none")))
3349 if (mc.
rows () == 1)
3352 if (mfcolor.
isempty () && ! props.markerfacecolor_is (
"none"))
3355 if (mecolor.
isempty () && ! props.markeredgecolor_is (
"none"))
3362 has_markerfacecolor = ((
c.numel () > 0)
3363 && (
c.rows () ==
f.rows ()));
3367 init_marker (props.get_marker (), props.get_markersize (),
3368 props.get_linewidth ());
3370 for (
int i = 0;
i < nf;
i++)
3371 for (
int j = 0; j < count_f(
i); j++)
3373 int idx = int (
f(
i,j) - 1);
3382 if (has_markerfacecolor)
3383 cc(0) =
c(
i,0), cc(1) =
c(
i,1), cc(2) =
c(
i,2);
3385 cc(0) =
c(idx,0), cc(1) =
c(idx,1), cc(2) =
c(idx,2);
3393 draw_marker (v(idx,0), v(idx,1), (has_z ? v(idx,2) : 0), lc, fc);
3401 octave_unused_parameter (props);
3414 #if defined (HAVE_OPENGL) 3420 float pos[4] = { 0, 0, 0, 0 };
3421 Matrix lpos = props.get_position ().matrix_value ();
3422 for (
int i = 0;
i < 3;
i++)
3424 if (props.style_is (
"local"))
3429 float col[4] = { 1, 1, 1, 1 };
3430 Matrix lcolor = props.get_color ().matrix_value ();
3431 for (
int i = 0;
i < 3;
i++)
3438 octave_unused_parameter (props);
3457 #if defined (HAVE_OPENGL) 3459 if (props.get_string ().isempty ())
3465 if (! props.is_clipping () ||
3476 const Matrix bbox = props.get_extent_matrix ();
3478 bool blend = glIsEnabled (GL_BLEND);
3480 glEnable (GL_BLEND);
3481 glEnable (GL_ALPHA_TEST);
3482 glRasterPos3d (pos(0), pos(1), pos.
numel () > 2 ? pos(2) : 0.0);
3483 glBitmap (0, 0, 0, 0, bbox(0), bbox(1),
nullptr);
3484 glDrawPixels (bbox(2), bbox(3),
3485 GL_RGBA, GL_UNSIGNED_BYTE, props.get_pixels ().data ());
3486 glDisable (GL_ALPHA_TEST);
3488 glDisable (GL_BLEND);
3492 octave_unused_parameter (props);
3506 #if defined (HAVE_OPENGL) 3508 Matrix bgcol = props.get_backgroundcolor_rgb ();
3509 Matrix ecol = props.get_edgecolor_rgb ();
3517 const Matrix bbox = props.get_extent_matrix ();
3519 # if defined (HAVE_FRAMEWORK_OPENGL) 3525 glGetIntegerv (GL_VIEWPORT, vp);
3528 glMatrixMode (GL_PROJECTION);
3531 glOrtho (0, vp[2], vp[3], 0,
xZ1,
xZ2);
3532 glMatrixMode (GL_MODELVIEW);
3537 glTranslated (pixpos(0), pixpos(1), -pixpos(2));
3541 double rotation = props.get_rotation ();
3543 if (do_rotate && rotation != 0.0 && rotation != 90.0
3544 && rotation != 180.0 && rotation != 270.0)
3545 glRotated (-rotation, 0.0, 0.0, 1.0);
3547 double m = props.get_margin ();
3548 double x0 = bbox (0) - m;
3549 double x1 = x0 + bbox(2) + 2 * m;
3550 double y0 = -(bbox (1) - m);
3551 double y1 = y0 - (bbox(3) + 2 * m);
3555 glColor3f (bgcol(0), bgcol(1), bgcol(2));
3557 bool depth_test = glIsEnabled (GL_DEPTH_TEST);
3562 glVertex2d (x0, y0);
3563 glVertex2d (x1, y0);
3564 glVertex2d (x1, y1);
3565 glVertex2d (x0, y1);
3574 glColor3f (ecol(0), ecol(1), ecol(2));
3576 set_linestyle (props.get_linestyle (),
false, props.get_linewidth ());
3579 glBegin (GL_LINE_STRIP);
3580 glVertex2d (x0, y0);
3581 glVertex2d (x1, y0);
3582 glVertex2d (x1, y1);
3583 glVertex2d (x0, y1);
3584 glVertex2d (x0, y0);
3592 glMatrixMode (GL_PROJECTION);
3597 octave_unused_parameter (props);
3598 octave_unused_parameter (do_rotate);
3611 #if defined (HAVE_OPENGL) 3618 Matrix x = props.get_xdata ().matrix_value ();
3619 Matrix y = props.get_ydata ().matrix_value ();
3622 if (
x.isempty () ||
y.isempty ())
3625 if (
w > 1 &&
x(1) ==
x(0))
3626 x(1) =
x(1) + (
w-1);
3628 if (
h > 1 &&
y(1) ==
y(0))
3629 y(1) =
y(1) + (
h-1);
3637 warning (
"opengl_renderer: image X,Y data too large to draw");
3642 float pix_dx, pix_dy;
3644 float nor_dx, nor_dy;
3648 pix_dx = (p1(0) - p0(0)) / (
w-1);
3649 nor_dx = (
x(1) -
x(0)) / (
w-1);
3654 pix_dx = p1w(0) - p0(0);
3660 pix_dy = (p1(1) - p0(1)) / (
h-1);
3661 nor_dy = (
y(1) -
y(0)) / (
h-1);
3666 pix_dy = p1h(1) - p0(1);
3677 float im_xmin =
x(0) - nor_dx/2;
3678 float im_xmax =
x(1) + nor_dx/2;
3679 float im_ymin =
y(0) - nor_dy/2;
3680 float im_ymax =
y(1) + nor_dy/2;
3681 if (props.is_clipping ())
3684 j0 += (
xmin - im_xmin)/nor_dx + 1;
3686 j1 -= (im_xmax -
xmax)/nor_dx;
3689 i0 += (
ymin - im_ymin)/nor_dy + 1;
3691 i1 -= (im_ymax -
ymax)/nor_dy;
3696 glGetFloatv (GL_VIEWPORT, vp);
3700 if (i0 >= i1 || j0 >= j1)
3703 glPixelZoom (pix_dx, -pix_dy);
3704 glRasterPos3d (im_xmin + nor_dx*j0, im_ymin + nor_dy*i0, 0);
3707 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
3718 for (
int i = i0;
i < i1;
i++)
3720 for (
int j = j0, idx = (
i-i0)*(j1-j0)*3; j < j1; j++, idx += 3)
3722 a[idx] = xcdata(
i,j,0);
3723 a[idx+1] = xcdata(
i,j,1);
3724 a[idx+2] = xcdata(
i,j,2);
3737 for (
int i = i0;
i < i1;
i++)
3739 for (
int j = j0, idx = (
i-i0)*(j1-j0)*3; j < j1; j++, idx += 3)
3741 a[idx] = xcdata(
i,j,0);
3742 a[idx+1] = xcdata(
i,j,1);
3743 a[idx+2] = xcdata(
i,j,2);
3756 for (
int i = i0;
i < i1;
i++)
3758 for (
int j = j0, idx = (
i-i0)*(j1-j0)*3; j < j1; j++, idx += 3)
3760 a[idx] = xcdata(
i,j,0);
3761 a[idx+1] = xcdata(
i,j,1);
3762 a[idx+2] = xcdata(
i,j,2);
3775 for (
int i = i0;
i < i1;
i++)
3777 for (
int j = j0, idx = (
i-i0)*(j1-j0)*3; j < j1; j++, idx += 3)
3779 a[idx] = xcdata(
i,j,0);
3780 a[idx+1] = xcdata(
i,j,1);
3781 a[idx+2] = xcdata(
i,j,2);
3789 warning (
"opengl_renderer: invalid image data type (expected double, single, uint8, or uint16)");
3792 warning (
"opengl_renderer: invalid image size (expected MxNx3 or MxN)");
3798 octave_unused_parameter (props);
3811 #if defined (HAVE_OPENGL) 3813 glViewport (0, 0,
w,
h);
3817 octave_unused_parameter (
w);
3818 octave_unused_parameter (
h);
3831 #if defined (HAVE_OPENGL) 3833 glDrawPixels (width, height, GL_RGB, GL_FLOAT, data);
3837 octave_unused_parameter (width);
3838 octave_unused_parameter (height);
3839 octave_unused_parameter (data);
3852 #if defined (HAVE_OPENGL) 3854 glDrawPixels (width, height, GL_RGB, GL_UNSIGNED_BYTE, data);
3858 octave_unused_parameter (width);
3859 octave_unused_parameter (height);
3860 octave_unused_parameter (data);
3873 #if defined (HAVE_OPENGL) 3875 glDrawPixels (width, height, GL_RGB, GL_UNSIGNED_SHORT, data);
3879 octave_unused_parameter (width);
3880 octave_unused_parameter (height);
3881 octave_unused_parameter (data);
3894 #if defined (HAVE_OPENGL) 3896 glColor3dv (
c.data ());
3902 octave_unused_parameter (
c);
3924 #if defined (HAVE_OPENGL) 3928 glEnable (GL_POLYGON_OFFSET_FILL);
3929 glEnable (GL_POLYGON_OFFSET_LINE);
3930 glPolygonOffset (offset, offset);
3934 glDisable (GL_POLYGON_OFFSET_FILL);
3935 glDisable (GL_POLYGON_OFFSET_LINE);
3940 octave_unused_parameter (
on);
3941 octave_unused_parameter (offset);
3954 #if defined (HAVE_OPENGL) 3960 octave_unused_parameter (
w);
3974 #if defined (HAVE_OPENGL) 3980 glLineStipple (1, static_cast<unsigned short> (0xFFFF));
3984 glLineStipple (linewidth, static_cast<unsigned short> (0x5555));
3986 glLineStipple (linewidth, static_cast<unsigned short> (0x0F0F));
3988 glLineStipple (linewidth, static_cast<unsigned short> (0x6F6F));
3990 glLineStipple (1, static_cast<unsigned short> (0x0000));
3992 if (solid && ! use_stipple)
3993 glDisable (GL_LINE_STIPPLE);
3995 glEnable (GL_LINE_STIPPLE);
3999 octave_unused_parameter (
s);
4000 octave_unused_parameter (use_stipple);
4001 octave_unused_parameter (linewidth);
4013 double z1,
double z2)
4015 #if defined (HAVE_OPENGL) 4017 double dx = (x2-x1);
4018 double dy = (y2-y1);
4019 double dz = (z2-z1);
4021 x1 -= 0.001*dx; x2 += 0.001*dx;
4022 y1 -= 0.001*dy; y2 += 0.001*dy;
4023 z1 -= 0.001*dz; z2 += 0.001*dz;
4027 p(0) = -1;
p(3) = x2;
4028 glClipPlane (GL_CLIP_PLANE0,
p.data ());
4029 p(0) = 1;
p(3) = -x1;
4030 glClipPlane (GL_CLIP_PLANE1,
p.data ());
4031 p(0) = 0;
p(1) = -1;
p(3) = y2;
4032 glClipPlane (GL_CLIP_PLANE2,
p.data ());
4033 p(1) = 1;
p(3) = -y1;
4034 glClipPlane (GL_CLIP_PLANE3,
p.data ());
4035 p(1) = 0;
p(2) = -1;
p(3) = z2;
4036 glClipPlane (GL_CLIP_PLANE4,
p.data ());
4037 p(2) = 1;
p(3) = -z1;
4038 glClipPlane (GL_CLIP_PLANE5,
p.data ());
4046 octave_unused_parameter (x1);
4047 octave_unused_parameter (x2);
4048 octave_unused_parameter (y1);
4049 octave_unused_parameter (y2);
4050 octave_unused_parameter (z1);
4051 octave_unused_parameter (z2);
4064 #if defined (HAVE_OPENGL) 4066 bool has_clipping = (glIsEnabled (GL_CLIP_PLANE0) == GL_TRUE);
4068 if (enable != has_clipping)
4071 for (
int i = 0;
i < 6;
i++)
4072 glEnable (GL_CLIP_PLANE0+
i);
4074 for (
int i = 0;
i < 6;
i++)
4075 glDisable (GL_CLIP_PLANE0+
i);
4080 octave_unused_parameter (enable);
4093 #if defined (HAVE_OPENGL) 4095 # if defined (HAVE_FRAMEWORK_OPENGL) 4101 glGetIntegerv (GL_VIEWPORT, vw);
4103 glMatrixMode (GL_PROJECTION);
4106 glOrtho (0, vw[2], vw[3], 0,
xZ1,
xZ2);
4107 glMatrixMode (GL_MODELVIEW);
4118 octave_unused_parameter (m);
4119 octave_unused_parameter (size);
4120 octave_unused_parameter (width);
4133 #if defined (HAVE_OPENGL) 4138 glMatrixMode (GL_MODELVIEW);
4140 glMatrixMode (GL_PROJECTION);
4158 #if defined (HAVE_OPENGL) 4167 glColor3dv (fc.
data ());
4170 if (lc.
numel () > 0)
4172 glColor3dv (lc.
data ());
4173 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
4174 glEdgeFlag (GL_TRUE);
4177 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
4183 glColor3dv (lc.
data ());
4189 octave_unused_parameter (
x);
4190 octave_unused_parameter (
y);
4191 octave_unused_parameter (z);
4192 octave_unused_parameter (lc);
4193 octave_unused_parameter (fc);
4206 #if defined (HAVE_OPENGL) 4208 double x = n(j,
i,0);
4209 double y = n(j,
i,1);
4210 double z = n(j,
i,2);
4212 double d = sqrt (
x*
x +
y*
y + z*z);
4218 ? ((bfl_mode > 1) ? 0.0 : -1.0) : 1.0);
4220 glNormal3d (dir*
x/
d, dir*
y/
d, dir*z/
d);
4224 octave_unused_parameter (bfl_mode);
4225 octave_unused_parameter (n);
4226 octave_unused_parameter (j);
4227 octave_unused_parameter (
i);
4241 #if defined (HAVE_OPENGL) 4245 if (filled && (
c ==
'+' ||
c ==
'x' ||
c ==
'*' ||
c ==
'.'))
4248 unsigned int ID = glGenLists (1);
4252 const double sqrt2d4 = 0.35355339059327;
4253 double tt =
sz*sqrt2d4;
4255 glNewList (ID, GL_COMPILE);
4261 glVertex2d (-
sz/2, 0);
4262 glVertex2d (
sz/2, 0);
4263 glVertex2d (0, -
sz/2);
4264 glVertex2d (0,
sz/2);
4269 glVertex2d (-
sz/2, -
sz/2);
4270 glVertex2d (
sz/2,
sz/2);
4271 glVertex2d (-
sz/2,
sz/2);
4272 glVertex2d (
sz/2, -
sz/2);
4277 glVertex2d (-
sz/2, 0);
4278 glVertex2d (
sz/2, 0);
4279 glVertex2d (0, -
sz/2);
4280 glVertex2d (0,
sz/2);
4281 glVertex2d (-tt, -tt);
4282 glVertex2d (+tt, +tt);
4283 glVertex2d (-tt, +tt);
4284 glVertex2d (+tt, -tt);
4292 if (
sz > 0 &&
sz < 3)
4295 int div = static_cast <
int> (M_PI *
sz / 12);
4299 double ang_step = M_PI / div;
4301 glBegin (GL_POLYGON);
4302 for (
double ang = 0; ang < 2*M_PI; ang += ang_step)
4303 glVertex2d (
sz/6*cos (ang),
sz/6*sin (ang));
4308 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
4309 glVertex2d (-
sz/2, -
sz/2);
4310 glVertex2d (-
sz/2,
sz/2);
4311 glVertex2d (
sz/2,
sz/2);
4312 glVertex2d (
sz/2, -
sz/2);
4317 int div = static_cast <
int> (M_PI *
sz / 4);
4321 double ang_step = M_PI / div;
4323 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
4324 for (
double ang = 0; ang < 2*M_PI; ang += ang_step)
4325 glVertex2d (
sz/2*cos (ang),
sz/2*sin (ang));
4330 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
4331 glVertex2d (0, -
sz/2);
4332 glVertex2d (
sz/2, 0);
4333 glVertex2d (0,
sz/2);
4334 glVertex2d (-
sz/2, 0);
4338 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
4339 glVertex2d (0,
sz/2);
4340 glVertex2d (
sz/2, -
sz/2);
4341 glVertex2d (-
sz/2, -
sz/2);
4345 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
4346 glVertex2d (0, -
sz/2);
4347 glVertex2d (-
sz/2,
sz/2);
4348 glVertex2d (
sz/2,
sz/2);
4352 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
4353 glVertex2d (
sz/2, 0);
4354 glVertex2d (-
sz/2,
sz/2);
4355 glVertex2d (-
sz/2, -
sz/2);
4359 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
4360 glVertex2d (-
sz/2, 0);
4361 glVertex2d (
sz/2, -
sz/2);
4362 glVertex2d (
sz/2,
sz/2);
4368 dr = 1.0 - sin (M_PI/10)/sin (3*M_PI/10)*1.02;
4370 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
4371 for (
int i = 0;
i < 2*5;
i++)
4373 ang = (-0.5 +
double (
i+1) / 5) * M_PI;
4374 r = 1.0 - (dr * fmod (
double (
i+1), 2.0));
4375 glVertex2d (
sz/2*r*cos (ang),
sz/2*r*sin (ang));
4383 dr = 1.0 - 0.5/sin (M_PI/3)*1.02;
4385 glBegin (filled ? GL_POLYGON : GL_LINE_LOOP);
4386 for (
int i = 0;
i < 2*6;
i++)
4388 ang = (0.5 +
double (
i+1) / 6.0) * M_PI;
4389 r = 1.0 - (dr * fmod (
double (
i+1), 2.0));
4390 glVertex2d (
sz/2*r*cos (ang),
sz/2*r*sin (ang));
4396 warning (
"opengl_renderer: unsupported marker '%s'",
marker.c_str ());
4406 octave_unused_parameter (
marker);
4407 octave_unused_parameter (size);
4408 octave_unused_parameter (filled);
4422 int halign,
int valign,
double rotation)
4430 std::list<text_renderer::string>& lst,
4432 int halign,
int valign,
double rotation)
4440 double x,
double y,
double z,
4441 int halign,
int valign,
double rotation)
4443 #if defined (HAVE_OPENGL) 4455 bool blend = glIsEnabled (GL_BLEND);
4457 glEnable (GL_BLEND);
4458 glEnable (GL_ALPHA_TEST);
4459 glRasterPos3d (
x,
y, z);
4460 glBitmap(0, 0, 0, 0, bbox(0), bbox(1),
nullptr);
4461 glDrawPixels (bbox(2), bbox(3),
4462 GL_RGBA, GL_UNSIGNED_BYTE, pixels.
data ());
4463 glDisable (GL_ALPHA_TEST);
4466 glDisable (GL_BLEND);
4473 octave_unused_parameter (txt);
4474 octave_unused_parameter (
x);
4475 octave_unused_parameter (
y);
4476 octave_unused_parameter (z);
4477 octave_unused_parameter (halign);
4478 octave_unused_parameter (valign);
4479 octave_unused_parameter (rotation);
virtual void draw_pixels(int w, int h, const float *data)
xscale xaxislocation_is("origin")
virtual std::string graphics_object_name(void) const
octave_idx_type rows(void) const
void warning_with_id(const char *id, const char *fmt,...)
void bind(int mode) const
float specular_color_refl
vertex_data(const Matrix &c, const Matrix &col, const Matrix &n, double a, float as, float ds, float ss, float se, float scr)
double get_fz(void) const
opengl_renderer * renderer
virtual void init_marker(const std::string &m, double size, float width)
std::string string_value(bool force=false) const
void combine(GLdouble xyz[3], void *data[4], GLfloat w[4], void **out_data)
virtual void draw_text(const text::properties &props)
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
octave_int< T > xmax(const octave_int< T > &x, const octave_int< T > &y)
vertex_data(const vertex_data &v)
const T * data(void) const
texture_rep(GLuint id_arg, int w_arg, int h_arg, int tw_arg, int th_arg)
void draw_axes_children(const axes::properties &props)
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)
static const idx_vector colon
virtual void set_polygon_offset(bool on, float offset=0.0f)
opengl_texture(const opengl_texture &tx)
identity matrix If supplied two scalar respectively For allows like xample val
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
octave_value get_color_data(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)
static void tess_error(GLenum err, void *t)
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
virtual void draw_uibuttongroup(const uibuttongroup::properties &props, const graphics_object &go)
std::list< vertex_data > tmp_vdata
virtual void draw(const graphics_object &go, bool toplevel=true)
static void tess_end(void *t)
void draw_axes_z_grid(const axes::properties &props)
double get_yPlane(void) const
void draw_all_lights(const base_properties &props, std::list< graphics_object > &obj_list)
const T * fortran_vec(void) const
double get_xPlaneN(void) const
void begin_contour(void) const
bool get_xyzSym(void) const
void error(const char *fmt,...)
double get_ypTick(void) const
virtual void draw_image(const image::properties &props)
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
virtual void error(GLenum err)
double get_yticklen(void) const
virtual void init_gl_context(bool enhanced, const Matrix &backgroundColor)
vertex_data(vertex_data_rep *new_rep)
xscale yscale is("log") ? 2 yscale yaxislocation_is("origin")
static int next_power_of_2(int n)
graphics_xform get_transform(void) const
bool get_nearhoriz(void) const
virtual void setup_opengl_transformation(const axes::properties &props)
octave_idx_type columns(void) const
void draw_axes_grids(const axes::properties &props)
virtual void render_grid(const double linewidth, const std::string &gridstyle, const Matrix &gridcolor, const double gridalpha, const Matrix &ticks, double lim1, double lim2, double p1, double p1N, double p2, double p2N, int xyz, bool is_3D)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
double get_z_min(void) const
FloatNDArray float_array_value(bool frc_str_conv=false) const
Matrix get_children(void) const
static void tess_begin(GLenum type, void *t)
double get_fx(void) const
virtual Matrix render_text(const std::string &txt, double x, double y, double z, int halign, int valign, double rotation=0.0)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
bool isa(const std::string &go_name) const
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
virtual void draw_axes(const axes::properties &props)
bool get_xySym(void) const
MArray< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
bool valid_object(void) const
vertex_data_rep * get_rep(void) const
double get_y_min(void) const
bool get_layer2Dtop(void) const
double get_zpTickN(void) const
virtual void draw_text_background(const text::properties &props, bool do_rotate=false)
virtual void vertex(void *)
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit first
virtual void set_clipping(bool on)
void tex_coord(double q, double r) const
virtual bool has_property(const caseless_str &) const
void begin_polygon(bool filled=true)
text_renderer txt_renderer
virtual void draw_line(const line::properties &props)
double get_ypTickN(void) const
virtual octave_value get(const caseless_str &pname) const
static void tess_combine(GLdouble c[3], void *v[4], GLfloat w[4], void **out, void *t)
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")
bool get_x2Dtop(void) const
opengl_texture(texture_rep *_rep)
virtual void combine(GLdouble [3], void *[4], GLfloat [4], void **)
octave_value get(bool all=false) const
bool get_y2Dright(void) const
void set_font(const std::string &name, const std::string &weight, const std::string &angle, double size)
virtual void draw_hggroup(const hggroup::properties &props)
std::complex< double > w(std::complex< double > z, double relerr=0)
bool is_single_type(void) const
virtual graphics_toolkit get_toolkit(void) const
vertex_data_rep(const Matrix &c, const Matrix &col, const Matrix &n, double a, float as, float ds, float ss, float se, float scr)
virtual void set_linecap(const std::string &)
dim_vector dims(void) const
virtual void draw_marker(double x, double y, double z, const Matrix &lc, const Matrix &fc)
static int get_maxlights(void)
double get_y_max(void) const
void set_color(const Matrix &c)
#define panic_impossible()
octave_uint8 clip_code(double x, double y, double z) const
virtual void set_linewidth(float w)
virtual void end_marker(void)
Matrix get_opengl_matrix_2(void) const
base_properties & get_properties(void)
static void tess_edge_flag(GLboolean flag, void *t)
double get_ztickoffset(void) const
double get_xticklen(void) const
double get_ytickoffset(void) const
int get_zstate(void) const
virtual void begin(GLenum)
double get_yPlaneN(void) const
Matrix get_transform_zlim(void) const
double get_xtickoffset(void) const
virtual void set_linestyle(const std::string &s, bool stipple=false, double linewidth=0.5)
bool is_nan_or_inf(double x, double y, double z) const
bool is_valid(void) const
virtual uint8NDArray get_pixels(int width, int height)
Matrix get_all_children(void) const
octave_int< T > xmin(const octave_int< T > &x, const octave_int< T > &y)
virtual graphics_xform get_transform(void) const
virtual void set_viewport(int w, int h)
void warning(const char *fmt,...)
virtual void set_color(const Matrix &c)
charNDArray max(char d, const charNDArray &m)
double get_x_min(void) const
void draw_axes_boxes(const axes::properties &props)
static std::string gl_get_string(GLenum id)
virtual void draw_light(const light::properties &props)
void bind(int mode=GL_TEXTURE_2D) const
unsigned int current_light
void add_vertex(double *loc, void *data) const
double get_z_max(void) const
patch_tesselator(opengl_renderer *r, int cmode, int lmode, float idx=0.0)
virtual void set_linejoin(const std::string &)
double get_zPlane(void) const
unsigned int make_marker_list(const std::string &m, double size, bool filled) const
unsigned int filled_marker_id
int get_xstate(void) const
static opengl_texture create(const octave_value &data)
uint16NDArray uint16_array_value(void) const
bool has_bad_data(std::string &msg) const
virtual void edge_flag(GLboolean)
static void tess_vertex(void *v, void *t)
void tex_coord(double q, double r) const
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 void text_to_pixels(const std::string &txt, uint8NDArray &pixels, Matrix &bbox, int halign=0, int valign=0, double rotation=0.0)
double double_value(bool frc_str_conv=false) const
octave_value get_color_data(void) const
bool get_zSign(void) const
double get_xpTick(void) const
the element is set to zero In other the statement xample y
virtual void draw_uipanel(const uipanel::properties &props, const graphics_object &go)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
static graphics_object get_object(double val)
int get_ystate(void) const
virtual void draw_patch(const patch::properties &props)
double get_zticklen(void) const
virtual ~opengl_tesselator(void)
void end_contour(void) const
void draw_axes_x_grid(const axes::properties &props)
bool is_double_type(void) const
OCTAVE_EXPORT octave_value_list error nd deftypefn *const octave_scalar_map err
double get_zpTick(void) const
octave_idx_type ndims(void) const
Number of dimensions.
virtual void draw_surface(const surface::properties &props)
void end_polygon(void) const
virtual void finish(void)
octave_value get_color_data(void) const
octave_idx_type numel(void) const
Number of elements in the array.
graphics_object get_ancestor(const std::string &type) const
octave_int< uint8_t > octave_uint8
virtual void draw_figure(const figure::properties &props)
double get_xPlane(void) const
Vector representing the dimensions (size) of an Array.
vertex_data_rep * nil_rep(void) const
double get_fy(void) const
bool is_uint8_type(void) const
double get_xpTickN(void) const
virtual void set_interpreter(const caseless_str &interp)
Matrix get_opengl_matrix_1(void) const
virtual void set_clipbox(double x1, double x2, double y1, double y2, double z1, double z2)
virtual void set_font(const base_properties &props)
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
bool is_filled(void) const
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
bool get_is2D(bool include_kids=false) 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)
static idx_vector make_range(octave_idx_type start, octave_idx_type step, octave_idx_type len)
double get_zPlaneN(void) const
double get_x_max(void) const
NDArray array_value(bool frc_str_conv=false) const
Matrix matrix_value(bool frc_str_conv=false) const
void xform(ColumnVector &v, const Matrix &m)
uint8NDArray uint8_array_value(void) const
void set_normal(int bfl_mode, const NDArray &n, int j, int i)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
void draw_axes_planes(const axes::properties &props)
void draw_axes_y_grid(const axes::properties &props)
charNDArray min(char d, const charNDArray &m)
bool is_uint16_type(void) const