1. Go to this page and download the library: Download microscrap/glfw library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
microscrap / glfw example snippets
use Microscrap\Bindings\GLFW\Enums\TrueFalse;
use Microscrap\Bindings\GLFW\Enums\WindowHint;
glfwInit();
glfwWindowHint(WindowHint::GLFW_VISIBLE, TrueFalse::GLFW_FALSE->value);
$window = glfwCreateWindow(640, 480, 'hello');
glfwDestroyWindow($window);
glfwTerminate();
use Microscrap\Bindings\GLFW\Init;
use Microscrap\Bindings\GLFW\Window;
use Microscrap\Bindings\GLFW\Enums\TrueFalse;
use Microscrap\Bindings\GLFW\Enums\WindowHint;
Init::init();
Window::windowHint(WindowHint::GLFW_VISIBLE, TrueFalse::GLFW_FALSE->value);
$window = Window::createWindow(640, 480, 'hello');
Window::destroyWindow($window);
Init::terminate();
use Microscrap\Bindings\GLFW\Enums\TrueFalse;
use Microscrap\Bindings\GLFW\Enums\WindowHint;
glfwInit();
glfwWindowHint(WindowHint::GLFW_VISIBLE, TrueFalse::GLFW_FALSE->value);
$window = glfwCreateWindow(320, 240, 'demo');
if (is_null($window)) {
[$code, $description] = glfwGetError();
throw new RuntimeException($description ?: "glfw error {$code}");
}
while (! glfwWindowShouldClose($window)) {
glfwPollEvents();
glfwSetWindowShouldClose($window, TrueFalse::GLFW_TRUE->value);
}
glfwDestroyWindow($window);
glfwTerminate();
use Microscrap\Bindings\GLFW\Context;
use Microscrap\Bindings\GLFW\GL;
use Microscrap\Bindings\GLFW\Init;
use Microscrap\Bindings\GLFW\Window;
use Microscrap\Bindings\GLFW\Enums\ClearBufferMask;
Init::init();
$window = Window::createWindow(640, 480, 'clear');
Context::makeContextCurrent($window);
GL::clearColor(0.1, 0.2, 0.3, 1.0);
GL::clear(ClearBufferMask::GL_COLOR_BUFFER_BIT);
Context::swapBuffers($window);
Window::destroyWindow($window);
Init::terminate();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.