//------------------------------------------------------------------------------ void webcam_t::makePicture() { vector_t C = *pos - *G; GLfloat x = C.x + offset[0]*N->x + offset[1]*T->x; GLfloat y = C.y + offset[0]*N->y + offset[1]*T->y; GLfloat z = -z - offset[2]; GLfloat dx = direction[0]*N->x + direction[1]*T->x; GLfloat dy = direction[0]*N->y + direction[1]*T->y; GLfloat dz = -direction[2]; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Efface le frame buffer et le Z-buffer glMatrixMode(GL_MODELVIEW); //Choisit la matrice MODELVIEW glLoadIdentity(); //Réinitialise la matrice gluLookAt(x,y,z, x+dx,y+dy,z+dz, 0.,0.,-1.); make_scene(); }
int main(void) { scene *sc = make_scene(); png_render(sc, WIDTH, HEIGHT, "dof.png"); return 0; }
//------------------------------------------------------------------------------ void webcam_t::display() { make_scene(); glutSwapBuffers(); }