Closed rogermc2 closed 6 years ago
https://sourceforge.net/p/ftgl/bugs/23/ indicates that immediate mode in my OpenGL context cannot work. However, the ftgl_test program does work. I've tried changing most parameters in my Initialize file without success.
I think the solution may be to implement Freetype_GL in Ada. I started my attempt to write suitable bindings. See https://github.com/rougier/freetype-gl
I am aware that the FTGL binding is incomplete. IIRC I did not include bindings for FTGlyph because it depended on portions of the Freetype library which I also would have to wrap if I wanted to provide that interface. I may re-evaluate that if necessary, keep me updated how you're doing with Freetype_GL.
After considerable effort I am unable to make a working implementation of Freetype_GL. The provided Freetype_GL C demos work OK and the code is not difficult to follow. I have tried to implement two of the demos; font and texture. Texture I also tried without using the Freetype_GL rendering routine but using the standard Open_GL process, just using Freetype_GL to try and load the font and associated data. Using the Freetype rendering routine, Vertex_Buffer_Render (Buffer_Ptr, Mode'Enum_Rep), that is, pragma Import (C, Vertex_Buffer_Render, "vertex_buffer_render"), my display code runs once then, on the second iteration, raises an INVALID_VALUE_ERROR exception in Clear_Background_Colour. Freetype_GL shaders are written in an earlier version of GSL than my machine recognizes so I have had to adapt the shaders to version 4.1. If I comment out Vertex_Buffer_Render the exception does not occur. I'm not clear on how to proceed from here. Thanks for any advice offerred.
My version of Texture without using the Freetype_GL rendering routine runs without crashing however, no data is displayed in Texture's window. On each iteration of display, GL.Objects.Programs.Validate_Status returns false with an empty info log. I seem to recall this problem from the past but can't remember the cause or reason. I suspect this version has the best chance for success.
Due to lack of success to date, I now have decided to return to my original example and write wrappers as needed directly to freestyle.
Using freetype wrappers seems the best approach. At least it gives better visibility to the freetype methodology.
SUCCESS at last! I have finally produced a one character example that works using freetype wrappers. Before issuing a PR, I intend to convert as many of the freetype data types to GL types and clean up as much as possible. My freetype solution should be a good candidate for inclusion in your next release.
Definitely! Looking forward to the PR.
So with the recently merged PR, we can close this issue, right?
After considerable effort I remain unable to figure out how to obtain access to bitmap glyph image data:
which I need for:
Image_Address being the address of a bitmapped character glyph. FTGL provides access to necessary character parameters, such as width and height, but doesn't seem to provide access to character glyphs which is available in C++ via the FTGlyphContainer function:
This seems to be an appropriate function for obtaining the glyph of a character for use in a modern OpenGL shader texture which I would like to provide by means of a FTGL function such as
~ function Get_Glyph (char : Character) return System.Address ~The FTGL C interface seems designed only for the deprecated immediate pipeline use. Advice on solving this problem will be greatly appreciated.
The code I am trying to implement is based on https://learnopengl.com/#!In-Practice/Text-Rendering. My initial need is for bitmapped characters. The relevant code is:
I am close to completion but am stopped by my inability to access glyphs.