35 #if defined(__APPLE__) 36 #include <GLUT/glut.h> 55 float a = -0.0030711f;
74 5.34866271e+02, 3.89654806e+00, 0.00000000e+00, 1.74704200e-02,
75 -4.70724694e+00, -5.28843603e+02, 0.00000000e+00, -1.22753400e-02,
76 -3.19670762e+02, -2.60999685e+02, 0.00000000e+00, -9.99772000e-01,
77 -6.98445586e+00, 3.31139785e+00, 0.00000000e+00, 1.09167360e-02
94 if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
98 if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) {
106 printf(
"Error: Kinect not connected?\n");
120 static unsigned int indices[480][640];
121 static short xyz[480][640][3];
123 for (i = 0; i < 480; i++) {
124 for (j = 0; j < 640; j++) {
127 xyz[i][j][2] = depth[i*640+j];
128 indices[i][j] = i*640+j;
132 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
137 glTranslatef(0,0,-3.5);
140 glTranslatef(0,0,1.5);
145 glMatrixMode(GL_TEXTURE);
147 glScalef(1/640.0f,1/480.0f,1);
150 glMatrixMode(GL_MODELVIEW);
154 glEnableClientState(GL_VERTEX_ARRAY);
155 glVertexPointer(3, GL_SHORT, 0, xyz);
156 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
157 glTexCoordPointer(3, GL_SHORT, 0, xyz);
160 glEnable(GL_TEXTURE_2D);
162 glTexImage2D(GL_TEXTURE_2D, 0, 3, 640, 480, 0, GL_RGB, GL_UNSIGNED_BYTE, rgb);
165 glDrawElements(GL_POINTS, 640*480, GL_UNSIGNED_INT, indices);
167 glDisable(GL_TEXTURE_2D);
175 glutDestroyWindow(
window);
188 glViewport(0,0,Width,Height);
189 glMatrixMode(GL_PROJECTION);
191 gluPerspective(60, 4/3., 0.3, 200);
192 glMatrixMode(GL_MODELVIEW);
197 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
198 glEnable(GL_DEPTH_TEST);
201 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
202 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
206 int main(
int argc,
char **argv)
208 glutInit(&argc, argv);
210 glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);
211 glutInitWindowSize(640, 480);
212 glutInitWindowPosition(0, 0);
214 window = glutCreateWindow(
"LibFreenect");
int freenect_sync_get_depth(void **depth, uint32_t *timestamp, int index, freenect_depth_format fmt)
void ReSizeGLScene(int Width, int Height)
void mousePress(int button, int state, int x, int y)
void no_kinect_quit(void)
void InitGL(int Width, int Height)
void freenect_sync_stop(void)
void keyPressed(unsigned char key, int x, int y)
int main(int argc, char **argv)
int freenect_sync_get_video(void **video, uint32_t *timestamp, int index, freenect_video_format fmt)
void mouseMoved(int x, int y)