views:

350

answers:

1

I need to draw a scientific graph (for example, a line or bar graph) and then render it in my application, which uses OpenGL for all display-related purposes.

What is the best way to do this?

Does anyone know of a plotting library for OpenGL?

I haven't been able to find one, and the best thing I've come up with so far is to use LibGD or PlPlot to render my image, save to PNG, and then load that same PNG as a texture for an OpenGL quad. Does anyone have any suggestions for a better way to to this, or know a library which could help with my task?

Thanks!

A: 

Rendering to PNG and using this as a texture is actually a reasonable way to solve your problem. If you need a "better" way, all depends on what you consider "better". If it's about scalable graphics, use the SVG output of PLPlot and render the vector shapes directly in OpenGL. If it's about avoiding intermediate files, you could extend PLPlot (LGPL licensed) to pass the data as a chunk in memory.

Malte Clasen