00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * RCS INFORMATION: 00010 * 00011 * $RCSfile: FltkOpenGLDisplayDevice.h,v $ 00012 * $Author: johns $ $Locker: $ $State: Exp $ 00013 * $Revision: 1.25 $ $Date: 2020/02/26 06:36:09 $ 00014 * 00015 ***************************************************************************/ 00024 #ifndef OPENGLDISPLAYDEVICE_H 00025 #define OPENGLDISPLAYDEVICE_H 00026 00027 #include "OpenGLRenderer.h" 00028 00029 class VMDApp; 00030 class Fl_Gl_Window; 00031 00033 class FltkOpenGLDisplayDevice : public OpenGLRenderer { 00034 00035 private: 00036 Fl_Gl_Window *window; 00037 00038 public: 00039 // constructor/destructor 00040 // arguments: argc/argv from main, 00041 // handle to VMDApp, 00042 // and the size and location for the window, if known 00043 FltkOpenGLDisplayDevice(int, char **, VMDApp *,int *size = NULL, int *loc = NULL); 00044 virtual ~FltkOpenGLDisplayDevice(void); 00045 00046 00047 // 00048 // get the current state of the device's pointer (i.e. cursor if it has one) 00049 // 00050 int lastevent; // last FLTK event we processed 00051 int lastkeycode; // last keyboard keycode pressed 00052 int lastbtn; // last mouse button pressed 00053 int lastzdelta; // last mouse wheel delta (windows parlance) 00054 00055 virtual int x(void); // abs pos of cursor from lower-left corner 00056 virtual int y(void); // same, for y direction 00057 virtual int shift_state(void);// return the shift state (ORed of the 00058 // enum in DisplayDevice) 00059 00060 // get the current state of the Spaceball if one is available 00061 // returns rx ry rz, tx ty tz, buttons 00062 virtual int spaceball(int *, int *, int *, int *, int *, int *, int *); 00063 00064 // set the Nth cursor shape as the current one. If no arg given, the 00065 // default shape (n=0) is used. 00066 virtual void set_cursor(int); 00067 00068 // resize window 00069 virtual void do_resize_window(int, int); 00070 00071 // reposition window 00072 virtual void do_reposition_window(int xpos, int ypos); 00073 00074 // 00075 // event handling routines 00076 // 00077 00078 // read the next event ... returns an event type (one of the above ones), 00079 // and a value. Returns success, and sets arguments. 00080 virtual int read_event(long &, long &); 00081 00082 // 00083 // virtual routines for preparing to draw, drawing, and finishing drawing 00084 // 00085 virtual void update(int do_update = TRUE); // finish up after drawing 00086 virtual void reshape(void); // refresh device after change 00087 00088 // virtual routine for capturing the screen to a packed RGB array 00089 virtual unsigned char * readpixels_rgb3u(int &x, int &y); 00090 virtual unsigned char * readpixels_rgba4u(int &x, int &y); 00091 00092 // Update xOrig and yOrig before computing screen position 00093 virtual void rel_screen_pos(float &x, float &y) { 00094 reshape(); 00095 DisplayDevice::rel_screen_pos(x, y); 00096 } 00097 }; 00098 00099 #endif 00100