00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00051 #ifndef __vtkWin32OpenGLRenderWindow_h
00052 #define __vtkWin32OpenGLRenderWindow_h
00053
00054 #include <stdlib.h>
00055 #include "vtkRenderWindow.h"
00056 #include "vtkMutexLock.h"
00057 #ifndef VTK_IMPLEMENT_MESA_CXX
00058 #include <GL/gl.h>
00059 #endif
00060
00061 class vtkIdList;
00062
00063 class VTK_EXPORT vtkWin32OpenGLRenderWindow : public vtkRenderWindow
00064 {
00065 public:
00066 static vtkWin32OpenGLRenderWindow *New();
00067 vtkTypeMacro(vtkWin32OpenGLRenderWindow,vtkRenderWindow);
00068 void PrintSelf(ostream& os, vtkIndent indent);
00069
00071 void Start(void);
00072
00074 void Frame(void);
00075
00077 virtual void WindowConfigure(void);
00078
00080 virtual void WindowInitialize(void);
00081
00083 virtual void Initialize(void);
00084
00086 virtual void SetFullScreen(int);
00087
00089 virtual void WindowRemap(void);
00090
00092 virtual void PrefFullScreen(void);
00093
00095 virtual void SetSize(int,int);
00096
00098 virtual int *GetSize();
00099
00101 virtual void SetPosition(int,int);
00102
00104 virtual int *GetScreenSize();
00105
00107 virtual int *GetPosition();
00108
00111 virtual void SetWindowName(char *);
00112
00114 void SetWindowInfo(char *);
00115
00116
00117 virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
00118 virtual void *GetGenericWindowId() {return (void *)this->WindowId;};
00119 virtual void *GetGenericParentId() {return (void *)this->ParentId;};
00120 virtual void *GetGenericContext() {return (void *)this->DeviceContext;};
00121 virtual void SetDisplayId(void *) {};
00122
00124 virtual HWND GetWindowId();
00125 void SetWindowId(void *foo) {this->SetWindowId((HWND)foo);};
00126
00128 virtual void SetWindowId(HWND);
00129
00131 virtual void SetParentId(HWND);
00132 void SetParentId(void *foo) {this->SetParentId((HWND)foo);};
00133
00134 void SetContextId(HGLRC);
00135 void SetDeviceContext(HDC);
00136
00138 virtual void SetNextWindowId(HWND);
00139
00140
00141
00142 vtkSetMacro(MultiSamples,int);
00143 vtkGetMacro(MultiSamples,int);
00144
00146 virtual void StereoUpdate();
00147
00152 virtual void SetStereoCapableWindow(int capable);
00153
00155 virtual unsigned char *GetPixelData(int x,int y,int x2,int y2,int front);
00156 virtual void SetPixelData(int x,int y,int x2,int y2,unsigned char *,
00157 int front);
00158
00160 virtual float *GetRGBAPixelData(int x,int y,int x2,int y2,int front);
00161 virtual void SetRGBAPixelData(int x,int y,int x2,int y2,float *,int front,
00162 int blend=0);
00163 virtual void ReleaseRGBAPixelData(float *data);
00164 virtual unsigned char *GetRGBACharPixelData(int x,int y,int x2,int y2,
00165 int front);
00166 virtual void SetRGBACharPixelData(int x,int y,int x2,int y2,unsigned char *,
00167 int front, int blend=0);
00168
00170 virtual float *GetZbufferData( int x1, int y1, int x2, int y2 );
00171 virtual void SetZbufferData( int x1, int y1, int x2, int y2, float *buffer );
00172
00174 void MakeCurrent();
00175
00178 virtual int GetEventPending();
00179
00182 void SetupMemoryRendering(int x, int y, HDC prn);
00183 void ResumeScreenRendering();
00184 HDC GetMemoryDC();
00185 unsigned char *GetMemoryData(){return this->MemoryData;};
00186
00188 virtual void OpenGLInit();
00189 virtual void SetupPalette(HDC hDC);
00190 virtual void SetupPixelFormat(HDC hDC, DWORD dwFlags, int debug,
00191 int bpp=16, int zbpp=16);
00192
00194 void Clean();
00195
00197 void RegisterTextureResource (GLuint id);
00198
00200 int GetDepthBufferSize();
00201
00204 void HideCursor();
00205 void ShowCursor();
00206
00207 protected:
00208 vtkWin32OpenGLRenderWindow();
00209 ~vtkWin32OpenGLRenderWindow();
00210 vtkWin32OpenGLRenderWindow(const vtkWin32OpenGLRenderWindow&) {};
00211 void operator=(const vtkWin32OpenGLRenderWindow&) {};
00212
00213 HINSTANCE ApplicationInstance;
00214 HPALETTE Palette;
00215 HPALETTE OldPalette;
00216 HGLRC ContextId;
00217 HDC DeviceContext;
00218 BOOL MFChandledWindow;
00219 HWND WindowId;
00220 HWND ParentId;
00221 HWND NextWindowId;
00222 int OwnWindow;
00223 int ScreenSize[2];
00224 int MultiSamples;
00225 vtkIdList *TextureResourceIds;
00226
00227
00228 BITMAPINFO MemoryDataHeader;
00229 HBITMAP MemoryBuffer;
00230 unsigned char *MemoryData;
00231 HDC MemoryHdc;
00232
00233 int ScreenMapped;
00234 int ScreenWindowSize[2];
00235 HDC ScreenDeviceContext;
00236 int ScreenDoubleBuffer;
00237 HGLRC ScreenContextId;
00238
00239
00240
00241 virtual LRESULT MessageProc(HWND hWnd, UINT message,
00242 WPARAM wParam, LPARAM lParam);
00243
00244 static LRESULT APIENTRY WndProc(HWND hWnd, UINT message,
00245 WPARAM wParam, LPARAM lParam);
00246
00247
00248 int CursorHidden;
00249 };
00250
00251
00252 #endif
00253