shader fragment constants

Software: Away3D 4.x

3dNewb, Sr. Member
Posted: 30 July 2012 09:47 AM   Total Posts: 105

I updated to the latest GitHub release and see that my shaders are not working anymore.

I can see that the way of initializing constants has changed.

Where can I find how this has changed?

In the shaders that come with the package I see that I need to go through initConstants(); But I don’t understand why in many occasions the index is multiplied by 4:

example:
vo.fragmentConstantsIndex = dataReg.index*4;

What is happening?

   

Avatar
David Lenaerts, Administrator
Posted: 30 July 2012 11:08 AM   Total Posts: 80   [ # 1 ]

Instead of uploading the vertex constants to the GPU in the methods as was previously the case, they’re now placed in a vector which is sent to gpu by the material pass. Every gpu constant is indexed as a vec4 type - so every vertex constant is 4 entries in the vector. The register index is also based on vec4, which is why the multiplication needs to happen.

   

3dNewb, Sr. Member
Posted: 31 July 2012 09:50 AM   Total Posts: 105   [ # 2 ]

Thank you for your fast reply. I figured it out and I see that you have made it so that there is no need to call the _context3D.setProgramConstantsFromVector which I is a good improvement I think.

<3

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X