26#if defined (HAVE_CONFIG_H)
40#if defined (HAVE_QOPENGLWIDGET)
41# define OCTAVE_QT_OPENGL_WIDGET_FORMAT_ARGS
43# if defined (Q_OS_WIN32)
44# define OCTAVE_QT_OPENGL_WIDGET_FORMAT_ARGS \
45 QGLFormat (QGL::SampleBuffers | QGL::AlphaChannel \
46 | QGL::IndirectRendering),
48# define OCTAVE_QT_OPENGL_WIDGET_FORMAT_ARGS \
49 QGLFormat (QGL::SampleBuffers | QGL::AlphaChannel),
54 octave::interpreter& interp,
57 Canvas (oct_qobj, interp, gh), m_glfcns (), m_renderer (m_glfcns)
59 setFocusPolicy (Qt::ClickFocus);
79 graphics_object go = gh_mgr.get_object (gh);
83 graphics_object fig = go.get_ancestor (
"figure");
84 double dpr = fig.get (
"__device_pixel_ratio__").double_value ();
98 graphics_object go = gh_mgr.get_object (gh);
100 if (go && go.isa (
"figure"))
102 Matrix pos = go.get (
"position").matrix_value ();
103 double dpr = go.get (
"__device_pixel_ratio__").double_value ();
114 if (go.get (
"visible").string_value () ==
"off"
115 || go.get (
"__printing__").string_value () ==
"on")
119 OCTAVE_QT_OPENGL_FBO::Attachment::Depth);
152 graphics_object go = gh_mgr.get_object (handle);
154 if (go.valid_object ())
156 graphics_object fig (go.get_ancestor (
"figure"));
160 error (
"print: no valid OpenGL offscreen context");
164 if (fig.get (
"visible").string_value () ==
"on")
166 term.toStdString ());
171 Matrix pos = fig.get (
"position").matrix_value ();
172 double dpr = fig.get (
"__device_pixel_ratio__").double_value ();
178 OCTAVE_QT_OPENGL_FBO::Attachment::Depth);
183 term.toStdString ());
188 catch (octave::execution_exception& ee)
212 return s.
select (ax, pt.x (), height () - pt.y (),
216 return graphics_object ();
222 Matrix overlaycolor (3, 1);
223 overlaycolor(0) = 0.45;
224 overlaycolor(1) = 0.62;
225 overlaycolor(2) = 0.81;
226 double overlayalpha = 0.1;
227 Matrix bordercolor = overlaycolor;
228 double borderalpha = 0.9;
229 double borderwidth = 1.5;
232 p1.x (), p1.y (), p2.x (), p2.y (),
233 overlaycolor, overlayalpha,
234 bordercolor, borderalpha, borderwidth);
277 OCTAVE_QT_OPENGL_WIDGET::keyPressEvent (xevent);
284 OCTAVE_QT_OPENGL_WIDGET::keyReleaseEvent (xevent);
294# if defined (HAVE_QT_OFFSCREEN)
295 static bool os_ctx_ok =
true;
296 if (os_ctx_ok && ! m_os_context.isValid ())
299 m_os_surface.create ();
300 if (! m_os_context.create ())
307 retval = m_os_context.makeCurrent (&m_os_surface);
#define OCTAVE_QT_OPENGL_WIDGET_FORMAT_ARGS
bool canvasKeyPressEvent(QKeyEvent *event)
void canvasMouseReleaseEvent(QMouseEvent *event)
bool canvasKeyReleaseEvent(QKeyEvent *event)
void canvasPaintEvent(void)
void canvasMouseMoveEvent(QMouseEvent *event)
void canvasMousePressEvent(QMouseEvent *event)
octave::interpreter & m_interpreter
void interpreter_event(const octave::fcn_callback &fcn)
void canvasMouseDoubleClickEvent(QMouseEvent *event)
void canvasWheelEvent(QWheelEvent *event)
octave::opengl_renderer m_renderer
void mouseReleaseEvent(QMouseEvent *event)
void draw(const graphics_handle &handle)
void wheelEvent(QWheelEvent *event)
GLCanvas(octave::base_qobject &oct_qobj, octave::interpreter &interp, const graphics_handle &handle, QWidget *parent)
void mousePressEvent(QMouseEvent *event)
uint8NDArray do_getPixels(const graphics_handle &handle)
void drawZoomBox(const QPoint &p1, const QPoint &p2)
void do_print(const QString &file_cmd, const QString &term, const graphics_handle &handle)
void keyReleaseEvent(QKeyEvent *event)
void keyPressEvent(QKeyEvent *event)
graphics_object selectFromAxes(const graphics_object &ax, const QPoint &pt)
octave::qopengl_functions m_glfcns
void mouseMoveEvent(QMouseEvent *event)
void mouseDoubleClickEvent(QMouseEvent *event)
bool begin_rendering(void)
Base class for Octave interfaces that use Qt.
virtual void draw(const graphics_object &go, bool toplevel=true)
virtual uint8NDArray get_pixels(int width, int height)
virtual void set_viewport(int w, int h)
virtual void set_device_pixel_ratio(double dpr)
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)
graphics_object select(const graphics_object &ax, int x, int y, int flags=0)
void error(const char *fmt,...)
void gl2ps_print(opengl_functions &glfcns, const graphics_object &fig, const std::string &stream, const std::string &term)