Hi, I'm using LWJGL3 build 87 and using STBTruetype.stbtt_MakeCodepointBitmapSubpixel to build a character atlas. I know stbtt_BakeFontBitmap exists, but I have positioning requirements that aren't covered by it and no matter, I should be able to use stbtt_MakeCodepointBitmapSubpixel to draw glyphs to my atlas.
I try to draw a few dozen glyphs and encounter three problems.
First after drawing 20 or so glyphs, stbtt_MakeCodepointBitmapSubpixel fails to write anything. I ran a test where I draw each glyph to tiny image and use STBImageWrite.stbi_write_png to save the intermediate results. After a certain point, all subsequent glyphs render as black images.
Second, I notice that stbtt_GetGlyphBitmapBox returns a strange value for y0 starting with the glyphs that fail to draw. This results in incorrect atlas placement. I'm not sure if this is related, but I felt that I should include it.
Third, randomly I get SIGSEGV errors when calling stbtt_MakeCodepointBitmapSubpixel during this process.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007effcc06a6dd, pid=13748, tid=139638580479744
#
# JRE version: Java(TM) SE Runtime Environment (8.0_25-b17) (build 1.8.0_25-b17)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.25-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libjemalloc.so+0xb6dd
The stack looks like this
Stack: [0x00007f0023ec8000,0x00007f0023fc9000], sp=0x00007f0023fc5270, free space=1012k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libjemalloc.so+0xb6dd]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.lwjgl.stb.STBTruetype.nstbtt_MakeCodepointBitmapSubpixel(JJIIIFFFFI)V+0
j org.lwjgl.stb.STBTruetype.stbtt_MakeCodepointBitmapSubpixel(Lorg/lwjgl/stb/STBTTFontinfo;Ljava/nio/ByteBuffer;IIIFFFFI)V+35
j zaffre.font$char_image.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+358
If I use this jvm arg "-Dorg.lwjgl.system.allocator=system
, then I get this error (again randomly) instead
*** Error in `java': double free or corruption (out): 0x00007f29659cb580 ***
Is there any more information that I can provide that would help in finding what I could be doing wrong? Any caveats on calling these methods?