26 #if defined (HAVE_CONFIG_H)
30 #if defined (HAVE_OSMESA_H)
32 #elif defined (HAVE_GL_OSMESA_H)
33 # include <GL/osmesa.h>
46 #if defined (HAVE_OSMESA)
88 #if defined (HAVE_OSMESA)
92 if (nargin != 1 && nargin != 3)
97 if (! (
args(1).is_string () &&
args(2).is_string ()))
98 error (
"__osmesa_print__: FILE and TERM must be strings");
103 int h =
args(0).double_value ();
105 if (! (fobj && fobj.
isa (
"figure")))
106 error (
"__osmesa_print__: H must be a valid figure handle");
111 bool internal =
true;
114 GLsizei Width =
static_cast<GLsizei
> (bb(2));
115 GLsizei Height =
static_cast<GLsizei
> (bb(3));
118 OSMesaContext ctx = OSMesaCreateContextExt (OSMESA_RGBA, 16, 0, 0, NULL);
120 error (
"__osmesa_print__: OSMesaCreateContext failed!\n");
126 if (! OSMesaMakeCurrent (ctx, buffer, GL_UNSIGNED_BYTE, Width, Height))
127 error (
"__osmesa_print__: OSMesaMakeCurrent failed!\n");
135 glGetIntegerv (GL_DEPTH_BITS, &z);
136 glGetIntegerv (GL_STENCIL_BITS, &s);
137 if (z != 16 || s != 0)
138 error (
"__osmesa_print__: Depth and stencil doesn't match,"
139 " are you sure you are using OSMesa >= 9.0?");
147 outer_frame.
add_fcn (reset_visibility, &fp);
173 assert (
sizeof (GLubyte) == 1);
175 unsigned char *
p =
reinterpret_cast<unsigned char*
>(img.
fortran_vec ());
176 memcpy (p, buffer, (4 * Width * Height));
194 OSMesaDestroyContext (ctx);
200 octave_unused_parameter (
args);
For example cd octave end example noindent changes the current working directory to file
bool is_visible(void) const
MArray< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
bool isa(const std::string &go_name) const
static const idx_vector colon
OCTINTERP_API void print_usage(void)
virtual void draw(const graphics_object &go, bool toplevel=true)
void error(const char *fmt,...)
void add_fcn(void(*fcn)(void))
void gl2ps_print(const graphics_object &fig, const std::string &stream, const std::string &term)
base_properties & get_properties(void)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
static graphics_object get_object(double val)
#define DEFUN_DLD(name, args_name, nargout_name, doc)
const T * fortran_vec(void) const
virtual void finish(void)
Vector representing the dimensions (size) of an Array.
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
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
static idx_vector make_range(octave_idx_type start, octave_idx_type step, octave_idx_type len)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))