kovasb / gamma

glsl shaders made simple
Eclipse Public License 1.0
306 stars 20 forks source link

fixing str-based emission for aget and selector #26

Closed timsgardner closed 9 years ago

timsgardner commented 9 years ago

aget and selector were acting weird, think I fixed them by using fipp-style formatting rather than str

kovasb commented 9 years ago

Can you elaborate on what "acting weird" means?

timsgardner commented 9 years ago

• Emit takes 2 arguments, in these functions it is called with 1. • (emit db (db (first (body x)))) and (emit db (db (second (body x)))) often or always returns fipp-y data, with Clojure vectors and so on involved. Calling str cements them into a string, producing nonsensical glsl code:

(->
  {:fragment-shader
   {(g/gl-frag-color) (g/aget (g/vec4 0) 1)}}
  p/program
  :fragment-shader
  :glsl
  println)

=> 
void main(void){(gl_FragColor = [:group "vec4" "(" [:line ""] [:nest 2 ("0.0")] ")"][[:group "int" "(" [:line ""] [:nest 2 ("1.0")] ")"]]);}

(this is with fipp disabled, I don't think that should make a difference)

kovasb commented 9 years ago

thanks. fixed in https://github.com/kovasb/gamma/commit/ba13da4d145a643b4937d17a49be65608e434a48