You can use pcl::PointXYZRGBinstead pcl::PointXYZRGBA. I think both of them do the same. And then, to color the red point (255,0,0), you can do:
pcl::PointXYZRGB point = pcl::PointXYZRGB(255, 0, 0);
And then xyz coordinates can be assigned accordingly:
point.x = x;
point.y = y;
point.z = z;
EDIT: Or, if you need to stick pcl::PointXYZRGBA, you can do
pcl::PointXYZRGBA point;
uint8_t r = 255;
uint8_t g = 0;
uint8_t b = 0;
int32_t rgb = (r << 16) | (g << 8) | b;
point.rgba = *(float *)(&rgb);
source
share