PHP code example of ponup / glm

1. Go to this page and download the library: Download ponup/glm 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/ */

    

ponup / glm example snippets




lm\vec3;
use glm\mat4;

$matrix = new mat4; // 4x4 identity matrix

echo $matrix, PHP_EOL;
// Output: mat4x4((1.000000, 0.000000, 0.000000, 0.000000), (0.000000, 1.000000, 0.000000, 0.000000), (0.000000, 0.000000, 1.000000, 0.000000), (0.000000, 0.000000, 0.000000, 1.000000))

echo $matrix->scale(5), PHP_EOL;
// Output: mat4x4((5.000000, 0.000000, 0.000000, 0.000000), (0.000000, 5.000000, 0.000000, 0.000000), (0.000000, 0.000000, 5.000000, 0.000000), (0.000000, 0.000000, 0.000000, 1.000000))