views:

143

answers:

3

How can I render mathematical notations / expressions in Python with OpenGL?

I'm actually using pyglet however it uses OpenGL.

Such things as this:

Quadratic formula

I can't store static images as I am generating the expressions as well.

+6  A: 

I would say generate suitable latex expression, rendering it into an image, then load the image as a texture.

freespace
+2  A: 

You can use GL_TEXTURE_RECTANGLE_ARB opengl extension to quickly load dynamicaly generated image of arbitrary size into OpenGL texture. You can look for python examples of using dynamic vector graphics with opengl at http://cairographics.org/OpenGL/, though if you want to render complex formulas you also have to look at the some appropriate system like latex.

+1  A: 

I don't know about the OpenGL bit. But matplotlib has a matplotlib.mathtext module for rendering a sub-set of TeX mathematical expressions.

Craig McQueen