Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gamma.api/* doesn't work with mat4 #3

Closed
sgrove opened this issue May 11, 2015 · 5 comments
Closed

gamma.api/* doesn't work with mat4 #3

sgrove opened this issue May 11, 2015 · 5 comments

Comments

@sgrove
Copy link
Contributor

sgrove commented May 11, 2015

In the spirit of every gl-lib, I'm porting http://learningwebgl.com/blog/?p=28 over to gamma. Ran into an issue with the first example vertex shader:

 attribute vec3 aVertexPosition;

  uniform mat4 uMVMatrix;
  uniform mat4 uPMatrix;

  void main(void) {
    gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
  }

Which I believe the equivalent gamma is:

(def vertex-position
  (g/attribute "aVertexPosition" :vec3))

(def p-matrix
  (g/uniform "uPMatrix" :mat4))

(def mv-matrix
  (g/uniform "uMVMatrix" :mat4))

(def vertex-shader
  {(g/gl-position) (-> (g/* u-p-matrix u-mv-matrix)
                       (g/* (g/vec4 vertex-position 1)))})

But this results in:
Uncaught Error: Arguments to * must have type :int or :float, given :mat4 and :vec4

@kovasb
Copy link
Owner

kovasb commented May 11, 2015

Looks like this got broken in a recent commit. Need to fix arithmetic-type, probably refactor all the operator inference logic. Definitely need more tests but its rather laborious given the surface area and number of layers...

@sgrove
Copy link
Contributor Author

sgrove commented May 11, 2015

Just making sure, I'll comment out the arithmetic checks for the time being then.

@kovasb
Copy link
Owner

kovasb commented May 12, 2015

it also does inference, which is necessary for declaring locals (should they be needed)

@kovasb
Copy link
Owner

kovasb commented May 12, 2015

fixed as of 163eed9

@kovasb kovasb closed this as completed May 12, 2015
@kovasb
Copy link
Owner

kovasb commented May 12, 2015

opening a new issue on the general topic #4 until this is more thorough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants