octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: implementing new graphics toolkit


From: Mike Miller
Subject: Re: implementing new graphics toolkit
Date: Tue, 19 Apr 2016 11:44:57 -0700
User-agent: Mutt/1.5.24 (2015-08-30)

On Mon, Apr 18, 2016 at 04:44:43 -0700, olli wrote:
> Hello,
> I would like to write a new octave graphics toolkit, which generates WebGL
> output for the purpose of generating online documentation.

Sounds neat, please do.

> I have difficulties to find the detailed steps how to add a new graphics
> toolkit, which a assume to be
> 1) subclass an abstract toolkit class
> 2) implement all missing methods, maybe "drawLine", "setPixel",... or more
> complicated "plot2D", "plot3D", ...
> 3) compile new library containing this toolkit and link octave executable
> against it
> 4) register new library in some configuration file.
> 
> Is this the right approach? If yes, 
> which is the base class to extend?
> which Makefile needs changes to add the new toolkit library?
> how do I make the toolkit known to octave?
> 
> If this is totally wrong, I'd appreciate some hints how to get started with
> a new graphics toolkit implementation. Maybe some FAQ or README file exists
> already?

I think this is one of those times where the best documentation is to
read the existing code. We have three different toolkits in Octave now,
so there are some examples to draw from.

I haven't done this myself, but if you do work on this please do
document what you find out and consider contributing it back to the
community.

Your assumptions are mostly right, except you do not need to link Octave
against your toolkit, you can simply load it as an oct-file and register
it at runtime and it will appear as a new toolkit ready to be used. So
steps 3-4 would be

  3. compile oct-file containing this toolkit called "__init_mytk__"
  4. call addpath on the directory containing __init_mytk__.oct
  5. call register_graphics_toolkit ("mytk")

The simplest toolkit to start from is the gnuplot one, because most of
its functions are in m-files. Look at __init_gnuplot__.cc [1] for what I
assume to be a pretty minimal skeleton for how to subclass and register
a new graphics toolkit.

You'll probably then want to look at the GL-based toolkits [2],[3] for
examples of how the base_graphics_toolkit interfaces with the actual
graphical framework being used.

[1]: 
http://hg.savannah.gnu.org/hgweb/octave/file/@/libinterp/dldfcn/__init_gnuplot__.cc
[2]: 
http://hg.savannah.gnu.org/hgweb/octave/file/@/libinterp/dldfcn/__init_fltk__.cc
[3]: http://hg.savannah.gnu.org/hgweb/octave/file/@/libgui/graphics

-- 
mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]