hello,
I tried to change my depth image and to display it with glutDisplay.
I wrote the following code:
XnPoint3D projection, pPosition2;
pPosition2.X=handXPos;
pPosition2.Y=handYPos;
pPosition2.Z=handZPos;
printf(" position drewSquare: (%f, %f, %f)\n",
pPosition2.X,pPosition2.Y,pPosition2.Z);
g_depth.ConvertRealWorldToProjective(1,&pPosition2,&projection);
g_depth.GetMetaData(g_depthMD);
XnDepthPixel* depth = g_depthMD.WritableData();
const XnDepthPixel* depthData = g_depthMD.Data();
int x = projection.X;
int y = projection.Y;
int handDepth = depthData[y*g_depthMD.XRes() + x];
printf("X projection: %d, Y projection: %d\n",x,y);
for (int i = -100; i<100; i++) {
for (int j = -100; j<100; j++){
depth[(y+j)*g_depthMD.XRes() + (i+x)] = 0;
//g_depthMD.WritableData()[(y+j)*g_depthMD.XRes() +
(i+x)]=0;
}
}