Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 27 Apr 2007
Offline Last Active Oct 03 2011 01:35 PM

Posts I've Made

In Topic: Bitmap Fonts performance issue.

31 August 2011 - 03:07 PM

NeHe strikes again.

Bitmap fonts use display lists internally; each character is a single display list (containing only 4 vertexes) and drawing many characters is going to result in many display list calls - in other words it's going to be not much faster than immediate mode. Additionally display lists will have some small overhead of their own, and your driver might just suck at them (an OpenGL driver is just obliged to support display lists - the spec says nothing about doing so efficiently!). Even assuming that your driver doesn't suck at display lists, in order to get value out of them you really need to be pushing a lot of commands and/or data in each list. And like I said, here we're talking about 4 vertexes tops (and who knows what kind of command wglUseFontBitmaps compiles into it's lists?)

There are plenty of ways of getting text onscreen in an OpenGL application, and the right answer depends on whether or not you want anything fancy. A simple 256x256 texture containing the characters in a 16x16 grid, with texture coords to use derived from the character to be drawn is probably the most basic; if you need anything beyond that there are other solutions available.

Thank you for your reply.

I need something simple and fast but preferably to be able to change position, size, color, and not rotate with object.

I think it might be that my driver suck at display list. But I am not in control of what hardware or software end user will have on they machine so something stable working on most of the Windows XP and Windows 7 machines would be good enough for me.

I have Intel HD Graphics 3000 with up to 1696MB total graphics memory
with OpenGL 3.0 if this is any help.

In Topic: Bitmap Fonts performance issue.

31 August 2011 - 02:55 PM

Many games draw text the same way they draw screen-aligned sprites: pack glyph bitmaps into a texture sheet and draw screen-aligned rectangles with appropriate texture coordinates. At a minimum you'll need texture coordinates (u0, v0, u1, v1) for each character, but you'll most likely want a position offset (x, y) so you can cut out empty space around glyph bitmaps and a width (w) so you can compute character positions and string widths more easily.

For text that doesn't change often, you can build a draw list from your text rendering and use that draw list to render text until it changes.

Protip: to ensure texels line up perfectly with pixels, subtract 0.5 from the integer vertex positions. (A half-texel shift compensates for bilinear filtering, but a half-pixel shift compensates for both bilinear filtering and multisampling.)

Thank you for your comment.

By using texture map you loose control over the text and text usually ends up mixing with the images on the screen. I need easy way to write text on the screen with ability to change position, size, color and etc.. and preferably not rotate with the object, for which Bitmap Font is perfect but for unknown reason to me it sacrifices performance.

I tried to using draw list but it didn't show any performance improvement, I am not sure either why it didn't.

Is there any other good implementation of the Bitmap Font which would work faster ? Or anything similar to the Bitmap Font that would work fast?

In Topic: glVertexPointer with vector

31 July 2011 - 10:50 PM

Your vector array would be an array of pointers and glVertexPointer doesn't take an array of pointers, so no, it would not work.

What about if i do it this way ?
vector<SomeClassName> nodes;

In Topic: Eliminating the need to install application

04 April 2011 - 02:40 PM

Thanks for all your responses.

In Topic: Eliminating the need to install application

31 March 2011 - 03:50 PM

Dear ncite

Actually thats what I do right now but this requires Administrative access to the machine and not all the users have that. Which at the same time refutes the title of this topic "Eliminating the need to install the application". In some places it's even required that software would execute without installing and accessing registry.