• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# int-float with arrays

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1lxnyce  Members

Posted 04 November 2004 - 03:15 PM

I am having trouble converting from int to float using arrays. The following works if I use an array of integers, but when using floats it doesn't work (as shown below). I tried casting it to a float but that didn't work as well? Anybody have an idea of what I am doing wrong? Is there a better way to do this?

float[] RGBA(100);
for (int i=0; i<100; i++) {
RGBA[i] = i;
}
}



The goal here is to pass a block of floating point pixel values and have the script manipulate it. I could use a two dimensional function, but the computation has to be fast. I will probably run some tests comaring the array method, function call method, and a standard C code method to see what the overhead performance is like. Just want to get the array method working. If not possible, no worries, i'll stick with the function calls.

### #2Rain Dog  Members

Posted 04 November 2004 - 06:05 PM

you cant do "RGBA[i] = (float)i;" ?

### #3Aggrav8d  Members

Posted 04 November 2004 - 06:51 PM

...isn't it

float(i)

in AS?

Dan Royer, OwnerMarginally Clever Games

### #4lxnyce  Members

Posted 05 November 2004 - 01:41 AM

Ahhh, that explains it. I usually cast as (float)i, but doing it as float(i) worked. Thanks alot.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.