1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkMesaImageWindow.h,v $
6 Date: $Date: 2002/02/01 06:39:58 $
7 Version: $Revision: 1.1.1.1 $
10 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
16 * Redistributions of source code must retain the above copyright notice,
17 this list of conditions and the following disclaimer.
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.
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.
27 * Modified source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
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.
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..
48 #ifndef __vtkMesaImageWindow_h
49 #define __vtkMesaImageWindow_h
54 #include <X11/Xutil.h>
55 #include "vtkXImageWindow.h"
57 #ifdef VTK_MANGLE_MESA
58 #define USE_MGL_NAMESPACE
63 #include "GL/osmesa.h"
66 class VTK_EXPORT vtkMesaImageWindow : public vtkXImageWindow
69 static vtkMesaImageWindow *New();
70 vtkTypeMacro(vtkMesaImageWindow,vtkXImageWindow);
71 void PrintSelf(ostream& os, vtkIndent indent);
74 // Initialize the window for rendering.
75 virtual void MakeDefaultWindow();
78 // Swap the front and back buffers if double buffering is being used.
82 // Flush the buffer and swap if necessary.
86 // Draw the contents of the window
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;};
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();
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 *,
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,
117 // Make this windows Mesa context the current context.
121 // Erase the window contents
122 virtual void EraseWindow() {this->vtkImageWindow::EraseWindow();};
125 // Override the default implementation so that we can actively switch between
126 // on and offscreen rendering.
127 virtual void SetOffScreenRendering(int i);
130 vtkMesaImageWindow();
131 ~vtkMesaImageWindow();
132 vtkMesaImageWindow(const vtkMesaImageWindow&) {};
133 void operator=(const vtkMesaImageWindow&) {};
135 GLXContext ContextId;
136 OSMesaContext OffScreenContextId;
137 void *OffScreenWindow;
138 int ScreenDoubleBuffer;