advanced 3d: cullmode, depthmask, ...

Hi,

Is it possible to set the cullmode (front/back/none), depthmask (enable read/write of the depthbuffer) inside codea, or is this something you do in the gl shader?

Also, on a sidenote, are quaternions planned for a future version of codea?

On that last note, I have a quaternion library for use in Codea available at http://www.math.ntnu.no/~stacey/code/CodeaLibrary/Quaternion.lua

Hi, Andrew,

I’m already using your Quaternion library :-), saved me a lot of trouble and was a great introduction to lua/codea (adding new memberfunctions to vec3 is a neat trick! feels very much like javascript or even lisp

I encountered a small issue, maybe you can help

When i apply (your) quaternions to vec3’s everything works as expected but when I convert a quaternion to a matrix ( ex to create modelspace in drawfunction) the rotations around the x-axis and z-axis are switched (y-axis rotations work fine)

I wrote my own quaternion-to-matrix function with the same results …

Also, why use self.q.x instead of self.x in the quaternion class? (I’m new to lua)

Are you using the latest version of my Quaternion library? Not long ago I redid the conversion to matrix so that might have fixed it.

In the latest version then I use the vec4 data type for storing the actual data of a quaternion which allows me to piggy-back on the vec4 operations of addition, multiplication, and the like. So the self.q is now a vec4. I don’t think I could make self point to the vec4 object itself since then self wouldn’t be a table but a userdata.