//OBPM.CPP #include "stdafx.h" #include "OBPM_UI.h" int main(int argc, char* argv[]) { OBPMViewUI UI; UI.start(argc,argv); return Fl::run(); }
//VideoGLWin.h //////////////////////////////////////////////////////////// // Class Name: VideoGLWin // Description: Display the video from camera or file by openGL(FLTK) // Date: 2012-01-09 09:54 //////////////////////////////////////////////////////////// #ifndef VIDEO_GL_WIN_H #define VIDEO_GL_WIN_H #include <FL/Fl.H> #include <FL/Gl.H> #include <FL/Glu.H> #include <FL/Fl_Gl_Window.H> #include <FL/Threads.h> #include <FL/Fl_Ask.h> #include<OpenCV/cv.h> class VideoGlWin : public Fl_Gl_Window { private: bool m_openGLInitialized; GLuint textureName; public: double zoom_ratio; //0.1 10.0 double xpan_ratio,ypan_ratio; // -1.0-1.0 double frame_rate; public: IplImage *m_processedImage; public: VideoGlWin(int x,int y , int w, int h,const char *L=0):Fl_Gl_Window(x,y,w,h,L) { zoom_ratio=1.0; xpan_ratio=0.0; ypan_ratio=0.0; m_processedImage=NULL; m_openGLInitialized=false; if(!initOpenGL()) { fl_alert("Can not init OpenGL! Exit!"); exit(0); } Fl::add_timeout(1.0/frame_rate, Timer_CB, (void*)this); } ~VideoGlWin() { if(m_processedImage) { cvReleaseImage(&m_processedImage); m_processedImage=NULL; } } bool initOpenGL(void); void draw(void); //void draw_overlay(void); void ShowAppMessage(void); void VideoGlWin::grid_draw(int r2,int c2); bool upload_iplimage (const IplImage *img,GLuint& tex); // 24 FPS TIMER CALLBACK // Called 24x per second to redraw the widget // static void Timer_CB(void *userdata) { VideoGlWin *glW = (VideoGlWin*)userdata; glW->redraw(); Fl::repeat_timeout(1.0/24.0, Timer_CB, userdata); } void SetFPS(double fps) { Fl::remove_timeout(Timer_CB,(void*)this); Fl::add_timeout(1.0/fps, Timer_CB, (void*)this); frame_rate=fps; } }; #endif _______________________________________________ fltk-opengl mailing list fltk-opengl@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-opengl