https://github.com/feenkcom/gtoolkit-gleam
C wrapper around OpenGL bindings for Servo
https://github.com/feenkcom/gtoolkit-gleam
Last synced: 5 months ago
JSON representation
C wrapper around OpenGL bindings for Servo
- Host: GitHub
- URL: https://github.com/feenkcom/gtoolkit-gleam
- Owner: feenkcom
- License: mit
- Created: 2019-12-06T09:45:37.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-12-12T18:26:00.000Z (over 2 years ago)
- Last Synced: 2023-12-13T19:15:35.728Z (over 2 years ago)
- Language: Smalltalk
- Size: 344 KB
- Stars: 1
- Watchers: 12
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GToolkit-Gleam
Pharo bindings for [Gleam](https://github.com/servo/gleam) - OpenGL bindings and wrapper for Servo.
## Installation
```smalltalk
EpMonitor current disable.
[
Metacello new
baseline: 'GToolkitGleam';
repository: 'github://feenkcom/gtoolkit-gleam/src';
load
] ensure: [ EpMonitor current enable ].
```
## Getting started
`Gleam` is not responsible for OpenGL context creation. Instead, it is a wrapper that unifies OpenGL and OpenGles APIs.
Users are expected to use other libraries to create an OpenGL context and then wrap with `Gleam`.
Let's see an example:
```smalltalk
"users creates a context as she wishes"
context := self createContext.
"a context must be valid and be made current"
context makeCurrent.
"Gleam wraps OpenGL functions by loading OpenGL functions by their name"
gl := GtGleamGL loadGl: [ :aSymbol | context getProcAddress: aSymbol ].
"Now we are ready to draw"
gl clear_color: Color red.
gl clear: gl GL_COLOR_BUFFER_BIT.
"once rendering is completed swap buffers to display on the screen"
context swapBuffers.
```