4#pragma warning ( push, 1)
5#pragma warning ( disable : 4127)
6#pragma warning ( disable : 4005)
9#include <QSurfaceFormat>
10#include <QOffscreenSurface>
14#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
15#include <QOpenGLExtraFunctions>
23#include "../../global.hpp"
27#include "decl_opengl_image_renderer.hpp"
109#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
110 class GL3ImageRenderer
115 GL3ImageRenderer()
noexcept;
117 ~GL3ImageRenderer() =
default;
121 void * BeginBufferAccess(
int & linePad)
noexcept override
125 linePad = BufferFormat().
LinePad;
127 pixelBuffer_->Bind();
128 pixelBuffer_->Data();
129 return pixelBuffer_->Map();
135 void EndBufferAccess()
noexcept override
139 pixelBuffer_->Unmap();
141 Image2DTexture(
nullptr,
true);
142 pixelBuffer_->Release();
148 bool MonoUploadSupported()
const noexcept override
161 GLPixelBuffer()
noexcept;
164 void Bind()
noexcept;
165 void Release()
noexcept;
167 void Data()
noexcept;
168 void Data(
int size)
noexcept;
170 void * Map()
noexcept;
171 void Unmap()
noexcept;
186 class GL2ImageRenderer
191 GL2ImageRenderer() noexcept
196 ~GL2ImageRenderer() =
default;
200 void * BeginBufferAccess(
int & )
noexcept override
202 return &pixelBuffer_[0];
205 void EndBufferAccess()
noexcept override
208 Image2DTexture(BufferFormat(), &pixelBuffer_[0],
false);
212 bool MonoUploadSupported()
const noexcept override
228 static bool TryFormat(
const QSurfaceFormat& format,
int minVersion)
noexcept
237 auto effectiveFormat = context.
format();
238 if (effectiveFormat.majorVersion() < minVersion
242 || (effectiveFormat.majorVersion() == 2 && effectiveFormat.renderableType() != QSurfaceFormat::OpenGLES))
244 if (effectiveFormat.profile() == QSurfaceFormat::CoreProfile)
251 static String ReadString(
int version,
int value)
258 throw std::runtime_error(
"failed to create context for already verified OpenGL version.");
266 QString vendor(
reinterpret_cast<const char*
>(fnc.
glGetString(
static_cast<GLenum
>(value))));
Factory to create an OpenGL based image renderer.
Definition: decl_opengl_image_renderer_factory.hpp:48
static QSurfaceFormat CreateFormat(int version)
Create a OpenGL format for the given version.
Definition: detail_opengl_image_renderer_factory.hpp:36
static String VendorName(int version)
Get the name of the OpenGL vendor.
Definition: detail_opengl_image_renderer_factory.hpp:88
static bool TryVersion(int version) noexcept
Test if a OpenGL version is implemented on your system.
Definition: detail_opengl_image_renderer_factory.hpp:49
static String RendererName(int version)
Gets the name of the OpenGL renderer.
Definition: detail_opengl_image_renderer_factory.hpp:93
static std::unique_ptr< OpenGLImageRenderer > CreateRenderer(int version)
Create a renderer.
Definition: detail_opengl_image_renderer_factory.hpp:18
Base class for OpenGL image renderer.
Definition: decl_opengl_image_renderer.hpp:45
Cvb::String QtToCvb(const QString text) noexcept
Convenience converter for strings.
Definition: ui.hpp:239
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
QSurfaceFormat format() const const
bool makeCurrent(QSurface *surface)
void setFormat(const QSurfaceFormat &format)
const GLubyte * glGetString(GLenum name)
void initializeOpenGLFunctions()
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const const
QString currentCpuArchitecture()