Hi,
My name is Andrei Petrovici.
First of all I want to thank you for your effort in maintaining
freetype-gl.
I am currently using Marmalade for mobile development. They have many
blocks to develop applications but for various reasons i want to use
plain OpenGL in my game engine.
I looked all over for simple "font" libraries (non stl dependencies
etc). I had only 2 final candidates: freetype-gl and fontstash.
Freetype-gl is outstanding because it has one major advantage: vertex-
buffer (utility) is well designed outside the library and can easily
be replaced by our own classes.
Not to mention that it is enough to have texture-font ant texture-
atlas to run demo-font.
I must tell you that I have tested freetype-gl before may 7 release
(Big code cleanup and API documentation added), so please discard
obsolete stuff.
I will test as soon as possible this version but I wanted to tell you
my first humble remarks:
1. Because Marmalade SDK allows me to build on visual studio c/c++
compiler and gcc compiler I found some annoying problems on visual c/c+
+ compiler on assert(...) in c functions.
Please see
http://stackoverflow.com/questions/705502/why-does-microsofts-c-compiler-want-the-variables-at-the-beginning-of-the-funct.
I solved by renaming .c files in .cpp files.
2. Microsoft compiler has problems on void pointer arithmetic (errors
actually) .gcc uses 1 in pointer arithmetic for void* by default. So I
had to explicitly use char* or byte* to resolve this minor problem
(see vector.items, vertex_buffer.pointer).
3. I think that opengl include block (gl.h etc) should be defined in
separate .h file to be modified easily ( I have to use OpenGL ES
version.Please see
http://www.khronos.org/registry/gles/)
4. in vector.cpp I found a little bit strange the capacity increase in
vector_insert: 2 * previous capacity ( I think an upper define for
increase factor (2) will be more manageable).
5. it is a good thing that strndup in vertex_buffer_new it has a
backup version because i didn't find this function in my limited
development sdk.
6. Regarding the well designed vertex_buffer class I think that an
USE_GLES(FTGL_GLES) kind of define will be useful because on gles we
dont have:
GL_FOG_COORD_ARRAY, GL_SECONDARY_COLOR_ARRAY, GL_EDGE_FLAG_ARRAY
(glFogCoordPointer, glEdgeFlagPointer,glSecondaryColorPointer)
GL_DOUBLE, GL_INT
7. I thing it will be useful to define index data type. On OpenGL ES
it should be used ushort vs uint for index data.
8. In my version buffer_delete forgot to free self->attributes.
All the above were relative easy to adjust in my "environment" even
that I am a little bit rusty at using c/c++.
May I ask why have you chosen c vs c++?
I tested the result on Android phones (different os versions) and I
have found one strange and big problem in vertex buffer object
implementation.
If data is uploaded with glBufferData on dirty data, it leaks the
buffers on opengl side. So I finally found that calling glBufferData
on construction and uploading glBufferSubData is the perfect android
OpenGL ES way.
Thank you for reading this.
Keep up the good work.