AGL
A graphics library
|
The following example shows how to enable fog, set colors, and draw different primitives. The properties correspond to uniform variables in the active shader. This example uses per-pixel phong shading, defined here. The full code is here.
To create a dynamic triangle mesh, override agl::TriangleMesh and call agl::Mesh::setIsDynamic. Below, we override the agl::Plane primitive. The full code is here.
The following example overrides agl::PointMesh` to draw a a strange attractor using 400,000 points. The full code is here.
Textures can be loaded using agl::Renderer::loadTexture and passed to the active shader with agl::Renderer::texture.
Textures can be modified from your application. In the following example, the texture changes with the 'up' key. The full code is here.
We can create textures directly from code. Below we draw a checker pattern using the agl::Image class. The full code is here.
The following example shows how primitives using the same shader can each have their texture. The full code is here.
The follow code shows how to load a cubemap using agl::Renderer::texture and agl::Renderer::loadCubemap. The full code is here.
You can write fragment programs that do ray tracing and ray marching – like in shadertoy. Below we draw a quad the faces the camera and has the same dimensions as the window. The scene is then drawn in glsl-raymarch.fs. The application code is here.