Beginner demos of meshes, 3D objects and shaders

EDITED: This is where I’ve got to, now.

Starting with a single triangle, I’ve worked up to 3D blocks, clothed in texture or color, and then built a dice to show off several techniques, including using different parts of one image to clothe an object.

This is the final result
http://instagram.com/p/XPlX6OhHZW/

Code here: http://pastebin.com/tcEdk8W5

If you paste it into Codea, do it by holding down the new project button and selecting the paste into project option when it comes up. This ensures the code will split itself correctly into tabs.

The important thing is not how impressive each animation is, but how useful and clear the code is, and I’ve included a lot of explanation in there to help people understand what can be difficult concepts. My own understanding is not far ahead of where I’ve got to, so I’m learning as I go (and kind of explaining to myself).

Nice @ignatz. Ps: you forgot to comment the backup again! You could write this instead:

    if  Backup  then b=Backup("Mesh demo 1.2") end

then no error, and it wotks for you.

See update to initial post above

That was a long demo :). Might want to add that the starry night only works for textures of a base 2 size, otherwise the other code in the thread about it is needed.

I get a whoop bunch of errors about attempts to index various global variables.

That’s funny, it works for me when I paste it. Are you sure you got all the code?

Must not have. Tried again, working now. It’s cool!

I like the demo, it will take some time to work through the code. One more project :wink: