kos

How to properly copy FLoat2 data to gpu ?

Discussion created by kos on Feb 3, 2009
Latest reply on Feb 3, 2009 by kos

I'm trying to do this way :

CALfloat* fdata = NULL;
  CALfloat* idata = reinterpret_cast<CALfloat*>( data);
  calResMap((CALvoid**)&fdata, &pitch, Res, 0);
  for (int i = 0; i < region.first; ++i)
  {
  CALfloat* tmp = &fdata[i * pitch];
  for (int j = 0; j < region.second; ++j)
  {
  tmp[2*j] = *(idata + (i*pitch) + 2*j);
  tmp[2*j+1] = *(idata + (i*pitch) + 2*j+1);
  }
  }

but sometimes pitch > width.

Outcomes