VTK  9.5.20250814
vtkEGLRenderWindowInternals.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef vtkEGLRenderWindowInternals_h
5#define vtkEGLRenderWindowInternals_h
6
8#include "vtkOpenGLRenderer.h"
9
10#include "vtkglad/include/glad/egl.h"
11
12VTK_ABI_NAMESPACE_BEGIN
13
19class VTKRENDERINGOPENGL2_EXPORT vtkEGLRenderWindowInternals
20{
21public:
25 [[nodiscard]] EGLDisplay GetDisplay() const { return this->Display; }
26
30 [[nodiscard]] EGLDisplay GetSurface() const { return this->Surface; }
31
33
36 [[nodiscard]] EGLContext GetContext() const { return this->Context; }
37 void SetContext(EGLContext context) { this->Context = context; }
39
41
44 [[nodiscard]] EGLNativeWindowType GetWindow() const { return this->Window; }
45 void SetWindow(EGLNativeWindowType window) { this->Window = window; }
47
51 void SwapBuffer();
52
56 [[nodiscard]] int GetNumberOfDevices();
57
62 [[nodiscard]] bool SetDeviceAsDisplay(int deviceIndex);
63
68
73 void ConfigureWindow(int width, int height);
74
78 void SetDeviceIndex(int deviceIndex) { this->DeviceIndex = deviceIndex; };
79
84 void SetUseOnscreenRendering(bool useOnscreenRendering);
85
89 void GetSizeFromSurface(int* size);
90
95
101
104
105private:
106 EGLNativeWindowType Window;
107 EGLDisplay Display;
108 EGLSurface Surface;
109 EGLContext Context;
110
111 int DeviceIndex = -1;
112 bool UseOnscreenRendering = false;
113
114 std::unique_ptr<vtkEGLConfig> Config;
115};
116
117VTK_ABI_NAMESPACE_END
118#endif
Internal class used to store and control EGL state.
void SwapBuffer()
Ensure to call the SwapBuffers() on the correct display and surface.
EGLNativeWindowType GetWindow() const
Get/Set the EGLWindow.
EGLDisplay GetDisplay() const
Return the EGLDisplay.
bool SetDeviceAsDisplay(int deviceIndex)
Set the wanted device for display if the device is available.
EGLDisplay GetSurface() const
Return the EGLSurface.
void SetUseOnscreenRendering(bool useOnscreenRendering)
Setter to handle onscreen rendering.
void ConfigureWindow(int width, int height)
Configure the current EGLWindow with the requested size.
~vtkEGLRenderWindowInternals()=default
bool MakeCurrent()
Try to attach the EGL rendering context to the EGL surface.
void SetContext(EGLContext context)
Get/Set the EGLContext.
EGLContext GetContext() const
Get/Set the EGLContext.
void SetDeviceIndex(int deviceIndex)
Setter used to store the device expected by the user.
void ReleaseCurrent()
Release the EGL state.
int GetNumberOfDevices()
Get the number of devices (graphic cards) from the system.
void SetWindow(EGLNativeWindowType window)
Get/Set the EGLWindow.
void GetSizeFromSurface(int *size)
Get the current size of the EGLSurface.
void DestroyWindow()
Release EGL window.