glReadPixels with Xvfb

↓ my code released.

What made I go 3D programming with PHP ?
Because a PHP is there !
I'm repeating trial and error, now.

Xvrb & libgl

# apt-get install xvfb
% export DISPLAY="localhost:1.0" 
% /usr/X11R6/bin/Xvfb :1 -screen 0 1024x768x24 &
% sudo /etc/init.d/apache2 restart

glReadPixels

call display and exit, without callback.

// glutDisplayFunc('display');
 display(); exit(0);
//
  • execute.
% php saveimage.php
  • result


what's merit?

We can save to 3D graphics image without opening window.
so runnable as web backend, maybe.

These days, smartphone is main platform.
It is obvious that 3D programming with WebGL.

But, I dare to take this step because I love PHP.