@@ -18,14 +18,14 @@ bindings to the following OpenGL-related libraries:
1818 significant differences between these two, the most prominent being that
1919 GLFW 3 can handle multiple windows. You can set the desired GLFW version
2020 for the binding at compile time.
21- * [ FreeType] [ 19 ] (` FreeTypeAda/freetype.gpr ` ): A library for loading TrueType
22- and OpenType fonts. OpenGLAda includes [ FreeTypeAda] [ 20 ] , a wrapper for the
23- FreeType library. The project ` opengl-text.gpr ` provides an original
21+ * [ FreeType] [ 19 ] (` deps/ FreeTypeAda/freetype.gpr` ): A library for loading
22+ TrueType and OpenType fonts. OpenGLAda includes [ FreeTypeAda] [ 20 ] , a wrapper
23+ for the FreeType library. The project ` opengl-text.gpr ` provides an original
2424 higher-level API for rendering text based on FreeTypeAda.
25- * [ GID] [ 10 ] (` opengl-images .gpr` ): The * Generic Image Decoder* . This is an
25+ * [ GID] [ 10 ] (` deps/gid/gid .gpr` ): The * Generic Image Decoder* . This is an
2626 original Ada library for loading common image formats, which is included in
27- OpenGLAda. The project ` opengl-images.gpr ` provides simple subroutines to
28- generate OpenGL textures with GID.
27+ OpenGLAda. The project ` opengl-images.gpr ` provides an original higher-level
28+ API for generating OpenGL textures with GID.
2929
3030OpenGLAda supports macOS, Windows and X11-based systems. API documentation can
3131be found on the [ project's homepage] [ 4 ] .
@@ -46,12 +46,14 @@ Compared to C, OpenGLAda provides the features of the following C libraries:
4646 * [ Image loading] [ 24 ] : OpenGLAda includes the [ GID] [ 10 ] library for image
4747 loading.
4848
49- ## Windows Installer
49+ ## Building & Installation
5050
51- There is an installer available for Windows + GNAT Community in the
51+ ### Windows
52+
53+ There is an installer available for 64bit Windows + GNAT Community in the
5254[ repository's * releases* section] [ 21 ] which includes all optional dependencies.
5355
54- ## Prerequisites
56+ ### Prerequisites
5557
5658In order to build OpenGLAda, you need to have:
5759
@@ -75,11 +77,11 @@ project and whichever build system you are using. I never used other Ada
7577compilers apart from GNAT, so if I accidentally used some GNAT-specific features
7678in the code, open an issue.
7779
78- ## Installation
80+ ### Installation
7981
8082To install OpenGLAda with all optional libraries, execute
8183
82- $ gprbuild [options] openglada.gpr
84+ $ gprbuild -p [options] openglada.gpr
8385 $ gprinstall [options] openglada.gpr
8486
8587Where * [ options] * is the set of scenario variables you want to use (generally
@@ -119,7 +121,7 @@ in the form of `-X`*name*`=`*value*`). The available variables are:
119121
120122For example, a typical Windows installation would be
121123
122- $ gprbuild -XWindowing_System=windows -Xmode=release openglada.gpr
124+ $ gprbuild -p - XWindowing_System=windows -Xmode=release openglada.gpr
123125 $ gprinstall -XWindowing_System=windows -Xmode=release openglada.gpr
124126
125127Installing OpenGLAda makes its projects available to ` gprbuild ` and also to
@@ -130,7 +132,7 @@ GNAT Studio. You can now import it like this:
130132 with "opengl-text";
131133 -- and so on
132134
133- ** Note:** The projects file ` openglada.gpr ` is just an aggregate project used
135+ ** Note:** The project file ` openglada.gpr ` is just an aggregate project used
134136for installation. In your projects, depend on ` opengl.gpr ` and its child
135137projects.
136138
@@ -162,31 +164,62 @@ Examples are available in [this repository][11].
162164
163165## Developer Documentation
164166
165- OpenGLAda autogenerates its API binding to OpenGL. The autogenerated source
166- files are those in ` src/gl/generated ` and they are generated from the ` *.spec `
167- files in ` src/gl/specs ` . The syntax of the spec files is similar to Ada.
167+ I have written an article about the development of OpenGLAda on AdaCore's blog:
168+
169+ * [ Part 1] [ 25 ]
170+ * [ Part 2] [ 26 ]
171+
172+ ### Binding Generation
173+
174+ OpenGL implementations do not necessarily provide the newest OpenGL version,
175+ but possibly some older one with some functionality of the newer versions
176+ provided as extensions. For OpenGLAda, this means that most OpenGL functionality
177+ cannot be linked against via the library loader, since loading the library
178+ would immediately fail if any function is not available, even if the user never
179+ calls it. Most notoriously, Windows does not provide any OpenGL functionality
180+ newer than 1.1 via library loading.
181+
182+ The remedy for this is that function pointers of newer OpenGL functions must
183+ be queried at runtime. This is a tedious process and similar for each function.
184+ For this reason, OpenGLAda uses a code generator to autogenerate the function
185+ pointer types and the code loading each function, as well as the code importing
186+ OpenGL 1.1 functions via library loading.
168187
169- The reason behind this is that all functionality newer than OpenGL 1.1 is not
170- expected to be provided by the OpenGL implementation. Instead, function pointers
171- to the implementations should be queried at runtime. This makes it possible for
172- the library user to provide a fallback in case some OpenGL functionality is not
173- available on the target system.
188+ The code generator can be found in ` src/generator ` . It processes the files found
189+ in ` src/gl/specs ` and creates the files found in ` src/gl/generated ` . The
190+ generator is a tool used at compile-time for building OpenGLAda and of no
191+ interest to the general user. The generated files are checked in to version
192+ control. The generator also generates the markdown file which is the base for
193+ the [ function mapping list] [ 27 ] on the website.
174194
175- The ` generate ` tool compiled from ` src/generator ` will take care of creating
176- both the API imports from OpenGL and the code for loading the function pointers
177- at runtime. The tool is only necessary when adding OpenGL API functions to
178- OpenGLAda and thus not of interest to the general user, since the autogenerated
179- files are checked in to version control.
195+ The process of wrapping a new OpenGL function is:
180196
181- If you change the ` *.spec ` files, running ` make generate ` afterwards will
182- update the autogenerated files. Be sure to check them in along with the spec
183- changes.
197+ * Add the function specification to one of the ` *.spec ` files in ` src/gl/specs ` .
198+ * Run ` make generate ` , which builds the generator and generates the Ada code.
199+ * Check in the newly generated code along with the changed spec.
200+
201+ The ` *.spec ` files use a syntax similar to Ada.
202+
203+ ### Building the Windows Installer
204+
205+ The Windows installer is generated with the [ WiX Toolset] [ 28 ] . You'll need its
206+ executables ` heat.exe ` , ` candle.exe ` and ` light.exe ` in your ` PATH ` . Executing
207+ the script ` create-msi.ps1 ` in the ` install ` directory containing it will
208+
209+ * download binaries of the GLFW and FreeType libraries
210+ * build OpenGLAda with GNAT
211+ * install OpenGLAda in a temporary directory
212+ * Build an MSI installer that will copy OpenGLAda's binaries as well as the
213+ GLFW and FreeType libraries into the installation directory of a
214+ GNAT Community installation.
184215
185216## License
186217
187- OpenGLAda is distributed under the terms of the [ MIT License] [ 7 ] . The Ada 2012
188- logo that is used in the images tests is distributed under the terms of the
189- [ CC BY-ND 3.0] [ 8 ] license, the original author is [ AdaCore] [ 9 ] .
218+ OpenGLAda, as well as the included libraries FreeTypeAda and GID, are
219+ distributed under the terms of the [ MIT License] [ 7 ] .
220+
221+ The Ada 2012 logo that is used in the images tests is distributed under the
222+ terms of the [ CC BY-ND 3.0] [ 8 ] license, the original author is [ AdaCore] [ 9 ] .
190223
191224 [ 1 ] : http://libre.adacore.com/
192225 [ 2 ] : http://www.adacore.com/gnatpro/toolsuite/gprbuild/
@@ -208,4 +241,8 @@ logo that is used in the images tests is distributed under the terms of the
208241 [ 21 ] : https://github.com/flyx/OpenGLAda/releases
209242 [ 22 ] : http://glew.sourceforge.net/
210243 [ 23 ] : https://www.opengl.org/resources/libraries/glut/
211- [ 24 ] : https://www.khronos.org/opengl/wiki/Image_Libraries
244+ [ 24 ] : https://www.khronos.org/opengl/wiki/Image_Libraries
245+ [ 25 ] : https://blog.adacore.com/the-road-to-a-thick-opengl-binding-for-ada
246+ [ 26 ] : https://blog.adacore.com/the-road-to-a-thick-opengl-binding-for-ada-part-2
247+ [ 27 ] : https://flyx.github.io/OpenGLAda/mapping.html
248+ [ 28 ] : https://wixtoolset.org/
0 commit comments