|
From: | John Swensen |
Subject: | Re: Text properties and FTGL |
Date: | Sat, 1 Nov 2008 09:18:42 -0400 |
On Oct 31, 2008, at 10:21 PM, Bill Denney wrote:
John Swensen wrote:Thanks for pointing these out. I don't know what they are not doing in mathTeX that I must be doing in my system calls, but mathTeX is significantly faster. Since it is GPL and Octave is GPL I will probably actually compile this into my Octave tests and render straight to the openGL texture, rather than have it render to a file and then read it back in. I think a time of ~0.1 seconds per LaTeX string and appropriate caching of the results is acceptable.Just a thought, but could you render each result on a different page inthe LaTeX output and make it just ~0.1 sec total instead? Have a good day, Bill
I just tested that and you are exactly right. Until I had more than 100 equations (each on a different page), the time did not go over ~0.15 seconds. Even at 400 equations it was only 0.3 seconds. I also found out that with the poppler library I can do all the cropping and such, so there is no need to call the pdfcrop script at all. This will probably work after all.
As a side note, I did look at the mimeTeX program that was mentioned in this thread. It is not a full TeX/LaTex interpreter, but has almost all basic symbols and constructs. It essentially generates bitmaps from a set of fonts described in one of the header files. It looks like the author rendered all of the characters, accents, etc for a specific size from Latex to a bitmap and then converted those bitmaps into C arrays and put them all into a header file. This method would scale horribly, but the nice thing is that it is wholly contained in about 2 header files and one source file. For the "LaTeX- free" Octave, maybe it makes sense to borrow from his (it is GPL also) and instead of a single header file of font bitmaps, simply include every 2 points from 8 to 20. This would look OK and we can still have the runtime check for the full version of LaTeX.
So here is my proposed work plan for the next little while:1) Get the most basic and easiest thing working: pdflatex+poppler to render text to the OpenGL renderer 2) Get other cases working where pdflatex is not present, but LaTeX is: latex+dvipdf+poppler to render text to the OpenGL renderer (as a non-related side note, does anyone have a two sentence explanation as to why pdflatex renders documents so much better than latex+dvipdf?) 3) Add in the non-LaTeX based converter from LaTeX to bitmap (low priority)
I now have an OpenGL question about textures. Poppler converts the PDF into a buffer of the form numpixels * (RGBA), where the PDF has been scaled and the DPI chosen before this conversion to pixels takes place, so things are anti-aliased and everything is beautiful. My problem is that it renders a white background and that keeps showing up when I render the texture to opengl with glBegin(GL_QUADS);...glEnd();. With other programs I have used before, I should either be able to (1) just set the color I want to be the alpha color or (2) go through and set the value in the alpha channel for each of the pixels where I want it to be transparent to 1 (or 255). I don't know how to do (1) with OpenGL and when I try to do (2) nothing happens.
John Swensen
[Prev in Thread] | Current Thread | [Next in Thread] |