LibreOffice Module vcl (master) 1
Public Member Functions | Static Public Member Functions | List of all members
OpenGLHelper Struct Reference

#include <OpenGLHelper.hxx>

Public Member Functions

 OpenGLHelper ()=delete
 

Static Public Member Functions

static GLint LoadShaders (const OUString &rVertexShaderName, const OUString &rFragmentShaderName, const OUString &rGeometryShaderName, std::string_view preamble, std::string_view rDigest)
 
static GLint LoadShaders (const OUString &rVertexShaderName, const OUString &rFragmentShaderName, std::string_view preamble, std::string_view rDigest)
 
static GLint LoadShaders (const OUString &rVertexShaderName, const OUString &rFragmentShaderName, const OUString &rGeometryShaderName)
 
static GLint LoadShaders (const OUString &rVertexShaderName, const OUString &rFragmentShaderName)
 
static BitmapEx ConvertBufferToBitmapEx (const sal_uInt8 *const pBuffer, tools::Long nWidth, tools::Long nHeight)
 The caller is responsible for allocating the memory for the buffer before calling this method. More...
 
static GLenum OptimalBufferFormat ()
 Returns the optimal buffer format for OpenGL (GL_BGRA or GL_RGBA). More...
 
static void renderToFile (tools::Long nWidth, tools::Long nHeight, const OUString &rFileName)
 
static const char * GLErrorString (GLenum errorCode)
 
static void createFramebuffer (tools::Long nWidth, tools::Long nHeight, GLuint &nFramebufferId, GLuint &nRenderbufferDepthId, GLuint &nRenderbufferColorId)
 The caller is responsible for deleting the buffer objects identified by nFramebufferId, nRenderbufferDepthId and nRenderbufferColorId. More...
 
static float getGLVersion ()
 Get OpenGL version (needs a context) More...
 
static void checkGLError (const char *aFile, size_t nLine)
 
static void debugMsgPrint (const int nType, const char *pFormat,...)
 Insert a glDebugMessage into the queue - helpful for debugging with apitrace to annotate the output and correlate it with code. More...
 
static void debugMsgStream (std::ostringstream const &pStream)
 
static void debugMsgStreamWarn (std::ostringstream const &pStream)
 
static bool isDeviceDenylisted ()
 checks if the device/driver pair is on our OpenGL denylist More...
 
static bool supportsOpenGL ()
 checks if the system supports all features that are necessary for the OpenGL support More...
 

Detailed Description

Definition at line 45 of file OpenGLHelper.hxx.

Constructor & Destructor Documentation

◆ OpenGLHelper()

OpenGLHelper::OpenGLHelper ( )
delete

Member Function Documentation

◆ checkGLError()

void OpenGLHelper::checkGLError ( const char *  aFile,
size_t  nLine 
)
static

Definition at line 721 of file OpenGLHelper.cxx.

References GLErrorString(), and SAL_WARN.

◆ ConvertBufferToBitmapEx()

BitmapEx OpenGLHelper::ConvertBufferToBitmapEx ( const sal_uInt8 *const  pBuffer,
tools::Long  nWidth,
tools::Long  nHeight 
)
static

The caller is responsible for allocating the memory for the buffer before calling this method.

The buffer size is assumed to be 4*width*height and the format to be OptimalBufferFormat().

Definition at line 554 of file OpenGLHelper.cxx.

References vcl::N24_BPP, N24BitTcBgr, N24BitTcRgb, N8BitPal, x, and y.

Referenced by renderToFile().

◆ createFramebuffer()

void OpenGLHelper::createFramebuffer ( tools::Long  nWidth,
tools::Long  nHeight,
GLuint &  nFramebufferId,
GLuint &  nRenderbufferDepthId,
GLuint &  nRenderbufferColorId 
)
static

The caller is responsible for deleting the buffer objects identified by nFramebufferId, nRenderbufferDepthId and nRenderbufferColorId.

This create a buffer for rendering to texture and should be freed with glDeleteTextures.

Parameters
nWidthWidth of frame
nHeightHeight of frame
nFramebufferIdFrameBuffer ID
nRenderbufferDepthIdRenderBuffer's depth ID
nRenderbufferColorIdRenderBuffer's color ID

