Re: [PECL-DEV] PHP-GLFW extension on PECL

[email protected] (Thomas Hruska) Fri, 30 Sep 2022 07:47:59 -0700
Newsgroups php.pecl.dev
Message-ID <[email protected]>
On 9/30/2022 2:33 AM, Mario Döring wrote:
> Dear Contributors to the PHP Group,
> 
> Hi, my name is Mario, I've been working with PHP for many years now, and I got specifically interested in bringing real-time graphical capabilities to the language. As available solutions didn't provide what I was looking for, I created a very experimental extension for the GLFW and OpenGL, 4 years ago. About a year ago, I picked it up again and decided to make a "real" extension out of the experiment, and I have been working on it ever since.
> 
> The target of php-glfw is to support most, if possible, the entire OpenGL and GLFW APIs. (Currently, about 90% of the core profile is available)
> 
> The project is for sure still in a beta state, but I'm getting closer and closer to the first release.
> 
> I'm writing this mailing list because I would like to add the extension to the PECL repository sooner or later.
> 
> You can find the Repository right here:
> https://github.com/mario-deluna/php-glfw <https://github.com/mario-deluna/php-glfw>
> 
> Website with documentation here:
> https://phpgl.net/index.html <https://phpgl.net/index.html>
> 
> Thank you for your time
> Kind Regards
> Mario

This is very cool.  The documentation probably needs some work though. 
The example in the main README shows Vec2() as being some sort of 
high-level function, which I was going to complain about needing to be 
namespaced in some reasonable way to avoid naming conflicts but looking 
at the source code shows \GL\Math\Vec2.  Also, the "draw your first 
triangle" tutorial is, well, missing the tutorial.

There is one downside to using PHP w/ OpenGL:  PHP, by its nature, is a 
single-threaded language.  Most software that uses OpenGL also uses 
multithreading to offload the heavy lifting bits so as to not lag the 
main loop and miss input.  Not much can be done about that as the 
multithreading extension attempts to date tend to destabilize the core 
language.

If there's one thing that I think many people might be more immediately 
interested in is the ability to render in OpenGL and capture onto a PHP 
GD-compatible image and maybe later a ffmpeg extension render pipeline. 
The ability to render and capture 3D in a windowless server environment 
would open up a lot of possibilities.  There already exist some virtual 
server environments out there that have physical GPU hardware available 
as an option.

-- 
Thomas Hruska
CubicleSoft President

CubicleSoft has over 80 original open source projects and counting.
Plus a couple of commercial/retail products.

What software are you looking to build?