| 1038 | } |
| 1039 | |
| 1040 | void drawPointerMode(IntPair* pPointer) |
| 1041 | { |
| 1042 | char buf[512] = ""; |
| 1043 | int nCharWidth = glutBitmapWidth(GLUT_BITMAP_HELVETICA_18, '0'); |
| 1044 | int nPointerValue = 0; |
| 1045 | |
| 1046 | XnDouble dTimestampDivider = 1E6; |
| 1047 | |
| 1048 | const DepthMetaData* pDepthMD = getDepthMetaData(); |
| 1049 | |
| 1050 | if (pDepthMD != NULL) |
| 1051 | { |
| 1052 | // Print the scale black background |
| 1053 | glEnable(GL_BLEND); |
| 1054 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 1055 | |
| 1056 | glBegin(GL_QUADS); |
| 1057 | glColor4f(0, 0, 0, 0.7); |
| 1058 | glVertex2i(0, WIN_SIZE_Y); // lower left |
| 1059 | glVertex2i(WIN_SIZE_X, WIN_SIZE_Y); |
| 1060 | glVertex2i(WIN_SIZE_X, WIN_SIZE_Y - 135); |
| 1061 | glVertex2i(0, WIN_SIZE_Y - 135); |
| 1062 | glEnd(); |
| 1063 | |
| 1064 | glDisable(GL_BLEND); |
| 1065 | |
| 1066 | // set a large point size (for the scale) |
| 1067 | glPointSize(15); |
| 1068 | |
| 1069 | // Print the scale data |
| 1070 | glBegin(GL_POINTS); |
| 1071 | for (int i = 0; i < pDepthMD->ZRes(); i+=1) |
| 1072 | { |
| 1073 | float fNewColor = g_pDepthHist[i]; |
| 1074 | if ((fNewColor > 0.004) && (fNewColor < 0.996)) |
| 1075 | { |
| 1076 | glColor3f(fNewColor, fNewColor, 0); |
| 1077 | glVertex3f(((i/10)*2), WIN_SIZE_Y - 23, 1); |
| 1078 | } |
| 1079 | } |
| 1080 | glEnd(); |
| 1081 | |
| 1082 | // Print the pointer scale data |
| 1083 | if (pPointer != NULL) |
| 1084 | { |
| 1085 | // make sure pointer in on a depth pixel (take in mind cropping might be in place) |
| 1086 | IntPair pointerInDepth = *pPointer; |
| 1087 | pointerInDepth.X -= pDepthMD->XOffset(); |
| 1088 | pointerInDepth.Y -= pDepthMD->YOffset(); |
| 1089 | |
| 1090 | if (pointerInDepth.X < (int)pDepthMD->XRes() && pointerInDepth.Y < (int)pDepthMD->YRes()) |
| 1091 | { |
| 1092 | nPointerValue = (*pDepthMD)(pointerInDepth.X, pointerInDepth.Y); |
| 1093 | |
| 1094 | glBegin(GL_POINTS); |
| 1095 | glColor3f(1,0,0); |
| 1096 | glVertex3f(10 + ((nPointerValue/10)*2), WIN_SIZE_Y - 70, 1); |
| 1097 | glEnd(); |
no test coverage detected