Jump to content
  • Advertisement
Sign in to follow this  
cjellison

OpenGL Displaying Math Text

This topic is 4982 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Check the NeHe tutorial "Outline font"

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!