Skip to main content
gamedev.net
🔒 Locked

Displaying Math Text

Started by cjellison Nov 30, 2004 at 12:00 PM 1 replies 450+ views
Original Post
cjellison
cjellison
Perhaps this is more of a general C++ question, but I would like to do it with OpenGL if possible. Basically, I am seeking a way to dynamically display complicated math formulas within my program. I want to be able to zoom in on the formulas, move the camera around to see the formulas backwards, and any other feature I program in. This seems tough...LaTeX is a nice language...but I know of no libraries that provide LaTeX-like support. Notice, I need the graphics to be generated at runtime---so I can't pregenerate my images and use them in the program. Ideally, I would like to be able to type: \sqrt{i} + 15\cos \theta or something like that...basically, I do not want to have to worry about the layout of the formulas (LaTeX takes care of that)...primarily, I just specify what the formulas should say. This seems like a useful thing. For instance, suppose I wanted to create a really nice math program...well, I would be nice if I could display really nice math equations. Chris
Solias
Solias
It seems like there are two pieces to the problem. First you need some code to format the equation based on the latex expression. This would involve interperting the expression, inserting the special sybols, positioning/sizing the symbols, etc. This really isn't ogl code, it's application code that will use ogl to display its output. Aren't there open source implementations of latex formatters? (Is latex the formatting language or the formatter?) If so they will probably have code you can use dealing with formatting the latex expression.

The second part will be displaying the formatted output using ogl. For this you are probably going to want to use textured quads with either premade fonts and symbols, or font textures created at runtime using the OS's font support. (You'll probably use premade textures for mathematical symbols either way since a system may not supply a good mathematical font.)

These quads will be sized and positioned as needed by the formatting component. This part should be pretty simple, and there are plenty of tutorials on displaying text with ogl.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.