Hi forum,
How to decide the row pitch and slice pitch value while creating a 3D opengl image buffer. Initially i am allocating a 3D buffer on the host as follows:
//calculate the number of elements to deal with - width , height and depth
unsigned int elements = static_cast<unsigned int>(w * h * d);
//allocate memory for the number of elements
float *volumeData = (float*)malloc(elements * 4 * sizeof(float));
float *ptr = volumeData;
//POPULATE WITH random values
for(unsigned int i = 0; i < elements;i++)
{
*ptr++ = frand()*2.0f-1.0f;
*ptr++ = frand()*2.0f-1.0f;
*ptr++ = frand()*2.0f-1.0f;
*ptr++ = frand()*2.0f-1.0f;
}
Image channel format is CL_RGBA and data type is CL_FLOAT.
I am not sure if the row pitch value should be image_width * sizeof(float). I tried it and got invalid image size error.
Any hint?
Thanks