All Projects → flyx → OpenGLAda

flyx / OpenGLAda

Licence: MIT license
Thick Ada binding for OpenGL and GLFW

Programming Languages

Ada
118 projects
GLSL
2045 projects

Projects that are alternatives of or similar to OpenGLAda

Kinectazuredkprogramming
Samples about Kinect Azure DK programming
Stars: ✭ 92 (+8.24%)
Mutual labels:  glfw
Webgui
An example demo of IMGUI (Immediate Mode GUI) on the web. Using only WebGL, GLFW and ImGui. Suitable for being compiled to web assembly (WASM).
Stars: ✭ 180 (+111.76%)
Mutual labels:  glfw
Berserk
[WIP] High performance 3D graphics game engine
Stars: ✭ 31 (-63.53%)
Mutual labels:  glfw
Demos
Vulkan API crossplatform demos in Go
Stars: ✭ 103 (+21.18%)
Mutual labels:  glfw
Pyglfw
Python bindings for GLFW
Stars: ✭ 136 (+60%)
Mutual labels:  glfw
Vxr
General purpose engine written in C++ with emphasis on materials rendering (PBR, clear coat, anisotropy, iridescence)
Stars: ✭ 181 (+112.94%)
Mutual labels:  glfw
Glfw.jl
Julia interface to GLFW, a multi-platform library for creating windows with OpenGL contexts and managing input and events.
Stars: ✭ 82 (-3.53%)
Mutual labels:  glfw
glfw.github.io
Jekyll sources for GLFW website
Stars: ✭ 27 (-68.24%)
Mutual labels:  glfw
Bimpy
imgui for python
Stars: ✭ 144 (+69.41%)
Mutual labels:  glfw
Nimgl
NimGL is a Nim library that offers bindings for popular libraries used in computer graphics
Stars: ✭ 218 (+156.47%)
Mutual labels:  glfw
Futureproof
A live editor for fragment shaders, powered by Neovim, WebGPU, and Zig!
Stars: ✭ 117 (+37.65%)
Mutual labels:  glfw
Borealis
Hardware accelerated, controller and TV oriented UI library for PC and Nintendo Switch (libnx).
Stars: ✭ 135 (+58.82%)
Mutual labels:  glfw
Lwjgl3 Tutorial
Tutorial for the Lightweight Java Game Library (LWJGL) 3
Stars: ✭ 199 (+134.12%)
Mutual labels:  glfw
Physics3d
A 3D physics engine
Stars: ✭ 101 (+18.82%)
Mutual labels:  glfw
OpenCLAda
An Ada binding for the OpenCL host API
Stars: ✭ 15 (-82.35%)
Mutual labels:  ada-binding
Bgfx
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
Stars: ✭ 10,252 (+11961.18%)
Mutual labels:  glfw
Flextgl
OpenGL and Vulkan header and loader generator.
Stars: ✭ 180 (+111.76%)
Mutual labels:  glfw
n8engine
An open-source C# game engine that's going to be the best thing ever.
Stars: ✭ 51 (-40%)
Mutual labels:  glfw
ImFrame
dear imgui + glfw framework
Stars: ✭ 86 (+1.18%)
Mutual labels:  glfw
Glslviewer
Console-based GLSL Sandbox for 2D/3D shaders shaders
Stars: ✭ 2,834 (+3234.12%)
Mutual labels:  glfw

OpenGLAda – OpenGL binding for Ada

Project Status: I do not have the time and energy to maintain this project anymore. Both this project and the corresponding Alire crates are unmaintained. I would be okay with someone taking over the project, feel free to contact me about it.

Overview

