void draw() { glMatrixMode(GL_MODELVIEW); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(rotX,1,0,0); glRotatef(rotY,0,1,0); glPushMatrix(); glTranslatef(3,0,0); drawCoordinate(); glPopMatrix(); glScaled(zoom,zoom,zoom); glPushMatrix(); lsys.DrawLevel(level); glPopMatrix(); glPopMatrix(); glutSwapBuffers(); }
/** * @brief QrSlam::showImage * 过程显示 * 显示机器人位置 landmark 坐标系 */ void QrSlam::showImage() { cout<<"robot_info "<<robot_info_.X<<" "<<robot_info_.Y<<endl; showRobotTriangle(raw_global_map_, robot_info_,CV_RGB(0,0,0)) ; //robot_img_cvt_->convertOnce(raw_global_map_); showLandmark(raw_global_map_,CV_RGB(0,0,255)); // flip(raw_global_map_,raw_global_map_flip0_,0); drawCoordinate(raw_global_map_); slam_img_cvt_->convertOnce(raw_global_map_); }
int main(int argc, char *argv[]) { char eventFullPathName[100]; int eventnum; int x,y,prex = 0,prey = 0; int fb_fd,fp; struct fb_var_screeninfo fbvar; struct fb_fix_screeninfo fbfix; unsigned char *fb_mapped; int mem_size; if (argc != 2) { printf("Usage : touchapp <event Number>\n"); printf("To see the event number, do \"cat /proc/bus/input/devices\" \n"); return 1; } eventnum = atoi(argv[1]); sprintf(eventFullPathName,"%s%d",EVENT_STR,eventnum); printf("touch input event name:%s\n", eventFullPathName); fp = open( eventFullPathName, O_RDONLY); if (-1 == fp) { printf("%s open fail\n",eventFullPathName); return 1; } if( access(FBDEV_FILE, F_OK) ) { printf("%s: access error\n", FBDEV_FILE); close(fp); return 1; } if( (fb_fd = open(FBDEV_FILE, O_RDWR)) < 0) { printf("%s: open error\n", FBDEV_FILE); close(fp); return 1; } if( ioctl(fb_fd, FBIOGET_VSCREENINFO, &fbvar) ) { printf("%s: ioctl error - FBIOGET_VSCREENINFO \n", FBDEV_FILE); goto fb_err; } if( ioctl(fb_fd, FBIOGET_FSCREENINFO, &fbfix) ) { printf("%s: ioctl error - FBIOGET_FSCREENINFO \n", FBDEV_FILE); goto fb_err; } screen_width = fbvar.xres; screen_height = fbvar.yres; bits_per_pixel = fbvar.bits_per_pixel; line_length = fbfix.line_length; printf("screen_width : %d\n", screen_width); printf("screen_height : %d\n", screen_height); printf("bits_per_pixel : %d\n", bits_per_pixel); printf("line_length : %d\n", line_length); mem_size = screen_width * screen_height * 4; fb_mapped = (unsigned char *)mmap(0, mem_size, PROT_READ|PROT_WRITE, MAP_SHARED, fb_fd, 0); if (fb_mapped < 0) { printf("mmap error!\n"); goto fb_err; } initScreen(fb_mapped); while(1) { readFirstCoordinate(fp,&x, &y); drawCoordinate(fb_mapped,x,y, prex, prey); prex = x; prey = y; } fb_err: close(fb_fd); close(fp); return 0; }