Giter Site home page Giter Site logo

phpopengl's Introduction

PHP-OpenGL

PHP bindings of the OpenGL and GLUT libraries.

Not all of the previously mentioned API is available on this extension. In order to keep the code small, maintainable and hopefully less buggy, it was decided to support only these subsets:

  • OpenGL: All but the functions that are part of the compatibility profile. (glRotate, glBegin, glLight, ...). Compatibility profile usage is discouraged in other platforms and this extension only let you use the modern (core) GL profile.
  • GLUT: Only the API related to window management, input handling and main loop are available. Other functions (such as the one to render popup menus) are not available for the same reasons given before.

Requirements

  • PHP7
  • OpenGL and FreeGLUT libraries
  • Linux/MacOS (Windows support coming soon)

Installation

Linux

pecl install phpopengl

Or

git clone git://github.com/phpopengl/extension.git --recursive phpopengl
cd phpopengl
phpize
./configure --enable-opengl
make
sudo make install
echo extension=opengl.so | sudo tee /etc/php5/conf.d/opengl.ini

Examples

<?php
glutInit($argc, $argv);

glutInitWindowSize(800, 600);
glutInitWindowPosition(300, 100);
glutCreateWindow('Basic PHP-OpenGL example');

echo glGetString(GL_VENDOR), PHP_EOL;
echo glGetString(GL_RENDERER), PHP_EOL;

glutDisplayFunc(function() {
    glClearColor(0, 0, .2, 1); 
    glClear(GL_COLOR_BUFFER_BIT);
    glutSwapBuffers();
});
glutMainLoop();

License

GPL-3.0+

phpopengl's People

Contributors

santiagolizardo avatar yogarine avatar

Watchers

James Cloos avatar Tuğca Eker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.