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;
119 void * BeginBufferAccess(
int & linePad)
noexcept override
122 linePad = BufferFormat().
LinePad;
126 return pixelBuffer_.Map();
130 void EndBufferAccess()
noexcept override
133 pixelBuffer_.Unmap();
135 Image2DTexture(
nullptr,
true);
136 pixelBuffer_.Release();
140 bool MonoUploadSupported()
const noexcept override
153 GLPixelBuffer()
noexcept;
154 GLPixelBuffer(
const GLPixelBuffer& other) =
delete;
155 GLPixelBuffer& operator=(
const GLPixelBuffer& other) =
delete;
156 GLPixelBuffer(GLPixelBuffer&& other) =
delete;
157 GLPixelBuffer& operator=(GLPixelBuffer&& other) =
delete;
160 void Bind()
noexcept;
161 void Release()
noexcept;
163 void Data()
noexcept;
164 void Data(
int size)
noexcept;
166 void * Map()
noexcept;
167 void Unmap()
noexcept;
175 GLPixelBuffer pixelBuffer_;
182 class GL2ImageRenderer
187 GL2ImageRenderer() noexcept
194 void * BeginBufferAccess(
int & )
noexcept override
196 return &pixelBuffer_[0];
199 void EndBufferAccess()
noexcept override
202 Image2DTexture(BufferFormat(), &pixelBuffer_[0],
false);
206 bool MonoUploadSupported()
const noexcept override
222 static bool TryFormat(
const QSurfaceFormat& format,
int minVersion)
noexcept
231 auto effectiveFormat = context.
format();
232 if (effectiveFormat.majorVersion() < minVersion
236 || (effectiveFormat.majorVersion() == 2 && effectiveFormat.renderableType() != QSurfaceFormat::OpenGLES))
238 if (effectiveFormat.profile() == QSurfaceFormat::CoreProfile)
245 static String ReadString(
int version,
int value)
252 throw std::runtime_error(
"failed to create context for already verified OpenGL version.");
260 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:238
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()