If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

One pixel in the image is just one float becuase image Format is float and Order is CL_R. So every Pixel you read has just this one float value. To pass a valid array just insert a normal float array with size float[width * height]

One pixel in the image is just one float becuase image Format is float and Order is CL_R. So every Pixel you read has just this one float value. To pass a valid array just insert a normal float array with size float[width * height]

Extending clint's answer a little:

The type of image created is a single color per location - only R. (if you wish to work with RGBA, you need to modify the format). As such:
1. The buffer that you need to allocate (and later pass as a void*) is of width*height floats - something like float* A= malloc(height*width*4);
2. A[0] is the first pixel in the image - This is the pixel value at index x=0, y=0. A[1] is the second pixel, correlates to x=1, y=0, and so on.
3. Image is assumed to be organized at rows, so A[0] to A[width-1] are the pixels of first row, A[width] to A[width*2-1] are the pixels of second row, etc.

If the compiler that you're using is C99 compatible, you could allocate a variable 2D array:float (*A)[height] = malloc(sizeof(float[width][height]));
and then use A[i][j] for accesing it.