OpenGL backend and pyglet expertiments

I read the thread about mplot3d and the work that has been done by Jonathan Taylor. I wonder if an OpenGL backend is necessary at all. Jonathan's work seems to be great for simple 3D plotting while the mayavi mlab module is here for more "serious" rendering. I think I will concentrate my efforts on a simple GL terminal for IPython with embedded visualization capability. As for sympy (and because it uses pyglet), I guess the integration should be straight forward.

Last version of the ipython GL terminal is on launchpad:
           https://launchpad.net/glipy

Nicolas

···

On 7 Apr, 2009, at 00:38 , Cohen-Tanugi Johann wrote:

There has been a recent thread discussing sympy interface to pyglet in the context of matplotlib refactoring of the 3D code. See thread named 'Updating MPlot3D to a more recent matplotlib.'
If you are porting pyglet interface to Ipython, Ondrej might be happy to see his sympy 3D plotting routines go there as well :slight_smile:
cheers,
Johann

Nicolas Rougier wrote:

Sure, thread about IPython integration to be continued on ipython-dev list...

Nicolas

On 3 Apr, 2009, at 19:07 , Fernando Perez wrote:

On Fri, Apr 3, 2009 at 10:00 AM, Nicolas Rougier >>> <Nicolas.Rougier@...466...> wrote:

Sorry for that, I coded it on linux and just tested on mac.
I fixed the error and upload the new version on the same link. Tell me if
it's ok.

Great!

Would you have any interest in having this be shipped/developed as
part of IPython itself?

You are using a fair amount of internals of the ipython machinery, and
we're getting ready for a large cleanup. Having your code shipped
with ipython itself would give it perhaps more exposure, as well as
allow it to evolve in sync with the rest of the API, since we could
test it as the internals change.

I think it would be great to ship this with ipython itself, and I'm
sure you'd get help and contributions from the rest of the ipython
team as well...

Best,

f

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Nicolas Rougier wrote:

I read the thread about mplot3d and the work that has been done by
Jonathan Taylor. I wonder if an OpenGL backend is necessary at all.
Jonathan's work seems to be great for simple 3D plotting while the
mayavi mlab module is here for more "serious" rendering. I think I
will concentrate my efforts on a simple GL terminal for IPython with
embedded visualization capability. As for sympy (and because it uses
pyglet), I guess the integration should be straight forward.

Last version of the ipython GL terminal is on launchpad:
           https://launchpad.net/glipy

Hi Nicolas, I haven't tried your glipy terminal, but it looks very
interesting.

The main issue with an OpenGL backend for MPL is simply that a naive
implementation is going to look ugly when compared, pixel-by-pixel,
against the Agg or cairo backends to generate bitmaps. Agg and cairo are
very good at drawing anti-aliased lines, whereas one must jump through
hoops to get consumer OpenGL cards to render lines well.

Here's an idea -- an OpenGLAgg backend that actually uses Agg for all
the rendering, but blits the results to an OpenGL texture for display.
Thus, the backend would really just be glue between the existing Agg
backend and pyglet.

-Andrew

What I do generally to have "nice" OpenGL output is to render screenshots at high resolution and then use something like gimp to resize them. I agree that it is far from optimal but it's pretty decent for a scientific paper. Other solutions are vector rendering of scene (using gl2ps for example) or the texture anti-aliasing technique (http://homepage.mac.com/arekkusu/bugs/invariance/TexAA.html).

But, beside rendering issue, I think an OpenGL backend could be useful for experiments involving very fast rendering of large arrays. Using OpenGL texture, you can render 1000x1000 arrays with continuous update of data (on recent machines).

Nicolas

···

On 7 Apr, 2009, at 19:05 , Andrew Straw wrote:

Nicolas Rougier wrote:

I read the thread about mplot3d and the work that has been done by
Jonathan Taylor. I wonder if an OpenGL backend is necessary at all.
Jonathan's work seems to be great for simple 3D plotting while the
mayavi mlab module is here for more "serious" rendering. I think I
will concentrate my efforts on a simple GL terminal for IPython with
embedded visualization capability. As for sympy (and because it uses
pyglet), I guess the integration should be straight forward.

Last version of the ipython GL terminal is on launchpad:
          https://launchpad.net/glipy

Hi Nicolas, I haven't tried your glipy terminal, but it looks very
interesting.

The main issue with an OpenGL backend for MPL is simply that a naive
implementation is going to look ugly when compared, pixel-by-pixel,
against the Agg or cairo backends to generate bitmaps. Agg and cairo are
very good at drawing anti-aliased lines, whereas one must jump through
hoops to get consumer OpenGL cards to render lines well.

Here's an idea -- an OpenGLAgg backend that actually uses Agg for all
the rendering, but blits the results to an OpenGL texture for display.
Thus, the backend would really just be glue between the existing Agg
backend and pyglet.

-Andrew

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Nicolas Rougier wrote:

What I do generally to have "nice" OpenGL output is to render
screenshots at high resolution and then use something like gimp to
resize them. I agree that it is far from optimal but it's pretty
decent for a scientific paper. Other solutions are vector rendering of
scene (using gl2ps for example) or the texture anti-aliasing technique
(http://homepage.mac.com/arekkusu/bugs/invariance/TexAA.html).

Yes. That is why I said a "naive" implementation.

But, beside rendering issue, I think an OpenGL backend could be useful
for experiments involving very fast rendering of large arrays. Using
OpenGL texture, you can render 1000x1000 arrays with continuous update
of data (on recent machines).

Yes. I wrote a module pygarrayimage for just that:
http://code.astraw.com/projects/motmot/pygarrayimage.html

BTW, my ideas were meant more as "how to wedge MPL quickly into glipy
with a minimum of work" rather than "a talented programmer with one year
of free time to come up with the coolest scientific workflow GUI" variety.

-Andrew

BTW, my ideas were meant more as "how to wedge MPL quickly into glipy
with a minimum of work" rather than "a talented programmer with one year
of free time to come up with the coolest scientific workflow GUI" variety.

Sorry, I did not understood your proposal in the first place...
That might be a good thing to try, I'll have a look at as soon as I have more free time.

Nicolas