Fun with shaders

While slowly moving toward modernizing the OpenGL used in praxis, I discovered that playing with shaders in OpenGL just requires a few fairly straight-forward function calls, so I’ve added the ability to define and use shaders in praxis.

Version: 445f789

Working directory: syntax2015continued

Program:

dofile("shader.lua")
airplane.followcam = false
loadBuffer("beachball.lua")

Then hit F1 and move the camera over to one of the beachballs in the sky. You can change the definition of the shader in beachball.lua and hit F1 to see the effect. In addition to beachball.lua, there are 2 other example shaders: toyball.lua and checkerboard.lua. These shaders are the example shaders from the book OpenGL SuperBible, 4th Edition.

 

Advertisements

Things to try in praxis

Instead of writing a long blog post for every feature of praxis, blog posts that never seem to get written, I’ll just show you some lines of code you can type into praxis to achieve some fun things.

Since praxis is constantly changing (the prods are at any rate) I’ll also add a link to the commit of praxis these were tested with. Try the latest one first, but failing that, try the linked historical one.


The following is runnable using the latest version of praxis at the time this blog post was written, which is this version.

With your working directory set to syntax2015continued type the following, followed by Ctrl-Enter to execute it:

loadBuffer("grid.lua")

Then hit F1. Hexagons!

Side note: its called syntax2015continuation because its just my continued playing around after working on the Flight of the Spironaut Syntax Party 2015 entry.