Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Shader Compile Error

edited December 2014 in Shaders Posts: 211

Hey guys, I'm using this code on CC: Custom Keyboard Library FLCodea

When I run using CC, it runs normally.

When I donwload and run on Codea, appears: Shader Compile Error

What is going on? @Simeon do you have any idea?



  • IgnatzIgnatz Mod
    Posts: 5,396

    @erickyamato - What is the specific error, and can you figure out which line of the shader it is happening in?

  • @Ignatz, there isn't no line number, just appear in yellow "Shader Compile Error".

    I don't know how to explain, try to donwload on CC and run it on your iPad

  • IgnatzIgnatz Mod
    Posts: 5,396

    @erickyamato - the person to ask is the person who uploaded the code, not Simeon

  • @Ignatz, when I run this code on CC, is normal, when is on iPad, this occurs.

    I think, this can be a possible bug!

  • IgnatzIgnatz Mod
    Posts: 5,396

    @erickyamato - it is far more likely just to be a normal bug, so I wouldn't bother Simeon with it until you are absolutely sure.

  • @Ignatz, before Codea 2.1, it was running very well.

    But, I'll try to find a way to fix this "bug".

    Thank you @Ignatz to answer my topic!

  • Posts: 503

    I've also had this Shader Compile Error without any information about what the error is. Really hard to now what the error is. The code worked fine in earlier releases.

  • IgnatzIgnatz Mod
    Posts: 5,396

    @tnlogy -

    I think I can fix your problem very simply. Your shader code is defined like this

    S = shader(Perlin .. [[ //lots of code]], [[ //more code]])
    --(for other readers, "Perlin" is just a text string of code)
    --then you say in Codea
    self.m.shader = S

    Codea doesn't seem to like you defining a shader that isn't part of a mesh. So define S as a table of strings instead, and only use the shader command when assigning it to a mesh

    S ={v=Perlin .. [[ //lots of code]], f=[[ //more code]]}
    --then you say in Codea
    self.m.shader = shader(S.v,S.f)

    (I didn't use any particular brilliance to find this. I just started deleting shader code until the problem disappeared. When I was left with a basic 4 line shader which still had problems, there was only one possibility....)

    @erickyamato - see if this helps you too

  • IgnatzIgnatz Mod
    Posts: 5,396

    The problem, according to Simeon, is that your current code tries to compile the shader before Codea sets up properly. This is because it is outside of any function.

    If you put the S = line in a function and call it from setup, it should work fine.

    This is a change from previous Codea versions, and is unlikely to change back.

  • Posts: 503

    Wow, thanks a lot! Haven't had time to debug it myself, just saw that it didnt work. Great! To busy parenting to code lately. No christmas competition here this year? :)

Sign In or Register to comment.