00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef OPENGLDISPLAYDEVICE_H
00025 #define OPENGLDISPLAYDEVICE_H
00026
00027 #include "OpenGLRenderer.h"
00028
00029 class VMDApp;
00030
00031 #if !defined(_MSC_VER) && !(defined(VMDSDL) && defined(__APPLE__))
00032 #include <GL/glx.h>
00033
00034
00035
00036
00037 #if defined(ARCH_LINUX) && !defined(VMDMESA)
00038 #include <GL/glxext.h>
00039 #endif
00040 #endif
00041
00042 #if defined(VMDSPACEWARE) && defined(WIN32)
00043 #define OS_WIN32 1
00044 #include "spwmacro.h"
00045 #include "si.h"
00046 #endif
00047
00048 #if defined(VMDSDL)
00049
00051 typedef struct {
00052 int windowID;
00053 } sdldata;
00054
00055 #else
00056 #if defined(_MSC_VER)
00057
00059 typedef struct {
00060 HWND hWnd;
00061 HDC hDC;
00062 HGLRC hRC;
00063 long scrwidth;
00064 long scrheight;
00065 int width;
00066 int height;
00067
00068
00069 int cursornum;
00070 long MouseX;
00071 long MouseY;
00072 long MouseFlags;
00073 int WEvents;
00074 char KeyFlag;
00075 int PFDisStereo;
00076
00077 #ifdef VMDSPACEWARE
00078 SiHdl sball;
00079 SiSpwEvent spwevent;
00080 SiGetEventData spwedata;
00081 #endif
00082
00083 } wgldata;
00084
00085 #else
00086
00087 #define SBALL_COMMAND_NONE 0
00088 #define SBALL_COMMAND_APP_WINDOW 27695
00089 #define SBALL_COMMAND_APP_SENSITIVITY 27696
00090
00091
00092 typedef struct {
00093 Display *dpy;
00094 Window drv_win;
00095 Window app_win;
00096 Atom ev_motion;
00097 Atom ev_button_press;
00098 Atom ev_button_release;
00099 Atom ev_command;
00100 } spaceballhandle;
00101
00102
00103 typedef struct {
00104 int event;
00105 int rx;
00106 int ry;
00107 int rz;
00108 int tx;
00109 int ty;
00110 int tz;
00111 int buttons;
00112 int period;
00113 } spaceballevent;
00114
00116 typedef struct {
00117 Display *dpy;
00118 int dpyScreen;
00119 Window rootWindowID;
00120
00121 Window windowID;
00122 XSizeHints sizeHints;
00123 Cursor cursor[5];
00124 GLXContext cx;
00125 int havefocus;
00126
00127 void *xinp;
00128
00129 spaceballhandle *sball;
00130 spaceballevent sballevent;
00131
00132 } glxdata;
00133 #endif
00134 #endif
00135
00136
00140 class OpenGLDisplayDevice : public OpenGLRenderer {
00141 public:
00142 VMDApp *vmdapp;
00143
00144 #if defined(VMDSDL)
00145 sdldata sdlsrv;
00146 #else
00147 #if defined(_MSC_VER)
00148 wgldata glwsrv;
00149 #else
00150 glxdata glxsrv;
00151 #endif
00152 #endif
00153
00154 protected:
00155
00156 int have_window;
00157
00158
00159 #if defined(VMDSDL)
00160 int open_window(char *, int *, int *, int, char **);
00161 #else
00162 #if defined(_MSC_VER)
00163 int open_window(char *, int *, int *, int, char **);
00164 #else
00165 Window open_window(char *, int *, int *, int, char **);
00166 #endif
00167 #endif
00168
00169 virtual void do_resize_window(int, int);
00170 virtual void do_reposition_window(int, int);
00171
00172 public:
00173
00174 OpenGLDisplayDevice();
00175
00176
00177
00178
00179 int init(int argc, char **argv, VMDApp *app, int *size, int *loc = NULL);
00180
00181 virtual ~OpenGLDisplayDevice(void);
00182
00183
00184
00185
00186
00187 virtual int x(void);
00188 virtual int y(void);
00189 virtual int shift_state(void);
00190
00191
00192
00193
00194 virtual int spaceball(int *, int *, int *, int *, int *, int *, int *);
00195
00196
00197 virtual void set_cursor(int);
00198
00199
00200
00201
00202
00203
00204
00205
00206 virtual void queue_events(void);
00207
00208
00209
00210 virtual int read_event(long &, long &);
00211
00212
00213
00214
00215 virtual void update(int do_update = TRUE);
00216 virtual void reshape(void);
00217
00218
00219 virtual unsigned char * readpixels(int &x, int &y);
00220 };
00221
00222 #endif
00223