XZibit's picture

Bitmap/Texture Fonts gives slowdown

Hi there

i created some classes to use in 2d rendering including some Fonts. Now when i put the fonts on the screen and print one string with 18 characters, it gives me a slowdown of at least 1000 frames and it gets more with every new character. Im using display lists witch a power of 2 texture and a charakter-atlas so i couldnt imagine why it is so slow especialy because there are only texcoords an vertex calls on the lists with the local character-location as texcoord and the size of the element beeing drawn. My lists are drawn with glcalllists as trianglestrip and the texture is bound once each frame.

Has anyone an idea or a better solution to implement bitmap/texture fonts?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
migueltk's picture

Hi

Recently I had an unpleasant experience with this issue, I discovered that making calls to Drawing.Font.Size and/or Drawing.Font.Height in each frame update significantly diminished the number of frames per second.

Greetings ...

james_lohr's picture

>>it gives me a slowdown of at least 1000 frames

That is a meaningless measure. It's like saying that if a feather lands on an empty scale, the amount of weight on the scale increases a million fold.

>> Has anyone an idea or a better solution to implement bitmap/texture fonts?

You could use my library: http://www.opentk.com/project/QuickFont

XZibit's picture
james_lohr wrote:

>>it gives me a slowdown of at least 1000 frames

That is a meaningless measure. It's like saying that if a feather lands on an empty scale, the amount of weight on the scale increases a million fold.

This is important because on a basic framerate of 8k to 9k without multisampling on an empty 800x600 window and a basic framerate of 4k with the string drwan, it is a slowdown of 1/4th.

james_lohr wrote:

>> Has anyone an idea or a better solution to implement bitmap/texture fonts?

You could use my library: http://www.opentk.com/project/QuickFont

I want to have my own implementation and use as less third party software as possible, even because i have some implementations that have to stay in the font itself.

migueltk wrote:

Hi

Recently I had an unpleasant experience with this issue, I discovered that making calls to Drawing.Font.Size and/or Drawing.Font.Height in each frame update significantly diminished the number of frames per second.

I use only Drawing.Point as the origin of translate but i try it out. thank you.

XZibit's picture

Nop, nothing.

It is as slow as before. I still cant imagine what goes wrong.

Is there a way to detect if OpenGL is successfull running and in hardwaremode so that i could figure out that my gc is working correctly?

Edit

I had some idea and worked arround my hw to check the gl properties. My GC supports ATI 3.2.11079 Compatibility Profile Context that means that DisplayLists are out of support. Could it be that DLs were ignored and the geometry is rendered in emidate mode or software-emulated?

Is it more performe to use on texture that holds each character or to use one texture for each character?
Is it more performe to use alphatextures like done in Bixton2D, that has a framerate of 700 in there test app?

james_lohr's picture

>>This is important because on a basic framerate of 8k to 9k without multisampling on an empty 800x600 window and a basic framerate of 4k with the string drwan, it is a slowdown of 1/4th.

No, my analogy still applies: A slowdown of 1/4 when going from an empty window to something with content is meaningless.

It's a simple 1/x relationship, and the change in frame rate that you are describing makes perfect sense. The problem is that you are misunderstanding its meaning.

  • Suppose, when drawing nothing, you're getting an fps of 8k. This means that each frame takes : 0.125 ms
  • Now suppose that it takes 0.5 ms to draw your text.
  • Your new framerate is : 1000 * (1 / (0.5+0.125)) = 1600 fps

You are interpreting this as being extremely slow, but this is not the case. Consider this example:

  • Suppose, when drawing lots of normal content, your framerate is 160 fps (this is much faster than any monitor supports). This means that each frame takes 6.25 ms
  • Now suppose again that it takes 0.5 ms to draw your text.
  • Your new framerate is : 1000 * (1 / (0.5+6.25)) = 148 fps

As you can see, the framerate has decreased from 160 to 148, which is still much faster than any monitor supports and is not a major fps decrease.

XZibit's picture

Hi again,

i did some tests know and find out that the DLs are the Problem and the Solution. Working on ATI HD cards (the one in mine and the one in my freinds win7 x64 pc) with newest drivers supporting OGL 3.2, DLs were nearly als slow as immediate mode in use. Running my code on an nvidia mashine also win7 x64, it runs 10 times faster with 33 ns displaying the two strings.
This may be because DLs seems to be unsupported from OpenGL 3 up.

Some ATI HD Users may confirm this.

james_lohr's picture

Ah sorry, looks like it had nothing to do with what I was blabbing on about. :P