I create a childish engine for an opengl gui.
Abstract classes are ParagraphGL and FontGL and there are many implementations. For instance, for FontGL there is a VectorFontGL implemented with GL_LINES and a TextureFontGL implemented with textures.
ParagraphGL can use any type of FontGL.
Because ParagraphGL doesn’t know nothing about FontGL, it must use the following lines inside FontGL code. This means very often state change.
How this cost the performance?
glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);