Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting Library for OpenGL [closed]

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?

like image 938
Charlie JM Avatar asked Feb 13 '10 22:02

Charlie JM


2 Answers

MathGL is cross-platform GPL plotting library which can use OpenGL for drawing (class mglGraphGL).

However it can produce a bitmap (or vector EPS/SVG) too. It is rather fast and don't require windows (can be run in console).

like image 101
abalakin Avatar answered Oct 18 '22 14:10

abalakin


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.

like image 2
Malte Clasen Avatar answered Oct 18 '22 13:10

Malte Clasen