Author Topic: uniform and nullPointerException  (Read 7919 times)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: uniform and nullPointerException
« Reply #15 on: June 22, 2012, 12:08:42 am »
app
Code: [Select]
exponents = new float[8];shader
Code: [Select]
uniform highp float spotExp[8];

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: uniform and nullPointerException
« Reply #16 on: June 22, 2012, 12:12:32 am »
I see...as the docs state, float[] is only supported for 1-4 elements ATM. I can remove this limitation, but it won't happen until the weekend. As a workaround until then, you can enlarge the array to 9 elements and store the values in the components of 3 SimpleVectors...yes, that's cludgy...but it should work.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: uniform and nullPointerException
« Reply #17 on: June 22, 2012, 12:22:51 am »
Oh, this limitation has somehow escaped me... I'll wait for her removed (8 per-pixel spot lights are not important for me and for my phone :) ), and thanks for your help :)

EDIT: hmm, array length 1 working, but 2 not...
« Last Edit: June 22, 2012, 12:26:42 am by Thomas. »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: uniform and nullPointerException
« Reply #18 on: June 22, 2012, 06:24:28 am »
Maybe there's another problem with float-arrays...i'll look into it tomorrow.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: uniform and nullPointerException
« Reply #19 on: June 22, 2012, 01:46:44 pm »
At least i found the reason for the problem with float[] to set a float[] uniform in the shader...it's not meant for that purpose, albeit the docs somehow suggest that it might be. These setters are actually to fill a float, vec2, vec or vec4 with the float[]-array's data. To set an actual float[], another method will be needed. I'll add it tomorrow.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: uniform and nullPointerException
« Reply #20 on: June 23, 2012, 01:46:29 pm »
I've updated the jar and added a method called setFloatArrayUniform(...). Again, this is untested and i coded it while being forced to listen to children songs...so bear with me, if it's just an epic fail...

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: uniform and nullPointerException
« Reply #21 on: June 23, 2012, 07:25:09 pm »
I believe it must have been sheer torture :) But everything seems to be fine ;)