trouble with vex arrays

   4056   2   0
User Avatar
Member
89 posts
Joined: April 2008
Offline
Am I doing something wrong here?

In shading context:

int i;
int maxiter = 4;
float nums;

for (i=0; i < maxiter; i++)
{
nums = (float)i;
}

doesn't work. I've also tried initializing nums as nums

Another issue, integer arrays arent supported in shading context?

int nums = { 1,2,3,4};
generates a type-mismatch error and
int nums = {(int)1, (int)2, … };
doesnt work either
User Avatar
Staff
2593 posts
Joined: July 2005
Offline
mrice
Am I doing something wrong here?

In shading context:…

Try

for (i = 0; i < maxiter; i++)
push(nums, i);

Or.

nums = array(1, 2, 3, 4);


Like:

surface
foo()
{
int i;
float nums;

for (i = 0; i < 4; i++)
push(nums, (float)i);
nums = array(1.0, 2, 3, 4);
}
User Avatar
Member
89 posts
Joined: April 2008
Offline
That *almost* works here:

mark
Like:

surface
foo()
{
int i;
float nums;

for (i = 0; i < 4; i++)
push(nums, (float)i);
nums = array(1.0, 2, 3, 4);
}

gives me an error that nums is uninitialized, but

float nums = array();

does work.

Many thanks!
  • Quick Links