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

graphics/vtkWin32OpenGLRenderWindow.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkWin32OpenGLRenderWindow.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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   //BTX
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);  // hsr
00135   void  SetDeviceContext(HDC);   // hsr
00136 
00138   virtual void  SetNextWindowId(HWND);
00139   //ETX
00140 
00141   // supply base class virtual function
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   // the following is used to support rendering into memory
00228   BITMAPINFO MemoryDataHeader;
00229   HBITMAP MemoryBuffer;
00230   unsigned char *MemoryData;  // the data in the DIBSection
00231   HDC MemoryHdc;
00232 
00233   int ScreenMapped;
00234   int ScreenWindowSize[2];
00235   HDC ScreenDeviceContext;
00236   int ScreenDoubleBuffer;
00237   HGLRC ScreenContextId;
00238 
00239   //BTX
00240   // message handler
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   //ETX
00247 
00248   int CursorHidden;
00249 };
00250 
00251 
00252 #endif
00253 

Generated on Wed Nov 21 12:27:05 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001