CVB++ 14.0
OpenGLImageRenderer Class Referenceabstract

Base class for OpenGL image renderer. More...

#include <cvb/ui/opengl_image_renderer.hpp>

Inherits QOpenGLFunctions.

Public Member Functions

void UpdateMaping (const QRectF &sourceRect, Size2D< int > textureSize) noexcept
 Updates the vertex and texture coordinates before rendering. More...
 
void Render (const QRectF &viewportRect) noexcept
 Actually renders the image. More...
 
OpenGLBufferFormat BufferFormat () const noexcept
 Returns the current buffer format. More...
 
virtual void * BeginBufferAccess (int &linePad) noexcept=0
 Maps the pixel buffer to upload data. More...
 
virtual void EndBufferAccess () noexcept=0
 End the pixel buffer mapping. More...
 
virtual void UpdateBufferFormat (const OpenGLBufferFormat &bufferFormat) noexcept=0
 Updates the buffer format associated with the current rendering. More...
 
virtual bool MonoUploadSupported () const noexcept=0
 Check if a mono image can be uploaded without duplicating the date in the color channels. More...
 

Detailed Description

Base class for OpenGL image renderer.

You dot need to use this class to render the image with CvbQtImageView. However this class is meant for convenient usage with a custom OpenGL context, in order to render the image to something different than CvbQtImageView. Please be aware that for all member function a QOpenGLContext must be current.

Note
The use of this class is an advanced topic and requires significant knowledge about Qt and OpenGL!

Member Function Documentation

◆ BeginBufferAccess()

virtual void * BeginBufferAccess ( int &  linePad)
pure virtualnoexcept

Maps the pixel buffer to upload data.

Parameters
[out]linePadLine padding used by the current buffer format, for convenience.
Returns
Pointer to the buffer.
Exceptions
Doesnot throw any exception.

◆ BufferFormat()

OpenGLBufferFormat BufferFormat ( ) const
inlinenoexcept

Returns the current buffer format.

Returns
The buffer format associated with the current rendering.
Exceptions
Doesnot throw any exception.

◆ EndBufferAccess()

virtual void EndBufferAccess ( )
pure virtualnoexcept

End the pixel buffer mapping.

Exceptions
Doesnot throw any exception.

◆ MonoUploadSupported()

virtual bool MonoUploadSupported ( ) const
pure virtualnoexcept

Check if a mono image can be uploaded without duplicating the date in the color channels.

Returns
True if supported false otherwise.
Exceptions
Doesnot throw any exception.

◆ Render()

void Render ( const QRectF viewportRect)
inlinenoexcept

Actually renders the image.

Parameters
[in]viewportRectVisible rectangle of the image.
Exceptions
Doesnot throw any exception.

This method does not reset the OpenGL state, and does not clear anything. Make sure you are in a suitable state for rendering a texture.

◆ UpdateBufferFormat()

virtual void UpdateBufferFormat ( const OpenGLBufferFormat bufferFormat)
pure virtualnoexcept

Updates the buffer format associated with the current rendering.

Parameters
[in]bufferFormatThe new buffer format.
Exceptions
Doesnot throw any exception.

◆ UpdateMaping()

void UpdateMaping ( const QRectF sourceRect,
Size2D< int >  textureSize 
)
inlinenoexcept

Updates the vertex and texture coordinates before rendering.

Parameters
[in]sourceRectRectangle holding the vertex coordinates for the visible part of the texture.
[in]textureSizePixel size of the texture to adjust the texture coordinates for e.g. sub pixel scrolling. This is only relevant if vertex coordinates have a fractional part.
Exceptions
Doesnot throw any exception.