Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

FltkOpenGLDisplayDevice.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2011 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: FltkOpenGLDisplayDevice.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.20 $       $Date: 2011/01/28 20:08:39 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *
00019  * Subclass of OpenGLRenderer, this object has routines used by all the
00020  * different display devices that are OpenGL-specific.  Will render drawing
00021  * commands into a single X window.
00022  *
00023  ***************************************************************************/
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(int &x, int &y);
00090 
00091   // Update xOrig and yOrig before computing screen position
00092   virtual void rel_screen_pos(float &x, float &y) {
00093     reshape();
00094     DisplayDevice::rel_screen_pos(x, y);
00095   }
00096 };
00097 
00098 #endif
00099 

Generated on Sat May 26 01:47:59 2012 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002