We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Crazy Fast OpenGL Text
Page Index Toggle Pages: 1
Crazy Fast OpenGL Text (Read 4426 times)
Crazy Fast OpenGL Text
Mar 23rd, 2010, 12:17pm
 
I ran into this sketch on OpenProcessing.org.  
http://www.openprocessing.org/visuals/?visualID=2722

It uses some nice techniques to get some awesome text speed.  I could sure use something like this but the example is a bit on the complex side.  I understand all the VBO stuff, but I don't understand why it's creating a new PGraphicsOpenGL, why all the changing of perspective, etc. It's impressive.. just wish I could figure it out to incorporate it into my sketch.

Could someone take a look at this and make it more usable in a normal sketch
Re: Crazy Fast OpenGL Text
Reply #1 - May 10th, 2010, 2:09pm
 
I wanted to revive this thread.  Hoping that someone might be able to make this a little more usable.  I'd love to have something as simple as text(), like fasttext("this is fast", 50, 50);

Using the methods described by Taifun (take a look at the comments) it appears that this could be turned into something simple and very fast.  Hope someone can take this a little further along.  I'm getting stuck on the matrix models.  If I draw anything besides the text, the text disappears.
Re: Crazy Fast OpenGL Text
Reply #2 - May 11th, 2010, 5:18am
 
What about using an old method of ascii mapping each char to a common texture (fonttexture).
Create a texture and divide it in a grid NxN. each cell of font size holds a char.
then map the char code to the correct texture uv. that would allow you to render a quad with a given character.

you only bind one texture for whatever text you want to render. You can create a vbo/va for the text mesh

note
you need to create a font texture yourself, or use that guys method to map a font and create a big texture with all chars ( i think that's what he's doing)

Re: Crazy Fast OpenGL Text
Reply #3 - May 11th, 2010, 7:19am
 
I have no idea how to do what you described, but it sounds good. Smiley  Haha I'll try to do some research on that.  I'm really thinking about trying to turn something like this into a Processing library and post it on GitHub or something.  I have a lot of text in my sketch, so it would be great to make it more efficient.
Re: Crazy Fast OpenGL Text
Reply #4 - May 11th, 2010, 9:23am
 
I've made an example of the method i was talking about. This example uses display lists to map each character on a texture. the char mapping is based on char codes. You could use VBO or whatever.
Quake used this technique for text rendering.

www.pixelnerve.com/temp/TextureFont.zip

A couple of font texture examples go with the package (fonts taken from Quake and the internet)

To make it even simpler to use will take some work, but looking at that link you have you could build the texture from a PFont as that guy does and with this project + his project you could maybe make a library.

Have fun.
Re: Crazy Fast OpenGL Text
Reply #5 - May 28th, 2010, 6:59pm
 
I was working with somthing like this some time ago (those were the days lol). I'm going to have a look around the old computers and see if I can dig anything up on similar speed-text. james
Page Index Toggle Pages: 1