28 #ifndef vtkOpenGLRenderWindow_h 29 #define vtkOpenGLRenderWindow_h 33 #include "vtkRenderingOpenGL2Module.h" 41 class vtkOpenGLHardwareSupport;
68 static void SetGlobalMaximumNumberOfMultiSamples(
int val);
69 static int GetGlobalMaximumNumberOfMultiSamples();
76 unsigned char *
GetPixelData(
int x,
int y,
int x2,
int y2,
int front,
int right)
81 int front,
int right)
override;
96 int front,
int blend=0,
int right=0)
override;
98 int front,
int blend=0,
int right=0)
override;
101 int front,
int right=0)
override;
106 unsigned char *
data,
int front,
107 int blend=0,
int right=0)
override;
110 int blend=0,
int right=0)
override;
118 int GetZbufferData(
int x1,
int y1,
int x2,
int y2,
float* z )
override;
121 int SetZbufferData(
int x1,
int y1,
int x2,
int y2,
float *buffer )
override;
150 bool GetUsingSRGBColorSpace();
163 int GetColorBufferInternalFormat(
int attachmentPoint);
169 void SetSize(
int a[2])
override;
170 void SetSize(
int,
int)
override;
176 virtual void OpenGLInit();
179 virtual void OpenGLInitState();
182 virtual void OpenGLInitContext();
189 void GetOpenGLVersion(
int &major,
int &minor);
198 unsigned int GetBackLeftBuffer();
207 unsigned int GetBackRightBuffer();
216 unsigned int GetFrontLeftBuffer();
225 unsigned int GetFrontRightBuffer();
234 unsigned int GetBackBuffer();
243 unsigned int GetFrontBuffer();
268 vtkGetMacro(FrameBufferObject,
unsigned int);
286 virtual void DrawPixels(
int x1,
int y1,
int x2,
int y2,
287 int numComponents,
int dataType,
void *
data);
293 virtual void DrawPixels(
294 int dstXmin,
int dstYmin,
int dstXmax,
int dstYmax,
295 int srcXmin,
int srcYmin,
int srcXmax,
int srcYmax,
296 int srcWidth,
int srcHeight,
int numComponents,
int dataType,
void *
data);
302 virtual void DrawPixels(
303 int srcWidth,
int srcHeight,
int numComponents,
int dataType,
void *
data);
309 return this->MaximumHardwareLineWidth; };
327 int GetDefaultTextureInternalFormat(
328 int vtktype,
int numComponents,
329 bool needInteger,
bool needFloat,
bool needSRGB);
338 return this->OpenGLSupportMessage;
366 virtual void Initialize(
void) {};
368 std::set<vtkGenericOpenGLResourceFreeCallback *>
Resources;
371 std::set<vtkGenericOpenGLResourceFreeCallback *>::iterator it
372 = this->Resources.find(cb);
373 if (it == this->Resources.end())
375 this->Resources.insert(cb);
380 std::set<vtkGenericOpenGLResourceFreeCallback *>::iterator it
381 = this->Resources.find(cb);
382 if (it != this->Resources.end())
384 this->Resources.erase(it);
413 vtkGetMacro(DefaultFrameBufferId,
unsigned int);
429 return this->State; }
440 int GetNoiseTextureUnit();
475 void InitializeTextureInternalFormats();
479 virtual int ReadPixels(
const vtkRecti& rect,
int front,
int glFormat,
int glType,
void*
data,
int right=0);
490 int CreateHardwareOffScreenWindow(
int width,
int height);
492 int CreateHardwareOffScreenBuffers(
int width,
int height,
bool bind =
false);
493 void BindHardwareOffScreenBuffers();
500 void DestroyHardwareOffScreenWindow();
502 void UnbindHardwareOffScreenBuffers();
503 void DestroyHardwareOffScreenBuffers();
515 unsigned int TextureObjects[4];
518 int HardwareBufferSize[2];
525 virtual void CreateAWindow() = 0;
530 virtual void DestroyWindow() = 0;
552 void RestoreGLState();
int OwnContext
Flag telling if the context has been created here or was inherited.
Wrapper around std::string to keep symbols short.
virtual unsigned char * GetPixelData(int x, int y, int x2, int y2, int front, int right=0)=0
Get the pixel data of an image, transmitted as RGBRGBRGB.
int OffScreenUseFrameBuffer
Flag telling if a framebuffer-based offscreen is currently in use.
std::string OpenGLSupportMessage
virtual int SetUseOffScreenBuffers(bool)
Create and bind offscreen rendering buffers without destroying the current OpenGL context...
float MaximumHardwareLineWidth
virtual void PopContext()
virtual int SetRGBAPixelData(int x, int y, int x2, int y2, float *, int front, int blend=0, int right=0)=0
Same as Get/SetPixelData except that the image also contains an alpha component.
vtkTypeUInt32 vtkMTimeType
vtkTimeStamp ContextCreationTime
manage Shader Programs within a context
int NumberOfFrameBuffers
Variables used by the framebuffer-based offscreen method.
void UnregisterGraphicsResources(vtkGenericOpenGLResourceFreeCallback *cb)
bool HardwareOffScreenBuffersBind
Variables used by the framebuffer-based offscreen method.
record modification and/or execution time
dynamic, self-adjusting array of float
vtkTextureUnitManager * TextureUnitManager
std::string GetOpenGLSupportMessage()
Return a message profiding additional details about the results of calling SupportsOpenGL() This can ...
manage vertex buffer objects shared within a context
virtual int GetColorBufferSizes(int *rgba)=0
Get the size of the color buffer.
void Render() override
Ask each renderer owned by this RenderWindow to render its image and synchronize this process...
#define VTK_UNICODE_STRING
unsigned int FrontLeftBuffer
virtual int SetPixelData(int x, int y, int x2, int y2, unsigned char *data, int front, int right=0)=0
Set/Get the pixel data of an image, transmitted as RGBRGBRGB.
virtual void SetSize(int, int)
Set/Get the size of the window in screen coordinates in pixels.
virtual const char * ReportCapabilities()
Get report of capabilities for the render window.
virtual int SupportsOpenGL()
Does this render window support OpenGL? 0-false, 1-true.
virtual int SetRGBACharPixelData(int x, int y, int x2, int y2, unsigned char *data, int front, int blend=0, int right=0)=0
Same as Get/SetPixelData except that the image also contains an alpha component.
std::map< const vtkTextureObject *, int > TextureResourceIds
a simple class to control print indentation
virtual float * GetRGBAPixelData(int x, int y, int x2, int y2, int front, int right=0)=0
Same as Get/SetPixelData except that the image also contains an alpha component.
The VertexArrayObject class uses, or emulates, vertex array objects.
virtual void ReleaseRGBAPixelData(float *data)=0
Same as Get/SetPixelData except that the image also contains an alpha component.
vtkTextureObject * DrawPixelsTextureObject
unsigned int FrameBufferObject
Variables used by the framebuffer-based offscreen method.
list of point or cell ids
unsigned int BackLeftBuffer
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int GetDepthBufferSize()=0
This method should be defined by the subclass.
void RegisterGraphicsResources(vtkGenericOpenGLResourceFreeCallback *cb)
virtual int SetZbufferData(int x, int y, int x2, int y2, float *z)=0
Set/Get the zbuffer data from the frame buffer.
handles properties associated with a texture map
virtual void StereoUpdate()
Update the system, if needed, due to stereo rendering.
virtual void PushContext()
Ability to push and pop this window's context as the current context.
unsigned int DefaultFrameBufferId
virtual unsigned char * GetRGBACharPixelData(int x, int y, int x2, int y2, int front, int right=0)=0
Same as Get/SetPixelData except that the image also contains an alpha component.
vtkTextureObject * NoiseTextureObject
dynamic, self-adjusting array of unsigned char
virtual bool SetSwapControl(int)
Set the number of vertical syncs required between frames.
allocate/free texture units.
vtkOpenGLShaderCache * ShaderCache
abstracts an OpenGL texture object.
unsigned int BackRightBuffer
create a window for renderers to draw into
virtual bool InitializeFromCurrentContext()
Initialize the render window from the information associated with the currently activated OpenGL cont...
virtual const char * GetRenderingBackend()
What rendering backend has the user requested.
std::set< vtkGenericOpenGLResourceFreeCallback * > Resources
virtual float GetMaximumHardwareLineWidth()
Return the largest line width supported by the hardware.
virtual void StereoMidpoint()
Intermediate method performs operations required between the rendering of the left and right eye...
virtual float * GetZbufferData(int x, int y, int x2, int y2)=0
Set/Get the zbuffer data from the frame buffer.
unsigned int FrontRightBuffer
vtkOpenGLBufferObject * TQuad2DVBO
unsigned int DepthRenderBufferObject
Variables used by the framebuffer-based offscreen method.
virtual vtkOpenGLState * GetState()
virtual bool GetUseOffScreenBuffers()
virtual void WaitForCompletion()=0
Block the thread until the actual rendering is finished().
virtual bool IsPointSpriteBugPresent()
Returns true if driver has an EGL/OpenGL bug that makes vtkChartsCoreCxx-TestChartDoubleColors and ot...
std::map< std::string, int > GLStateIntegers
void MakeCurrent() override=0
Attempt to make this window the current graphics context for the calling thread.
vtkOpenGLVertexBufferObjectCache * VBOCache
The ShaderProgram uses one or more Shader objects.