- 1. Hello World
- 2. 3D Cube
- 3. Textured Cube
- 4. Instanced Rendering
- 5. Object file loading
- 6. Simple lighting
- 7. Text Rendering
- 8. Input And Events
This is the most basic example of how to use the GLFW library. You can think of it as a ""Hello World"" example. In this example, we create a window and render a triangle.
This example does not utilize our helper class to keep it as basic as possible.
Code: 01_triangle.php!
This example shows how to render a 3D cube using PHP OpenGL.
Code: 02_3D_cube.php!
s.mov
This example shows how to render a textured cube using PHP OpenGL. It provides an example of how to load a texture from a file and how to use it in a shader using the PHP-GLFW GL\Texture\Texture2D
class.
Code: 03_textured_cube.php!
s.mov
This example shows how to render multiple instances of a single object using PHP OpenGL. It is just a basic example of how to use instanced rendering.
Code: 04_instancing.php!
s.mov
This example shows how to load a 3D object from a file using PHP OpenGL. It displays how to utilize the \GL\Geometry\ObjFileParser
class to load a 3D object from a file and how to render it.
Code: 05_objloading.php!
This example shows how to render a 3D object with simple lighting using PHP OpenGL.
Code: 06_basic_light.php!
This example shows how to render text using PHP OpenGL. It uses a simple bitmap font to render text on the screen.
Code: 07_text_rendering.php!
This example shows how to handle input and events using PHP OpenGL. It implements all available input and window event callbacks and prints them to the console.
Code: 08_input_and_events.php!