Definition at line 658 of file OpenGLHelper.cxx.

References CHECK_GL_ERROR, and SAL_WARN.

◆ debugMsgPrint()

void OpenGLHelper::debugMsgPrint ( const int  nType,
const char *  pFormat,
  ... 
)
static

Insert a glDebugMessage into the queue - helpful for debugging with apitrace to annotate the output and correlate it with code.

Definition at line 893 of file OpenGLHelper.cxx.

References OpenGLContext::hasCurrent(), nType, SAL_INFO, and SAL_WARN.

Referenced by debugMsgStream(), and debugMsgStreamWarn().

◆ debugMsgStream()

void OpenGLHelper::debugMsgStream ( std::ostringstream const &  pStream)
static

Definition at line 881 of file OpenGLHelper.cxx.

References debugMsgPrint().

◆ debugMsgStreamWarn()

void OpenGLHelper::debugMsgStreamWarn ( std::ostringstream const &  pStream)
static

Definition at line 887 of file OpenGLHelper.cxx.

References debugMsgPrint().

◆ getGLVersion()

float OpenGLHelper::getGLVersion ( )
static

Get OpenGL version (needs a context)

Definition at line 704 of file OpenGLHelper.cxx.

References CHECK_GL_ERROR.

Referenced by OpenGLContext::InitGL().

◆ GLErrorString()

const char * OpenGLHelper::GLErrorString ( GLenum  errorCode)
static

Definition at line 598 of file OpenGLHelper.cxx.

References code, and i.

Referenced by checkGLError().

◆ isDeviceDenylisted()

bool OpenGLHelper::isDeviceDenylisted ( )
static

checks if the device/driver pair is on our OpenGL denylist

Definition at line 748 of file OpenGLHelper.cxx.

References WinOpenGLDeviceInfo::GetAdapterVendorID(), WinOpenGLDeviceInfo::isDeviceBlocked(), OpenGLZone::relaxWatchdogTimings(), and SAL_INFO.

Referenced by supportsOpenGL().

◆ LoadShaders() [1/4]

GLint OpenGLHelper::LoadShaders ( const OUString &  rVertexShaderName,
const OUString &  rFragmentShaderName 
)
static

Definition at line 520 of file OpenGLHelper.cxx.

References LoadShaders().

◆ LoadShaders() [2/4]

GLint OpenGLHelper::LoadShaders ( const OUString &  rVertexShaderName,
const OUString &  rFragmentShaderName,
const OUString &  rGeometryShaderName 
)
static

Definition at line 513 of file OpenGLHelper.cxx.

References LoadShaders().

◆ LoadShaders() [3/4]

GLint OpenGLHelper::LoadShaders ( const OUString &  rVertexShaderName,
const OUString &  rFragmentShaderName,
const OUString &  rGeometryShaderName,
std::string_view  preamble,
std::string_view  rDigest 
)
static

Definition at line 372 of file OpenGLHelper.cxx.

References addPreamble(), CHECK_GL_ERROR, gbInShaderCompile, SAL_WARN, and VCL_GL_INFO.

Referenced by LoadShaders().

◆ LoadShaders() [4/4]

GLint OpenGLHelper::LoadShaders ( const OUString &  rVertexShaderName,
const OUString &  rFragmentShaderName,
std::string_view  preamble,
std::string_view  rDigest 
)
static

Definition at line 505 of file OpenGLHelper.cxx.

References LoadShaders().

◆ OptimalBufferFormat()

GLenum OpenGLHelper::OptimalBufferFormat ( )
static

Returns the optimal buffer format for OpenGL (GL_BGRA or GL_RGBA).

Definition at line 545 of file OpenGLHelper.cxx.

Referenced by renderToFile().

◆ renderToFile()

void OpenGLHelper::renderToFile ( tools::Long  nWidth,
tools::Long  nHeight,
const OUString &  rFileName 
)
static

◆ supportsOpenGL()

bool OpenGLHelper::supportsOpenGL ( )
static

checks if the system supports all features that are necessary for the OpenGL support

Definition at line 775 of file OpenGLHelper.cxx.

References ImplGetSVData(), isDeviceDenylisted(), and WatchdogThread::start().


The documentation for this struct was generated from the following files: