OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / include / vtk / vtkMesaImageWindow.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkMesaImageWindow.h,v $
5   Language:  C++
6   Date:      $Date: 2002/02/01 06:39:58 $
7   Version:   $Revision: 1.1.1.1 $
8
9
10 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15
16  * Redistributions of source code must retain the above copyright notice,
17    this list of conditions and the following disclaimer.
18
19  * Redistributions in binary form must reproduce the above copyright notice,
20    this list of conditions and the following disclaimer in the documentation
21    and/or other materials provided with the distribution.
22
23  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
24    of any contributors may be used to endorse or promote products derived
25    from this software without specific prior written permission.
26
27  * Modified source versions must be plainly marked as such, and must not be
28    misrepresented as being the original software.
29
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
31 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
34 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
36 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
38 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
41 =========================================================================*/
42 // .NAME vtkMesaImageWindow - Mesa Imageing window
43 // .SECTION Description
44 // vtkMesaImageWindow is a concrete implementation of the abstract
45 // class vtkImageWindow. vtkMesaImageer interfaces to the standard
46 // Mesa graphics library in the Windows/NT environment..
47
48 #ifndef __vtkMesaImageWindow_h
49 #define __vtkMesaImageWindow_h
50
51 #include <stdlib.h>
52 #include <X11/X.h>
53 #include <X11/Xlib.h>
54 #include <X11/Xutil.h>
55 #include "vtkXImageWindow.h"
56
57 #ifdef VTK_MANGLE_MESA
58 #define USE_MGL_NAMESPACE
59 #include "mesaglx.h"
60 #else
61 #include "GL/glx.h"
62 #endif
63 #include "GL/osmesa.h"
64
65
66 class VTK_EXPORT vtkMesaImageWindow : public vtkXImageWindow
67 {
68 public:
69   static vtkMesaImageWindow *New();
70   vtkTypeMacro(vtkMesaImageWindow,vtkXImageWindow);
71   void PrintSelf(ostream& os, vtkIndent indent);
72
73   // Description:
74   // Initialize the window for rendering.
75   virtual void MakeDefaultWindow();
76
77   // Description:
78   // Swap the front and back buffers if double buffering is being used.
79   void SwapBuffers();
80
81   // Description:
82   // Flush the buffer and swap if necessary.
83   void Frame();
84
85   // Description:
86   // Draw the contents of the window
87   void Render();
88
89   // Description:
90   // Xwindow get set functions
91   virtual void *GetGenericDisplayId() {return (void *)this->DisplayId;};
92   virtual void *GetGenericWindowId();
93   virtual void *GetGenericParentId()  {return (void *)this->ParentId;};
94   virtual void *GetGenericContext();
95   virtual void *GetGenericDrawable()  {return (void *)this->WindowId;};
96   
97   // Description:
98   // Get the X properties of an ideal rendering window.
99   virtual Colormap GetDesiredColormap();
100   virtual Visual  *GetDesiredVisual();
101   XVisualInfo     *GetDesiredVisualInfo();
102   virtual int      GetDesiredDepth();
103
104   // Description:
105   // Set/Get the pixel data of an image, transmitted as RGBRGB... 
106   virtual unsigned char *GetPixelData(int x,int y,int x2,int y2,int front);
107   virtual void SetPixelData(int x,int y,int x2,int y2,unsigned char *,
108                             int front);
109
110   // Description:
111   // Set/Get the pixel data of an image, transmitted as RGBARGBA... 
112   virtual float *GetRGBAPixelData(int x,int y,int x2,int y2,int front);
113   virtual void SetRGBAPixelData(int x,int y,int x2,int y2,float *,int front,
114                                 int blend=0);
115
116   // Description:
117   // Make this windows Mesa context the current context.
118   void MakeCurrent();
119
120   // Description:
121   // Erase the window contents 
122   virtual void EraseWindow() {this->vtkImageWindow::EraseWindow();};
123
124   // Description:
125   // Override the default implementation so that we can actively switch between
126   // on and offscreen rendering.
127   virtual void SetOffScreenRendering(int i);
128
129 protected:
130   vtkMesaImageWindow();
131   ~vtkMesaImageWindow();
132   vtkMesaImageWindow(const vtkMesaImageWindow&) {};
133   void operator=(const vtkMesaImageWindow&) {};
134
135   GLXContext ContextId;
136   OSMesaContext OffScreenContextId;
137   void *OffScreenWindow;
138   int ScreenDoubleBuffer;
139   int ScreenMapped;
140 };
141
142
143 #endif
144