Rendering mathematical notation in Python / OpenGL?
How can I render mathematical notat开发者_如何学Cions / expressions in Python with OpenGL?
I'm actually using pyglet however it uses OpenGL.
Such things as this:
I can't store static images as I am generating the expressions as well.
I would say generate suitable latex expression, rendering it into an image, then load the image as a texture.
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.
I don't know about the OpenGL bit. But matplotlib has a matplotlib.mathtext
module for rendering a sub-set of TeX mathematical expressions.
- Screenshots
- Tutorial
精彩评论