Codea 1.5 Beta

Hi Beta Testers.

Build 1 of Codea 1.5 is uploading now. It’s still a bit rough around the edges. More example projects are coming, and it’s still missing some documentation, but most of the new features are included.

I’ve set up a small introduction to shaders, here:

(Note that the new documentation search and “related” links are not yet working.)

I’m looking forward to hearing what your impressions.

Woot! Something to mess with this weekend.

.@AndrewStacey me too — the X at the bottom will be coming back. Is Z-buffer broken? I’ll look into it.

Nice! And a Tween library also, will be interesting to try out!

Finished reading the docs - can’t wait to try this. It looks like you “did it right” - I have a grin on my face ear-to-ear; the Camera support was icing on the cake. (How do you pick which camera?)

PS. Working on my 3rd gen ipad. Good example app. TIme to dig. I’m wondering how I’m going to get my real work done today - I may have to “put this away” for a few hours to avoid distraction.

PPS. Answering my own question - cameraSource(). W00t!

What’s happened to my z-ordering on my meshes? The triangles seem to be being drawn in the order of specification. Do I need to explicitly set a shader or something?

I miss the X at the bottom left when the keyboard isn’t there. The arrow at top right is too small for my fat fingers.

Yippee on the X.

Yes, the z-buffer is definitely broken. I’ve just tried it with the code from my martrices blog post and the squares are drawn in order of definition, which looks really weird when rotating a cube!

That’s odd, the 3D Lab example still works for me and that relies on the z-buffer. Does it break for you too?

Narrowed it down to setContext. If I put a setContext(img) somewhere then it breaks the z-buffering for subsequent draws.

-- end of setup
    nf = 0

-- start of draw
function draw()
    nf = nf + 1
    if nf == 120 then
        img = image(100,100)

then z-buffering suddenly turns off.

In other news, the camera is awesome! I have a picture sliding puzzle game and I added it in so you can take a picture to do the puzzle with.

Thanks for finding that, Andrew! That’s a big help.

That’s why they call it beta!

Pages 3 and 4 of this are handy:

So - I feel like Barbie: “GLSL is hard”.

but - that’s good. That’s why it’s fun.

Most of the examples I look at online seem to have the model, view, and projection matrices passed as seperate entities. But - in the vertex shader in Codea, it’s passing ( model * view * projection ). This is puzzling to me. Is this an OpenGL ES 2.0 thing? (it doesn’t seem to be - but my selection so far of working ipad shader stuff is small).

I am thinking that maybe, perhaps, the whole “normalize and clip and present” is already present in Codea itself, and so we don’t do it? We would, presumably, do similar shenanigans by how we set up the mesh we’re embedding the shader in - no?

What I’m trying is to make a simple model (a cube would be fine) and light it. Don’t tell me how! (yet) - This is how I learn. But if there’s still some missing element, let me know. :slight_smile:

It’s faster to do the multiplication once, on the CPU than to do modelviewprojection for every vertex.

You can however create custom uniforms for those matrices in your shader and set them in Codea:

MyShader.modelMatrix = modelMatrix()

Edit: To do lighting you will need to use a normal attribute. The intention is to have this link automatically to mesh normals, but I’m not sure if @John has implemented that yet. You can use custom attribute array by using the (currently undocumented) buffer class with meshes.

If the ipad sleeps when you’re in a shader editor, and you go back in - Codea aborts.

When you bring up the keyboard in a shader when you’re toward the bottom of the code, the keyboard slides up to obscure the code you’re editing.

If you get a really long error message (“…rator ‘-’ exists taking ‘int’ and ‘float’ (and no implicit type conversion allowed in GLSL 1.10)”) - it obscures the line you made the error on, so you can’t correct the error. (Hmm - lie. you can backspace. But if you navigate off that line, you can’t put the cursor there. You can exit the shader, go back in, and the syntax errors don’t show yet - and fix it then. Hmm. )

Thanks for those bug reports, @Bortels. Not sure of the best way to deal with the long-error-message one. I’ll have to think about it.

So - do we expect 1.5 to ship with a model loader?

Because I have a teapot (I need to shade something) that’s not going to load itself.

But before I go write a dumb-as-a-box-of-rocks .obj file loader - I figured I’d see if one was likely to be forthcoming. (Hmm - I should search the forum to see if someone beat me to it first…)

PS. Looks like they beat me to it, in that I see a loader and can convert. :slight_smile:

Not for 1.5 — I do want one eventually but we won’t have time to design it until all the features for 1.5 are completed.

There will be some build-in 3D models in the shader lab (presets that you can select to preview your shader).

Ok - unrelated (maybe) editor bug. Steps to reproduce:

  1. portrait mode.
  2. poke the eye for help (cruel!)
  3. tap to move cursor into program text on a line that wraps.
  4. Type. Text is not showing up where the cursor is.

When I kill the help text - the cursor is where the text is inserting, not where I tapped.