make_uchar4 pointer issue

My current code looks like:

unsigned char *pixelOutputR = (unsigned char*) (surfaceOutput + y*pitchOutput) + 4*x;

unsigned char *pixelOutputG = (unsigned char*) (surfaceOutput + y*pitchOutput) + 4*x+1;

unsigned char *pixelOutputB = (unsigned char*) (surfaceOutput + y*pitchOutput) + 4*x+2;

unsigned char *pixelOutputA = (unsigned char*) (surfaceOutput + y*pitchOutput) + 4*x+3;

uchar4 pixelOutput = make_uchar4(*pixelOutputR, *pixelOutputG, *pixelOutputB, *pixelOutputA);

pixelOutput.x = convolutionResult.x;

pixelOutput.y = convolutionResult.y;

pixelOutput.z = convolutionResult.z;

pixelOutput.w = 1.0;

Now I have dataloss… I think because there is something wrong pointing to my data…

Anyone has an idea?

Grtz!

  • Flokky