Skip to content

Commit 7f08bf2

Browse files
committed
Merge branch 'develop'
2 parents 5e6dea5 + ba82e21 commit 7f08bf2

File tree

446 files changed

+9242
-30244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

446 files changed

+9242
-30244
lines changed

CHANGELOG

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
v0.8.0
2+
* __Breaking change__: Removed SOIL since it doesn't compile on macOS Catalina
3+
and replaced it with GID. Added `opengl-images.gpr` to replace SOIL
4+
functionality.
5+
* __Breaking change__: Removed the long-deprecated FTGL binding.
6+
* Fixed the binding of `glGetTransformFeedbackVarying`
7+
* Fixed a bug when creating an empty Depth_Component texture (#135)
8+
* Added package:
9+
- GL.Objects.Queries
10+
* Added missing functionality in:
11+
- GL.Rasterization (glPolygonOffset)
12+
- GL.Objects.Buffers (glDrawTransformFeedback, glDrawTransformFeedbackStream,
13+
glGenTransformFeedbacks, glDeleteTransformFeedbacks,
14+
glBindTransformFeedback, glMapBufferRange,
15+
glFlushMappedBufferRange, glGetBufferSubData)
16+
17+
* Fixed a bug when querying shaders from a program object (#129).
118
v0.7.0:
219
* Added missing functionality in:
320
- GL.Objects.Buffers (glBindBufferBase, glDrawElementsInstanced,

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
GNATFLAGS ?=
22
GLFW_VERSION ?=3
33
GPRBUILD = gprbuild ${GNATFLAGS} -p
4+
GPRINSTALL = gprinstall -p
45

56
WINDOWING_BACKEND := windows
67
GENERATE_EXE := bin/generate.exe

README.md

Lines changed: 102 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,47 @@ 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-
* [SOIL][10] (`opengl-soil.gpr`): The *Simple OpenGL Image Library*. This is a
22-
very tiny library for loading image files into OpenGL textures. It is public
23-
domain. Because it's so tiny, it is linked directly into OpenGLAda. Its
24-
source is included in the OpenGLAda sources.
25-
* [FTGL][11] (`opengl-ftgl.gpr`, **deprecated**): A library built on top of
26-
FreeType that provides an API to load TrueType fonts and render text with
27-
OpenGL. The Ada wrapper only provides basic functionality to load fonts and
28-
render text. As it does not include a wrapper to FreeType, the more low-level
29-
functionality has been excluded. **This wrapper is not maintained anymore in
30-
favor of the new FreeType wrapper.**
31-
* [FreeType][19] (`FreeTypeAda/freetype.gpr`): A library for loading TrueType
32-
and OpenType fonts. OpenGLAda includes [FreeTypeAda][20], a wrapper for the
33-
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
3424
higher-level API for rendering text based on FreeTypeAda.
25+
* [GID][10] (`deps/gid/gid.gpr`): The *Generic Image Decoder*. This is an
26+
original Ada library for loading common image formats, which is included in
27+
OpenGLAda. The project `opengl-images.gpr` provides an original higher-level
28+
API for generating OpenGL textures with GID.
3529

36-
OpenGLAda supports MacOSX, Windows and X11-based systems. API documentation can
30+
OpenGLAda supports macOS, Windows and X11-based systems. API documentation can
3731
be found on the [project's homepage][4].
3832

39-
## Windows Installer
33+
### Migrating from C
4034

41-
There is an installer available for Windows + GNAT Community in the
42-
[repository's *releases* section][21] which includes all optional dependencies
43-
except FTGL (because that binding is deprecated).
35+
Compared to C, OpenGLAda provides the features of the following C libraries:
4436

45-
## Prerequisites
37+
* OpenGL
38+
* [GLEW][22]: OpenGLAda loads all post-OpenGL 1.1 subroutines dynamically via
39+
pointers, so that available features may be queried at runtime.
40+
* [GLUT][23]: Long deprecated, yet still referenced from articles about OpenGL.
41+
OpenGLAda provides an optional wrapper for the GLFW library that provides
42+
functionality similar to GLUT.
43+
44+
Text rendering functionality superior to what GLUT provides are supplied by
45+
`opengl-text.gpr` with the help of the FreeType library.
46+
* [Image loading][24]: OpenGLAda includes the [GID][10] library for image
47+
loading.
48+
49+
## Building & Installation
50+
51+
### Windows
52+
53+
There is an installer available for 64bit Windows + GNAT Community in the
54+
[repository's *releases* section][21] which includes all optional dependencies.
55+
56+
### Prerequisites
4657

4758
In order to build OpenGLAda, you need to have:
4859

4960
* A GNAT compiler¹. Compilers known to work well with OpenGLAda are
50-
[GnuAda][12], [GNAT Community 2018][1], and [TDM-GCC][17]. More information
61+
[GnuAda][12], [GNAT Community 2020][1], and [TDM-GCC][17]. More information
5162
is available on the [GCC website][5].
5263
* [GPRBuild][2] (is bundled with AdaCore's GNAT distribution). TDM-GCC users
5364
can get it from [here][16] (**NOTE: The gprbuild bundled in this zip is
@@ -58,20 +69,19 @@ In order to build OpenGLAda, you need to have:
5869
* An OpenGL implementation (usually comes bundled with your graphics driver)
5970
* Optionally [GLFW][3] (OpenGLAda is pretty useless without the ability to
6071
create an OpenGL context.)
61-
* Optionally [FTGL][11] (**deprecated**)
6272
* Optionally [FreeType][19]
6373

6474
¹: You may also be able to build OpenGLAda with another Ada compiler and/or
6575
without using the `*.gpr` files. You just have to import the sources to your
6676
project and whichever build system you are using. I never used other Ada
6777
compilers apart from GNAT, so if I accidentally used some GNAT-specific features
68-
in the code, please drop me a message.
78+
in the code, open an issue.
6979

70-
## Installation
80+
### Installation
7181

7282
To install OpenGLAda with all optional libraries, execute
7383

74-
$ gprbuild [options] openglada.gpr
84+
$ gprbuild -p [options] openglada.gpr
7585
$ gprinstall [options] openglada.gpr
7686

7787
Where *[options]* is the set of scenario variables you want to use (generally
@@ -82,7 +92,7 @@ in the form of `-X`*name*`=`*value*`). The available variables are:
8292

8393
- `x11`: X Windowing System (Linux, BSD, etc)
8494
- `windows`: Microsoft Windows
85-
- `quartz`: Quartz Compositor (OS X)
95+
- `quartz`: Quartz Compositor (macOS)
8696

8797
* `mode`: May take one of the following values:
8898

@@ -111,18 +121,18 @@ in the form of `-X`*name*`=`*value*`). The available variables are:
111121

112122
For example, a typical Windows installation would be
113123

114-
$ gprbuild -XWindowing_System=windows -Xmode=release openglada.gpr
124+
$ gprbuild -p -XWindowing_System=windows -Xmode=release openglada.gpr
115125
$ gprinstall -XWindowing_System=windows -Xmode=release openglada.gpr
116126

117-
Installing OpenGLAda makes its projects available to `gprbuild` and also to the
118-
GPS GUI. You can now import it like this:
127+
Installing OpenGLAda makes its projects available to `gprbuild` and also to
128+
GNAT Studio. You can now import it like this:
119129

120130
with "opengl";
121131
with "opengl-glfw";
122132
with "opengl-text";
123133
-- and so on
124134

125-
**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
126136
for installation. In your projects, depend on `opengl.gpr` and its child
127137
projects.
128138

@@ -141,51 +151,75 @@ instead:
141151

142152
$ gprbuild -P opengl-glfw-test.gpr -XWindowing_System=windows
143153
$ gprbuild -P opengl-test.gpr -XWindowing_System=windows
154+
$ gprbuild -P opengl-text-test.gpr -XWindowing_System=windows
155+
$ gprbuild -P opengl-images-test.gpr -XWindowing_System=windows
144156

145157
The tests require GLFW, because they need to create windows. By default, they
146158
try to link against GLFW 3+. You can instead build the tests against GLFW 2.x
147-
by executing:
159+
by adding the parameter `-XGLFW_Version=2`.
148160

149-
$ gprbuild -P opengl-test.gpr -XWindowing_System=windows -XGLFW_Version=2
150-
$ gprbuild -P opengl-glfw-test.gpr -XWindowing_System=windows -XGLFW_Version=2
161+
## Examples
151162

152-
(Substitute `windows` with `x11` or `quartz` if needed.)
163+
Examples are available in [this repository][11].
153164

154-
## Examples
165+
## Developer Documentation
155166

156-
OpenGLAda comes bundled with a lot of examples. They have mostly been translated
157-
from C examples from OpenGL textbooks. They are located inside the `examples`
158-
folder. Each example has a separate `.gpr` file with which it can be built.
167+
I have written an article about the development of OpenGLAda on AdaCore's blog:
159168

160-
Contributions of examples are always welcome.
169+
* [Part 1][25]
170+
* [Part 2][26]
161171

162-
## Developer Documentation
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.
187+
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.
163194

164-
OpenGLAda autogenerates its API binding to OpenGL. The autogenerated source
165-
files are those in `src/gl/generated` and they are generated from the `*.spec`
166-
files in `src/gl/specs`. The syntax of the spec files is similar to Ada.
195+
The process of wrapping a new OpenGL function is:
167196

168-
The reason behind this is that all functionality newer than OpenGL 1.1 is not
169-
expected to be provided by the OpenGL implementation. Instead, function pointers
170-
to the implementations should be queried at runtime. This makes it possible for
171-
the user to provide a fallback in case some OpenGL functionality is not
172-
available on the target system.
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.
173200

174-
The `generate` tool compiled from `src/generator` will take care of creating
175-
both the API imports from OpenGL and the code for loading the function pointers
176-
at runtime. The tool is only necessary when adding OpenGL API functions to
177-
OpenGLAda and thus not of interest to the general user, since the autogenerated
178-
files are checked in to version control.
201+
The `*.spec` files use a syntax similar to Ada.
179202

180-
If you change the `*.spec` files, running `make generate` afterwards will
181-
update the autogenerated files. Be sure to check them in along with the spec
182-
changes.
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.
183215

184216
## License
185217

186-
OpenGLAda is distributed under the terms of the [MIT License][7]. The Ada 2012
187-
logo that is used in the SOIL tests is distributed under the terms of the
188-
[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].
189223

190224
[1]: http://libre.adacore.com/
191225
[2]: http://www.adacore.com/gnatpro/toolsuite/gprbuild/
@@ -196,12 +230,19 @@ logo that is used in the SOIL tests is distributed under the terms of the
196230
[7]: COPYING
197231
[8]: http://creativecommons.org/licenses/by-nd/3.0/deed.en_GB
198232
[9]: http://www.ada2012.org/#the_logo
199-
[10]: http://www.lonesock.net/soil.html
200-
[11]: https://sourceforge.net/projects/ftgl/
233+
[10]: https://gen-img-dec.sourceforge.io/
234+
[11]: https://github.com/flyx/OpenGLAda-examples
201235
[12]: https://sourceforge.net/projects/gnuada/files/
202236
[13]: http://flyx.github.io/OpenGLAda/setup.html
203237
[16]: http://getadanow.com/#get_windows
204238
[17]: http://tdm-gcc.tdragon.net/
205239
[19]: https://freetype.org/
206240
[20]: https://github.com/flyx/FreeTypeAda
207-
[21]: https://github.com/flyx/OpenGLAda/releases
241+
[21]: https://github.com/flyx/OpenGLAda/releases
242+
[22]: http://glew.sourceforge.net/
243+
[23]: https://www.opengl.org/resources/libraries/glut/
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/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)