How to load FTGLES (or any other text rendering) for Android -
i tasked writing application uses opengl es 1.0 (or 1.1 if necessary) , need able render text on screen. bitmap text , textured fonts aren't choice here. know ios there's ftgles, states android support in "near future", given deadlines on project, need answer (whether works/could work/doesn't work/etc) sooner "the near future" unfortunately.
i've scoured through posts here , other places , haven't found of helps. i've tried using jni , ndk in eclipse, nothing useful has come that. i'd appreciate if can point me in right direction. i've tried jumpcore, application isn't native code, it's written in java. i'm bit surprised hasn't resolved (in fashion have found now). , me find solution this.
edit:
in jni folder, placed source (each in own subfolder) freetype , ftgles. had compile different version of sqlite enable rtree. getting caught because compiling wrong files. proves helpful.
here's make file ftgles portion of native code:
include $(clear_vars) include $(jni_dir)/freetype/android.mk local_path := $(jni_dir) include $(clear_vars) gles_path := $(jni_dir)/include/ ftgl_path := ftgles freetype_path := freetype glu_path := $(ftgl_path)/src/iglu-1.0.0 full_ftgl_path := $(local_path)/$(ftgl_path) full_ft_path := $(local_path)/$(freetype_path) full_glu_path := $(local_path)/$(glu_path) ftgl_include := -i$(full_ftgl_path) -i$(full_ftgl_path)/src -i$(full_ftgl_path)/src/ftgl -i$(full_ftgl_path)/src/ftfont -i$(full_ftgl_path)/src/ftglyph -i$(full_ftgl_path)/src/ftlayout freetype_include := -i$(full_ft_path) -i$(full_ft_path)/include -i$(full_ft_path)/include/freetype -i$(full_ft_path)/include/freetype/config -i$(full_ft_path)/include/freetype/internal -i$(full_ft_path)/include/freetype/internal/services -i$(full_ft_path)/freetype/include/freetype2/freetype -i$(full_ft_path)/freetype/include/freetype2/freetype/config glu_include := -i$(full_glu_path) -i$(full_glu_path)/include -i$(full_glu_path)/libtess -i$(full_glu_path)/libutil -i$(gles_path) ftgl_ftfont_src := $(ftgl_path)/src/ftfont/ftfont.cpp $(ftgl_path)/src/ftfont/ftfontglue.cpp $(ftgl_path)/src/ftfont/ftoutlinefont.cpp $(ftgl_path)/src/ftfont/ftpolygonfont.cpp $(ftgl_path)/src/ftfont/fttexturefont.cpp ftgl_ftglyph_src := $(ftgl_path)/src/ftglyph/ftglyph.cpp $(ftgl_path)/src/ftglyph/ftglyphglue.cpp $(ftgl_path)/src/ftglyph/ftoutlineglyph.cpp $(ftgl_path)/src/ftglyph/ftpolygonglyph.cpp $(ftgl_path)/src/ftglyph/fttextureglyph.cpp ftgl_ftlayout_src := $(ftgl_path)/src/ftlayout/ftlayout.cpp $(ftgl_path)/src/ftlayout/ftlayoutglue.cpp $(ftgl_path)/src/ftlayout/ftsimplelayout.cpp ftgl_src := $(ftgl_path)/src/ftbuffer.cpp $(ftgl_path)/src/ftcharmap.cpp $(ftgl_path)/src/ftcontour.cpp $(ftgl_path)/src/ftface.cpp $(ftgl_ftfont_src) $(ftgl_path)/src/ftgl/ftglesglue.cpp $(ftgl_ftglyph_src) $(ftgl_path)/src/ftglyphcontainer.cpp $(ftgl_ftlayout_src) $(ftgl_path)/src/ftlibrary.cpp $(ftgl_path)/src/ftpoint.cpp $(ftgl_path)/src/ftsize.cpp $(ftgl_path)/src/ftvectoriser.cpp glu_src := $(glu_path)/libtess/dict.c $(glu_path)/libtess/geom.c $(glu_path)/libtess/memalloc.c $(glu_path)/libtess/mesh.c $(glu_path)/libtess/normal.c $(glu_path)/libtess/priorityq.c $(glu_path)/libtess/render.c $(glu_path)/libtess/sweep.c $(glu_path)/libtess/tess.c $(glu_path)/libtess/tessmono.c glu_src2 := $(glu_path)/libutil/error.c $(glu_path)/libutil/glue.c $(glu_path)/libutil/project.c $(glu_path)/libutil/registry.c #debug mode: uncomment , set android:debuggable in manifest true # debugmode_flags := -dself_edit #release mode: comment above line, uncomment below, android:debuggable false debugmode_flags := -dndebug local_module := ftgl local_cflags := -werror -dft2_build_library=1 -dtarget_android $(ftgl_include) $(freetype_include) $(glu_include) $(debugmode_flags) local_src_files := $(ftgl_src) $(glu_src) $(glu_src2) local_ldlibs := -llog -lglesv1_cm -lglesv2 -landroid -legl -lopensles local_static_libraries := freetype2-static include $(build_static_library) include $(clear_vars) local_module := ftgles local_cflags := -werror -dft2_build_library=1 -dtarget_android $(ftgl_include) $(freetype_include) $(glu_include) $(debugmode_flags) local_ldlibs := -llog -lglesv1_cm -lglesv2 -landroid -legl -lopensles local_src_files := ftgleswrapper.cpp local_static_libraries := ftgl freetype2-static include $(build_shared_library)
i don't think need write of wrappers.
take look.
my freetype android.mk file looks this
local_path:= $(call my-dir) include $(clear_vars) local_c_includes += \ $(local_path)/builds \ $(local_path)/include local_src_files:= \ src/base/ftbbox.c \ src/base/ftbitmap.c \ src/base/ftglyph.c \ src/base/ftstroke.c \ src/base/ftxf86.c \ src/base/ftbase.c \ src/base/ftsystem.c \ src/base/ftinit.c \ src/base/ftgasp.c \ src/raster/raster.c \ src/sfnt/sfnt.c \ src/smooth/smooth.c \ src/autofit/autofit.c \ src/truetype/truetype.c \ src/cff/cff.c \ src/psnames/psnames.c \ src/pshinter/pshinter.c \ src/type1/type1.c \ src/cid/type1cid.c \ src/pfr/pfr.c \ src/type42/type42.c \ src/winfonts/winfnt.c \ src/pcf/pcf.c \ src/psaux/psaux.c \ src/bdf/bdf.c \ src/gzip/ftgzip.c \ src/lzw/ftlzw.c local_cflags += -dft2_build_library local_module := freetype local_ldlibs := -ldl -llog include $(build_static_library)
my ftgles android.mk file looks this
local_path := $(call my-dir) include $(clear_vars) local_module := ftgles local_cflags := -i$(local_path)/../freetype/include local_c_includes := $(local_path)/src \ $(local_path)/src/iglu-1.0.0/include local_src_files := \ src/ftbuffer.cpp \ src/ftcharmap.cpp \ src/ftcontour.cpp \ src/ftface.cpp \ src/ftfont/ftbitmapfont.cpp \ src/ftfont/ftbufferfont.cpp \ src/ftfont/ftfont.cpp \ src/ftfont/ftfontglue.cpp \ src/ftfont/ftoutlinefont.cpp \ src/ftfont/ftpixmapfont.cpp \ src/ftfont/ftpolygonfont.cpp \ src/ftfont/fttexturefont.cpp \ src/ftgl/ftglesglue.cpp \ src/ftglyph/ftbitmapglyph.cpp \ src/ftglyph/ftbufferglyph.cpp \ src/ftglyph/ftglyph.cpp \ src/ftglyph/ftglyphglue.cpp \ src/ftglyph/ftoutlineglyph.cpp \ src/ftglyph/ftpixmapglyph.cpp \ src/ftglyph/ftpolygonglyph.cpp \ src/ftglyph/fttextureglyph.cpp \ src/ftglyphcontainer.cpp \ src/ftlayout/ftlayout.cpp \ src/ftlayout/ftlayoutglue.cpp \ src/ftlayout/ftsimplelayout.cpp \ src/ftlibrary.cpp \ src/ftpoint.cpp \ src/ftsize.cpp \ src/ftvectoriser.cpp \ src/iglu-1.0.0/libtess/dict.c \ src/iglu-1.0.0/libtess/geom.c \ src/iglu-1.0.0/libtess/memalloc.c \ src/iglu-1.0.0/libtess/mesh.c \ src/iglu-1.0.0/libtess/normal.c \ src/iglu-1.0.0/libtess/priorityq.c \ src/iglu-1.0.0/libtess/render.c \ src/iglu-1.0.0/libtess/sweep.c \ src/iglu-1.0.0/libtess/tess.c \ src/iglu-1.0.0/libtess/tessmono.c \ src/iglu-1.0.0/libutil/error.c \ src/iglu-1.0.0/libutil/glue.c \ src/iglu-1.0.0/libutil/project.c \ src/iglu-1.0.0/libutil/registry.c local_cflags += -dgl_glext_prototypes -dftgl_library_static local_ldlibs := -ldl -lglesv1_cm -lglesv2 -llog local_static_libraries := freetype include $(build_shared_library)
you may can't find gl.h errors. fix them point right place.
now main android.mk file
local_path := $(call my-dir) include $(clear_vars) local_module := main sdl_path := ../sdl local_c_includes := \ $(local_path)/$(sdl_path)/include \ $(local_path)/../freetype/include \ $(local_path)/../ftgles/src \ ../../../src/testapp local_cflags := \ -dftgl_library_static local_src_files := $(sdl_path)/src/main/android/sdl_android_main.cpp \ ../../../src/testapp/app.cpp local_shared_libraries := sdl2 ftgles local_ldlibs := -lglesv1_cm -llog include $(build_shared_library)
everything compiles , works great. can call c/c++ functions in freetype , ftgles. can not resize fonts however. have thread here.
Comments
Post a Comment