PHPackages                             microscrap/open-gl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. microscrap/open-gl

ActiveLibrary[Framework](/categories/framework)

microscrap/open-gl
==================

OpenGL Bindings for The PHP OpenGL Extension

0.7.0(yesterday)02↑2900%1MITPHPPHP ^8.3CI passing

Since Aug 9Pushed yesterdayCompare

[ Source](https://github.com/microscrap/open-gl)[ Packagist](https://packagist.org/packages/microscrap/open-gl)[ Docs](https://scrapyard-io.projectsaturnstudios.com/ecosystem/microscrap/open-gl/0.7.x/overview)[ RSS](/packages/microscrap-open-gl/feed)WikiDiscussions 0.7.x Synced today

READMEChangelogDependencies (1)Versions (3)Used By (1)

microscrap/open-gl — OpenGL bindings for PHP
============================================

[](#microscrapopen-gl--opengl-bindings-for-php)

> **Docs (production):** [ScrapyardIO · microscrap/open-gl 0.7.x](https://scrapyard-io.projectsaturnstudios.com/ecosystem/microscrap/open-gl/0.7.x/overview)

[![Docs](https://camo.githubusercontent.com/cd313d3106c9f770f89a71a619c70bdb7376fef60b4e2119249d27851c2f3617/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d536372617079617264494f2d3065613565393f6c6f676f3d72656164746865646f6373266c6f676f436f6c6f723d7768697465)](https://scrapyard-io.projectsaturnstudios.com/ecosystem/microscrap/open-gl/0.7.x/overview)[![CI](https://github.com/microscrap/open-gl/actions/workflows/tests.yml/badge.svg?branch=0.7.x)](https://github.com/microscrap/open-gl/actions/workflows/tests.yml)[![Packagist Version](https://camo.githubusercontent.com/876f25b5146a33faa2f34ae8683bfddc91c79668babe55de8683d4462ff6bc06/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6963726f73637261702f6f70656e2d676c2e7376673f6c6162656c3d7061636b6167697374)](https://packagist.org/packages/microscrap/open-gl)[![PHP Version Require](https://camo.githubusercontent.com/2b188015f697a16b913382dbad283d4d05a66376eaf32fa76026c00cfb98b52e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d6963726f73637261702f6f70656e2d676c2e737667)](https://packagist.org/packages/microscrap/open-gl)[![License: MIT](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)[![Requires ext-opengl](https://camo.githubusercontent.com/29e87dcc0a5f191680604581b2dfd77ede6f7dc6fd734c6b66d3614d086a152e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6578742d2d6f70656e676c2d253545302e372d3737376262343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://github.com/php-io-extensions/open-gl)[![Tests](https://camo.githubusercontent.com/bbf3f911bfa000513c073b549c5f0bfef31c5e03721d5b6e7fa2474f4deffefd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d506573742d3935423436413f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://pestphp.com)

PHP library that wraps the [**open-gl**](https://github.com/php-io-extensions/open-gl) extension (`ext-opengl`) with global helpers, enums, and a static wrapper class. Every helper delegates to `Microscrap\Bindings\OpenGL\GL`, which is the only layer that calls `Opengl\GL\GL`.

Token constants from the OpenGL SDK (`GL_COLOR_BUFFER_BIT`, …) live here as backed PHP enums — the native extension does not expose them.

This is the **bindings** package — not the native extension. Ecosystem docs: [`0.7.x`](https://scrapyard-io.projectsaturnstudios.com/ecosystem/microscrap/open-gl/0.7.x/overview).

Highlights
----------

[](#highlights)

- Two calling styles — exact C names (`glClearColor(...)`) or static wrapper (`GL::clearColor(...)`)
- Named objects stay as extension DTOs (`Opengl\GL\GlBuffer`, `GlTexture`, `GlShader`, `GlProgram`) with public `fd`
- Enum layer transcribed from the OpenGL SDK / `gl.h` for the slice-1 API surface
- C-style error handling: no exceptions in `src/`; details via `glGetError()`
- Coverage drift + style audit Pest guards keep the wrap 1:1 with the extension

Requirements
------------

[](#requirements)

- PHP 8.3+
- **ext-opengl** ^0.7.0 — install from [php-io-extensions/open-gl](https://github.com/php-io-extensions/open-gl)
- A current OpenGL context from **glfw** or **sdl3** before draw calls succeed

Installation
------------

[](#installation)

Confirm **ext-opengl** is loaded:

```
php -m | grep opengl
```

```
composer require microscrap/open-gl
```

Composer autoloads helper files in `src/Helpers/`, registering global `gl*` functions when the package is installed. Helpers are only defined if the name is not already taken (`function_exists` guard).

> **Note:** `microscrap/glfw` also defines a small subset of `gl*` helpers for visual proofs. Prefer this package as the canonical OpenGL binding; load order decides which definition wins under the guard.

The two calling styles
----------------------

[](#the-two-calling-styles)

**C-ish** — global functions with exact OpenGL C / extension names:

```
use Microscrap\Bindings\OpenGL\Enums\ClearBufferMask;
use Microscrap\Bindings\OpenGL\Enums\StringName;

glClearColor(0.1, 0.1, 0.12, 1.0);
glClear(ClearBufferMask::GL_COLOR_BUFFER_BIT);
echo glGetString(StringName::GL_VERSION);
```

**OO-ish** — static wrapper class, same behavior:

```
use Microscrap\Bindings\OpenGL\GL;
use Microscrap\Bindings\OpenGL\Enums\ClearBufferMask;
use Microscrap\Bindings\OpenGL\Enums\StringName;

GL::clearColor(0.1, 0.1, 0.12, 1.0);
GL::clear(ClearBufferMask::GL_COLOR_BUFFER_BIT);
echo GL::getString(StringName::GL_VERSION);
```

Helpers never touch the extension directly; they delegate one-to-one to `GL`, which is the only layer calling `Opengl\GL\GL`. Flag/enum parameters take `EnumType|int`.

### Name transforms

[](#name-transforms)

- Wrapper methods drop the `gl` prefix: `glClearColor` → `GL::clearColor()`.
- Helpers use the exact extension method name (`glClearColor()`, `glUseProgramNone()`).

Wrapper surface (0.7.0)
-----------------------

[](#wrapper-surface-070)

ClassWrapsMethods`GL``Opengl\GL\GL`full slice-1 draw API (state, immediate mode, buffers, textures, shaders/programs, draw)Enums
-----

[](#enums)

EnumPurpose`ClearBufferMask``glClear` bitfield`EnableCap``glEnable` / `glDisable``StringName``glGetString``GetPName``glGetIntegerv``PrimitiveMode``glBegin` / `glDrawArrays``MatrixMode``glMatrixMode``BufferTarget` / `BufferUsage`buffer binds &amp; uploads`TextureTarget` / `TextureParameterName` / `TextureParameter`texture state`ShaderType``glCreateShader``ErrorCode``glGetError` valuesTesting
-------

[](#testing)

```
composer install --ignore-platform-req=ext-opengl
./vendor/bin/pest
```

CI runs the same suite on PHP 8.3–8.5 (coverage uses the committed extension method snapshot when `ext-opengl` is not loaded).

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance100

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10563160?v=4)[Angel Gonzalez](/maintainers/projectsaturnstudios)[@projectsaturnstudios](https://github.com/projectsaturnstudios)

---

Top Contributors

[![projectsaturnstudios](https://avatars.githubusercontent.com/u/10563160?v=4)](https://github.com/projectsaturnstudios "projectsaturnstudios (3 commits)")

---

Tags

frameworkbindingsopenglscrapyard-io

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/microscrap-open-gl/health.svg)

```
[![Health](https://phpackages.com/badges/microscrap-open-gl/health.svg)](https://phpackages.com/packages/microscrap-open-gl)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
