UIKit vs OpenGL for 2d hex strategy game

Member
Posts: 166
Joined: 2009.04
Post: #16
I do use freetype (statically linked ) to generate required bitmaps during runtime and to calculate everything required for proper spacing/kerning.

It was a bit of a pain to get it right but now it works essentially as any GUI based text rendering.
The downside is that I have to have the font I am using included with the app which means I can only use free fonts.
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #17
Oh man, it's different per font? Great. Wow, you probably have to go into the file and parse through the format to find that information. With a bitmap font, you may not have that font on your system. Yucky.

Well, thanks again Jake!
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #18
AnotherJake Wrote:I don't think you understood me. If you are drawing 500 characters of bitmapped font, you'll have 500 quads vs. 1 for the equivalent Quartz rendered texture. There is simply no possible way you can tell me that drawing 500 quads is faster than drawing 1 (assuming same size of text). The difference being that the Quartz rendered texture is only rendered once, at the expense of how long it takes Quartz to render into that texture vs. the bitmapped font is already rendered and you're just putting up a texture for each character. If you don't change your Quartz texture very often, it will smoke the equivalent bitmapped font string.

True, but with just a couple of labels rendered on the screen it makes no difference ... where it does make a difference if you are rendering pages worth of text (scrollable text). In this scenario I found OpenGL based rendering to be faster.
Also, with OpenGL I can easily and with almost no performance degradation apply all kinds of fancy effect (blending modes, vertex based coloring ) etc ..
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #19
warmi Wrote:True, but with just a couple of labels rendered on the screen it makes no difference ... where it does make a difference if you are rendering pages worth of text (scrollable text).
... that's what I said, under the "Bitmap font cons":
Quote:so the amount of text will greatly affect performance at some point

It greatly depends on how much text you're rendering as to whether you'll suffer a significant performance penalty or not. At some point you'll be drawing a *lot* of quads, and that will noticeably affect frame rate. In no way did I point that out to suggest that the bitmap font approach was inherently bad -- I use it all the time myself!

warmi Wrote:In this scenario I found OpenGL based rendering to be faster.
Also, with OpenGL I can easily and with almost no performance degradation apply all kinds of fancy effect (blending modes, vertex based coloring ) etc ..

Well, you can change the blend modes with a single texture too, but no, generally it's not easy to apply effects to the single texture approach unless you're willing to modify the pixel buffer before upload to the GL (or you could do FBO effects I suppose). Again, as I said under the "Rendered Quartz to texture cons":

Quote:can't easily apply effects like you'd get from Photoshop

Plus there are hybrid approaches too. My bitmap font library allows me to use loaded bitmap textures as a source for software rendering the characters into a single OpenGL texture; like Quartz or FreeType, except I do the rendering to the texture myself.

And then there is yet another approach, which is to use OpenGL geometry to make shaded (or not filled I suppose) polygons of characters (outline fonts I guess is the term). I don't do this, but ingemar has a recent thread around here somewhere in which he describes what he's doing with that.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Online Multiplayer Strategy Game Seeking Testers fstltna 0 1,075 Dec 23, 2013 01:19 AM
Last Post: fstltna
  Mixing OpenGL & UIKit and UIView drawing... Fraggle 7 9,504 Feb 3, 2009 05:05 AM
Last Post: ozirus