OpenGLAda is a thick OpenGL binding for the Ada 2005 programming language. Unlike other, thin, bindings (see the project's homepage for a list), OpenGLAda enriches the original API with concepts and features provided by Ada, like object orientation, type safety and generics.

OpenGLAda provides the following libraries:

Library name Alire crate name Description
opengl openglada The OpenGL binding itself
opengl-glfw openglada_glfw GLFW binding
opengl-text openglada_text Text rendering library
opengl-images openglada_images Image loading library

The library name is what you want to with in your .gpr file, e.g. with "opengl-glfw";. The Alire crate is how you refer to the library if you're using Alire, e.g. alr with openglada.

The GLFW binding requires the GLFW library. The Text rendering library requires the FreeType library. The Image loading library uses GID.

The GLFW and FreeType dependencies will be fetched automatically by Alire on Windows, Debian, Ubuntu and Arch Linux. On other systems, you need to make them available to the linker yourself.

OpenGLAda supports macOS, Windows and X11-based systems. API documentation can be found on the project's homepage.

Migrating from C

Compared to C, OpenGLAda provides the features of the following C libraries:

  • OpenGL

  • GLEW: OpenGLAda loads all post-OpenGL 1.1 subroutines dynamically via pointers, so that available features may be queried at runtime.

  • GLUT: Long deprecated, yet still referenced from articles about OpenGL. OpenGLAda provides an optional wrapper for the GLFW library that provides functionality similar to GLUT.

    Text rendering functionality superior to what GLUT provides are supplied by opengl-text.gpr with the help of the FreeType library.

  • Image loading: OpenGLAda includes the GID library for image loading.

Installation

OpenGLAda is designed to be used with the Alire package manager. You can instead install the projects via gprbuild + gprinstall. This needs to be done for each project you want to use.

Scenario Variables

OpenGLAda defines a number of scenario variables. Some are set automatically by Alire, others need to be changed manually with the -X command line parameter (either through alr or grpbuild).

The available variables are:

  • Auto_Exceptions: Configures exception handling:

    • enabled (default): After each call to OpenGL, OpenGLAda checks whether OpenGL has set an error flag and if it had, raises the corresponding exception.
    • disabled: The user has to query the error flag on their own.
  • mode: May take one of the following values:

    • debug (default): Compile the project with debugging symbols and without optimization.
    • release: Compile the project for a release environment.
  • Windowing_System: Automatically set by Alire. Sets the backend windowing system. Used for GLFW and also for system-dependent parts of the API (GLX, WGL, CGL):

    • x11: X Windowing System (Linux, BSD, etc)
    • windows: Microsoft Windows
    • quartz: Quartz Compositor (macOS)
  • GLFW_Linker_Param: Relevant for the GFLW binding. Define how you will link to GLFW. Default is -lglfw everywhere but on Windows with GLFW 3, in which case it is -lglfw3. No need to change this if the GLFW library is loaded via Alire.

  • FreeType_Linker_Param: Automatically set by Alire. Relevant for the text rendering library. Define how you will link to FreeType. Default is -lfreetype.

A typical Windows installation would be

$ cd opengl
$ gprbuild -p -XWindowing_System=windows -Xmode=release opengl.gpr
$ gprinstall -XWindowing_System=windows -Xmode=release opengl.gpr

Tests

The tests in this repository are small programs that are mainly used to check if the basic system is working. You can build them with

$ env GPR_PROJECT_PATH=opengl:opengl-glfw:opengl-images:opengl-text \
      alr build

The tests use Alire for fetching the dependencies, but do not use the Alire projects of the libraries. The Alire workspace for the tests is not meant to be published.

Examples

Examples are available in this repository.

Developer Documentation

I have written an article about the development of OpenGLAda on AdaCore's blog:

Binding Generation

OpenGL implementations do not necessarily provide the newest OpenGL version, but possibly some older one with some functionality of the newer versions provided as extensions. For OpenGLAda, this means that most OpenGL functionality cannot be linked against via the library loader, since loading the library would immediately fail if any function is not available, even if the user never calls it. Most notoriously, Windows does not provide any OpenGL functionality newer than 1.1 via library loading.

The remedy for this is that function pointers of newer OpenGL functions must be queried at runtime. This is a tedious process and similar for each function. For this reason, OpenGLAda uses a code generator to autogenerate the function pointer types and the code loading each function, as well as the code importing OpenGL 1.1 functions via library loading.

The code generator can be found in opengl/src/generator. It processes the files found in opengl/src/specs and creates the files found in opengl/src/generated. The generator is a tool used at compile-time for building OpenGLAda and of no interest to the general user. The generated files are checked in to version control. The generator also generates the markdown file which is the base for the function mapping list on the website.

The process of wrapping a new OpenGL function is:

  • Build the generator using gprbuild generator.gpr in the opengl directory.
  • Add the function specification to one of the *.spec files in opengl/src/specs.
  • Run ./generator in the opengl directory (or generator.exe on Windows), which runs the generator on the specs and generates the Ada code.
  • Check in the newly generated code along with the changed spec.

The *.spec files use a syntax similar to Ada.

License

OpenGLAda, as well as the Ada dependencies FreeTypeAda and GID, are distributed under the terms of the MIT License.

The Ada 2012 logo that is used in the images tests is distributed under the terms of the CC BY-ND 3.0 license, the original author is AdaCore.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].