Hardware rendering with tricontourf

Hi all

I'm rendering some images with about 3.5 million triangles into a

512x512 png file using tricontourf. I’m running this in a virtual
machine, and I’m pretty sure that there is no graphics rendering
hardware being used. Is it possible, assuming the hardware was
available, to make tricontourf use the rendering hardware? Will
that happen by default?

Here's the relevant portion of the code.

       figure1 = plt.figure(figsize=(imageWidth,imageHeight))
       theTriangulation.set_mask(mask)
       plt.axis("off")

       # This makes sure the figure fills the canvas
       ax = figure1.add_axes([0,0,1,1])

       # This turns off the tick marks of the axis we added.
       ax.axis("off")
       plt.tricontourf(theTriangulation,
                             modelData,
                             theLookupTable.N,
                             norm=theNorm,
                             antialiased=False,
                             cmap=theLookupTable)
      canvas = FigureCanvasAgg(figure1)
      canvas.print_figure(fileName, dpi=DPI)

Thanks
Howard
···

  Howard Lander

  Senior Research Software Developer

  [        Renaissance Computing Institute

(RENCI)](http://www.renci.org)

  The University of North Carolina at Chapel Hill

  Duke University

  North Carolina State University

  100 Europa Drive

  Suite 540

  Chapel Hill, NC 27517

  919-445-9651

You are correct, there is no graphics hardware rendering. Rendering is controlled by the various matplotlib backends, and to my knowledge there are no backends currently available that use hardware rendering.

There has been some work done on an OpenGL backend, but I am not sure of the status of this. The last time I checked it was pretty experimental. Perhaps someone involved with it can comment on its current status.

Ian Thomas

···

On 26 January 2012 19:36, Howard <howard@…3845…> wrote:

I'm rendering some images with about 3.5 million triangles into a

512x512 png file using tricontourf. I’m running this in a virtual
machine, and I’m pretty sure that there is no graphics rendering
hardware being used. Is it possible, assuming the hardware was
available, to make tricontourf use the rendering hardware? Will
that happen by default?

Ian

Thanks very much for the reply. If it helps whoever is doing the

OpenGL backend, I may be able to play with it a bit.

Howard
···

  Howard Lander

  Senior Research Software Developer

  [        Renaissance Computing Institute

(RENCI)](http://www.renci.org)

  The University of North Carolina at Chapel Hill

  Duke University

  North Carolina State University

  100 Europa Drive

  Suite 540

  Chapel Hill, NC 27517

  919-445-9651

That would be the Glumpy project.

http://code.google.com/p/glumpy/

As stated in an email response a while back, glumpy is intended to be a testbed for developing the OpenGL backend for future inclusion into matplotlib.

Cheers!
Ben Root

···

On Fri, Jan 27, 2012 at 10:06 AM, Howard <howard@…3845…> wrote:

On 1/27/12 3:39 AM, Ian Thomas wrote:

On 26 January 2012 19:36, Howard <howard@…3845…> > > wrote:

        I'm rendering some

images with about 3.5 million triangles into a 512x512 png
file using tricontourf. I’m running this in a virtual
machine, and I’m pretty sure that there is no graphics
rendering hardware being used. Is it possible, assuming the
hardware was available, to make tricontourf use the
rendering hardware? Will that happen by default?

      You are correct, there is no graphics hardware rendering. 

Rendering is controlled by the various matplotlib backends,
and to my knowledge there are no backends currently available
that use hardware rendering.

      There has been some work done on an OpenGL backend, but I am

not sure of the status of this. The last time I checked it
was pretty experimental. Perhaps someone involved with it can
comment on its current status.

      Ian Thomas

Ian

Thanks very much for the reply. If it helps whoever is doing the

OpenGL backend, I may be able to play with it a bit.

Howard

Thanks for posting the link to glumpy.

As Benjamin explained, glumpy servers as a testbed for various technics that could be implemented later in matplotlib. The main problem today is that if you want to benefit from hardware acceleration, you have to use some GL features that are not compatible with he whole matplotlib framework (and we need to ensure some degree of compatibilty). I do not have yet a clean solution and I’m still experimenting.

For your tricontourf problem, I think it might be solved quite easily with the proper GL shader but I would need a complete (and basic) matplotlib script example to check if this is actually the case.

Nicolas

···

On Jan 27, 2012, at 23:12 , Benjamin Root wrote:

On Fri, Jan 27, 2012 at 10:06 AM, Howard <howard@…3845…> wrote:

On 1/27/12 3:39 AM, Ian Thomas wrote:

On 26 January 2012 19:36, Howard <howard@…3845…> > > > wrote:

        I'm rendering some

images with about 3.5 million triangles into a 512x512 png
file using tricontourf. I’m running this in a virtual
machine, and I’m pretty sure that there is no graphics
rendering hardware being used. Is it possible, assuming the
hardware was available, to make tricontourf use the
rendering hardware? Will that happen by default?

      You are correct, there is no graphics hardware rendering. 

Rendering is controlled by the various matplotlib backends,
and to my knowledge there are no backends currently available
that use hardware rendering.

      There has been some work done on an OpenGL backend, but I am

not sure of the status of this. The last time I checked it
was pretty experimental. Perhaps someone involved with it can
comment on its current status.

      Ian Thomas

Ian

Thanks very much for the reply. If it helps whoever is doing the

OpenGL backend, I may be able to play with it a bit.

Howard

That would be the Glumpy project.

http://code.google.com/p/glumpy/

As stated in an email response a while back, glumpy is intended to be a testbed for developing the OpenGL backend for future inclusion into matplotlib.

Cheers!
Ben Root


Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@…2569…sourceforge.net
matplotlib-users List Signup and Options

Hi Nicolas

Thanks for the post.  I'm going to finish optimizing all of the

non-rendering pieces of my code, then I’ll see if trying the
hardware rendering makes sense. Right now I am software rendering
3.5 million triangles in about 5 seconds, but the setup (masking
etc) is taking about 40. When I get the setup lower (which I think
I will), I’ll get back to you about this.

Thanks again
Howard
···

Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

  Howard Lander

  Senior Research Software Developer

  [        Renaissance Computing Institute

(RENCI)](http://www.renci.org)

  The University of North Carolina at Chapel Hill

  Duke University

  North Carolina State University

  100 Europa Drive

  Suite 540

  Chapel Hill, NC 27517

  919-445-9651