16 #ifndef vtkOpenGLRenderWindow_h
17 #define vtkOpenGLRenderWindow_h
21 #include "vtkRenderingOpenGL2Module.h"
28 VTK_ABI_NAMESPACE_BEGIN
32 class vtkOpenGLHardwareSupport;
50 #if !(defined(__APPLE__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__))
60 void Start()
override;
66 void Frame()
override;
77 static void SetGlobalMaximumNumberOfMultiSamples(
int val);
78 static int GetGlobalMaximumNumberOfMultiSamples();
87 static void SetUseGenericOpenGLRenderWindow(
bool val);
88 static bool GetUseGenericOpenGLRenderWindow();
97 unsigned char*
GetPixelData(
int x,
int y,
int x2,
int y2,
int front,
int right)
override;
101 int x,
int y,
int x2,
int y2,
unsigned char*
data,
int front,
int right)
override;
110 float*
GetRGBAPixelData(
int x,
int y,
int x2,
int y2,
int front,
int right = 0)
override;
112 int x,
int y,
int x2,
int y2,
int front,
vtkFloatArray*
data,
int right = 0)
override;
114 int x,
int y,
int x2,
int y2,
float*
data,
int front,
int blend = 0,
int right = 0)
override;
116 int right = 0)
override;
119 int x,
int y,
int x2,
int y2,
int front,
int right = 0)
override;
123 int blend = 0,
int right = 0)
override;
125 int blend = 0,
int right = 0)
override;
133 int GetZbufferData(
int x1,
int y1,
int x2,
int y2,
float* z)
override;
135 int SetZbufferData(
int x1,
int y1,
int x2,
int y2,
float* buffer)
override;
162 bool GetUsingSRGBColorSpace();
175 int GetColorBufferInternalFormat(
int attachmentPoint);
180 virtual void OpenGLInit();
183 virtual void OpenGLInitState();
186 virtual void OpenGLInitContext();
193 void GetOpenGLVersion(
int& major,
int& minor);
242 virtual void DrawPixels(
243 int x1,
int y1,
int x2,
int y2,
int numComponents,
int dataType,
void*
data);
249 virtual void DrawPixels(
int dstXmin,
int dstYmin,
int dstXmax,
int dstYmax,
int srcXmin,
250 int srcYmin,
int srcXmax,
int srcYmax,
int srcWidth,
int srcHeight,
int numComponents,
251 int dataType,
void*
data);
257 virtual void DrawPixels(
int srcWidth,
int srcHeight,
int numComponents,
int dataType,
void*
data);
281 bool IsPrimIDBugPresent();
288 int GetDefaultTextureInternalFormat(
289 int vtktype,
int numComponents,
bool needInteger,
bool needFloat,
bool needSRGB);
316 std::set<vtkGenericOpenGLResourceFreeCallback*>
Resources;
320 std::set<vtkGenericOpenGLResourceFreeCallback*>::iterator it = this->Resources.find(cb);
321 if (it == this->Resources.end())
323 this->Resources.insert(cb);
329 std::set<vtkGenericOpenGLResourceFreeCallback*>::iterator it = this->Resources.find(cb);
330 if (it != this->Resources.end())
332 this->Resources.erase(it);
378 int GetNoiseTextureUnit();
397 bool GetBufferNeedsResolving();
409 void BlitDisplayFramebuffer();
415 void BlitDisplayFramebufferColorAndDepth();
420 void BlitDisplayFramebuffer(
int right,
int srcX,
int srcY,
int srcWidth,
int srcHeight,
int destX,
421 int destY,
int destWidth,
int destHeight,
int bufferMode,
int interpolation);
428 void BlitToRenderFramebuffer(
bool includeDepth);
429 void BlitToRenderFramebuffer(
int srcX,
int srcY,
int srcWidth,
int srcHeight,
int destX,
430 int destY,
int destWidth,
int destHeight,
int bufferMode,
int interpolation);
471 vtkSetClampMacro(FrameBlitMode, FrameBlitModes, BlitToHardware, NoBlit);
472 vtkGetMacro(FrameBlitMode, FrameBlitModes);
477 this->SetFrameBlitMode(BlitToCurrentWithDepth);
486 vtkSetMacro(FramebufferFlipY,
bool);
487 vtkGetMacro(FramebufferFlipY,
bool);
488 vtkBooleanMacro(FramebufferFlipY,
bool);
495 vtkSetMacro(RenderBufferTargetDepthSize,
int);
496 vtkGetMacro(RenderBufferTargetDepthSize,
int);
513 int destX,
int destY,
int destX2,
int destY2);
516 typedef void (*VTKOpenGLAPIProc)();
517 typedef VTKOpenGLAPIProc (*VTKOpenGLLoaderFunction)(
void* userptr,
const char*
name);
528 void SetOpenGLSymbolLoader(VTKOpenGLLoaderFunction loader,
void* userData);
545 void SetOpenGLSymbolLoader2(
long long toolGetProcAddressFunc,
long long glLibHandle);
552 virtual void BlitDisplayFramebuffersToHardware();
576 virtual bool ResolveFlipRenderFramebuffer();
585 bool ReadDepthComponent(
int depthSize);
593 virtual int ReadPixels(
594 const vtkRecti& rect,
int front,
int glFormat,
int glType,
void*
data,
int right = 0);
604 int CreateFramebuffers(
int width,
int height);
619 virtual void CreateAWindow() = 0;
624 virtual void DestroyWindow() = 0;
634 void RestoreGLState();
669 VTKOpenGLLoaderFunction LoadFunction =
nullptr;
670 void* UserData =
nullptr;
673 typedef VTKOpenGLAPIProc (*VTKOpenGLGetProcAddress)(
const char*
name);
676 VTKOpenGLGetProcAddress resolveFunc =
nullptr;
677 void* libHandle =
nullptr;
688 #if !(defined(__APPLE__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__))
689 #define vtkOpenGLRenderWindow_OVERRIDE_ATTRIBUTES vtkOpenGLRenderWindow::CreateOverrideAttributes()
691 VTK_ABI_NAMESPACE_END
std::set< vtkGenericOpenGLResourceFreeCallback * > Resources
vtkOpenGLFramebufferObject * ResolveFramebuffer
virtual void Start()
Start the rendering process for a frame.
Attribute for vtkObjectFactory overrides.
std::string OpenGLSupportMessage
vtkTypeBool OwnContext
Flag telling if the context has been created here or was inherited.
virtual int GetDepthBufferSize()
This method should be defined by the subclass.
float MaximumHardwareLineWidth
virtual float * GetZbufferData(int, int, int, int)
Set/Get the zbuffer data from the frame buffer.
void SetFrameBlitModeToBlitToHardware()
SetGet how to handle blits at the end of a Frame() call.
virtual void PopContext()
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
virtual int SetPixelData(int, int, int, int, unsigned char *, int, int=0)
Set/Get the pixel data of an image, transmitted as RGBRGBRGB.
vtkTypeUInt32 vtkMTimeType
vtkTimeStamp ContextCreationTime
manage Shader Programs within a context
void UnregisterGraphicsResources(vtkGenericOpenGLResourceFreeCallback *cb)
virtual int GetColorBufferSizes(int *)
Get the size of the color buffer.
static vtkRenderWindow * New()
Construct an instance of vtkRenderWindow with its screen size set to 300x300, borders turned on...
record modification and/or execution time
void SetFrameBlitModeToBlitToCurrent()
SetGet how to handle blits at the end of a Frame() call.
FrameBlitModes FrameBlitMode
dynamic, self-adjusting array of float
vtkOpenGLQuadHelper * FlipQuad
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
void Render() override
Ask each renderer owned by this RenderWindow to render its image and synchronize this process...
void SetFrameBlitModeToBlitToCurrentWithDepth()
SetGet how to handle blits at the end of a Frame() call.
vtkOpenGLFramebufferObject * DepthFramebuffer
vtkOpenGLQuadHelper * DepthReadQuad
window superclass for vtkRenderWindow
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 SetZbufferData(int, int, int, int, float *)
Set/Get the zbuffer data from the frame buffer.
manage texture-buffer-backed data arrays shared within a context
a simple class to control print indentation
The VertexArrayObject class uses, or emulates, vertex array objects.
vtkTextureObject * DrawPixelsTextureObject
list of point or cell ids
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void WaitForCompletion()
Block the thread until the actual rendering is finished().
void Initialize() override
Initialize the rendering window.
void RegisterGraphicsResources(vtkGenericOpenGLResourceFreeCallback *cb)
handles properties associated with a texture map
virtual void ReleaseRGBAPixelData(float *)
Same as Get/SetPixelData except that the image also contains an alpha component.
virtual void MakeCurrent()
Make the window current.
virtual void PushContext()
Ability to push and pop this window's context as the current context.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Internal class which encapsulates OpenGL FramebufferObject.
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.
abstracts an OpenGL texture object.
virtual int SetRGBAPixelData(int, int, int, int, float *, int, int=0, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
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.
void SetFrameBlitModeToNoBlit()
SetGet how to handle blits at the end of a Frame() call.
virtual float GetMaximumHardwareLineWidth()
Return the largest line width supported by the hardware.
virtual unsigned char * GetRGBACharPixelData(int, int, int, int, int, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
virtual void StereoMidpoint()
Intermediate method performs operations required between the rendering of the left and right eye...
vtkOpenGLQuadHelper * DepthBlitQuad
Class to make rendering a full screen quad easier.
FrameBlitModes
Define how the resulting image should be blitted when at the end of the Frame() call if SwapBuffers i...
vtkOpenGLFramebufferObject * RenderFramebuffer
virtual void End()
Update the system, if needed, at end of render process.
virtual float * GetRGBAPixelData(int, int, int, int, int, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.
vtkOpenGLBufferObject * TQuad2DVBO
virtual vtkOpenGLState * GetState()
virtual bool IsPointSpriteBugPresent()
Returns true if driver has an EGL/OpenGL bug that makes vtkChartsCoreCxx-TestChartDoubleColors and ot...
int RenderBufferTargetDepthSize
std::map< std::string, int > GLStateIntegers
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
vtkOpenGLQuadHelper * ResolveQuad
virtual void Frame()
A termination method performed at the end of the rendering process to do things like swapping buffers...
vtkOpenGLFramebufferObject * DisplayFramebuffer
The ShaderProgram uses one or more Shader objects.
virtual int SetRGBACharPixelData(int, int, int, int, unsigned char *, int, int=0, int=0)
Same as Get/SetPixelData except that the image also contains an alpha component.