Skip navigation
Currently Being Moderated

Parameter register problem?

Dec 12, 2011 11:34 AM



iam trying to set some parameters of my fragmentshader. First I used the ProgramConstantHelper but it simply is to slow to use in the final program.

After some errors I couldnt figure out how setting the parameters with setProgramConstantsFromVector works, better said, I did not know which registers I have to set. To find that out I first inspected some values in the debugger and than wrote a little code giving me this output.


[object BombExplosionShader]

FragmentParameter: color startRegister: 1 offset: 0

FragmentParameter: size startRegister: 1 offset: 3

FragmentParameter: fposition startRegister: 2 offset: 0

FragmentParameter: resolution startRegister: 2 offset: 2

FragmentParameter: strength startRegister: 3 offset: 0

FragmentParameter: thickness startRegister: 3 offset: 1


first I thought every parameter has its own register, but I was wrong. If the compiler is able to put some parameters into one register, it does.


this is the code to set the parameters of the vector:


this.m_parameters[0]= colorR;

this.m_parameters[1]= colorG;

this.m_parameters[2]= colorB;

this.m_parameters[3]= size;

this.m_parameters[4]= posX;

this.m_parameters[5]= posY;

this.m_parameters[6]= resX;

this.m_parameters[7]= resY;

this.m_parameters[8]= strength;

this.m_parameters[9]= thickness;


The vector is generated with: new Vector.<Number>(12, true);



and this is the call of setProgramConstantsFromVector:


this.m_context3D.setProgramConstantsFromVector(Context3DProgramType.FR AGMENT, 1, this.m_parameters);


can someone tell me what is wrong with the code?

  • Currently Being Moderated
    Dec 12, 2011 3:51 PM   in reply to Pak762

    Yes, this is exactly the work that ProgramConstantsHelper does for you. If you look at AGAL, there are no built in constants so all constant values need to be passed in.



    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points