Download the PHP package microscrap/open-gl without Composer
On this page you can find all versions of the php package microscrap/open-gl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download microscrap/open-gl
More information about microscrap/open-gl
Files in microscrap/open-gl
Package open-gl
Short Description OpenGL Bindings for The PHP OpenGL Extension
License MIT
Homepage https://scrapyard-io.projectsaturnstudios.com/ecosystem/microscrap/open-gl/0.7.x/overview
Informations about the package open-gl
microscrap/open-gl — OpenGL bindings for PHP
Docs (production): ScrapyardIO · microscrap/open-gl 0.7.x
PHP library that wraps the 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.
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 publicfd - Enum layer transcribed from the OpenGL SDK /
gl.hfor the slice-1 API surface - C-style error handling: no exceptions in
src/; details viaglGetError() - Coverage drift + style audit Pest guards keep the wrap 1:1 with the extension
Requirements
- PHP 8.3+
- ext-opengl ^0.7.0 — install from php-io-extensions/open-gl
- A current OpenGL context from glfw or sdl3 before draw calls succeed
Installation
Confirm ext-opengl is loaded:
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/glfwalso defines a small subset ofgl*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
C-ish — global functions with exact OpenGL C / extension names:
OO-ish — static wrapper class, same behavior:
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
- Wrapper methods drop the
glprefix:glClearColor→GL::clearColor(). - Helpers use the exact extension method name (
glClearColor(),glUseProgramNone()).
Wrapper surface (0.7.0)
| Class | Wraps | Methods |
|---|---|---|
GL |
Opengl\GL\GL |
full slice-1 draw API (state, immediate mode, buffers, textures, shaders/programs, draw) |
Enums
| Enum | Purpose |
|---|---|
ClearBufferMask |
glClear bitfield |
EnableCap |
glEnable / glDisable |
StringName |
glGetString |
GetPName |
glGetIntegerv |
PrimitiveMode |
glBegin / glDrawArrays |
MatrixMode |
glMatrixMode |
BufferTarget / BufferUsage |
buffer binds & uploads |
TextureTarget / TextureParameterName / TextureParameter |
texture state |
ShaderType |
glCreateShader |
ErrorCode |
glGetError values |
Testing
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
MIT — see LICENSE.
All versions of open-gl with dependencies
ext-opengl Version ^0.7.0