LibreOffice Module vcl (master)  1
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
OpenGLContext Class Referenceabstract

#include <OpenGLContext.hxx>

Inheritance diagram for OpenGLContext:
[legend]
Collaboration diagram for OpenGLContext:
[legend]

Public Member Functions

virtual ~OpenGLContext ()
 
void acquire ()
 
void release ()
 
void dispose ()
 
void requestLegacyContext ()
 
bool init (vcl::Window *pParent)
 
void reset ()
 
void BindFramebuffer (OpenGLFramebuffer *pFramebuffer)
 
void AcquireDefaultFramebuffer ()
 
OpenGLFramebufferAcquireFramebuffer (const OpenGLTexture &rTexture)
 
void UnbindTextureFromFramebuffers (GLuint nTexture)
 
void ReleaseFramebuffer (const OpenGLTexture &rTexture)
 
void ReleaseFramebuffers ()
 
OpenGLProgramGetProgram (const OUString &rVertexShader, const OUString &rFragmentShader, const OString &preamble="")
 
OpenGLProgramUseProgram (const OUString &rVertexShader, const OUString &rFragmentShader, const OString &preamble="")
 
RenderStatestate ()
 
OpenGLCapabilitySwitchgetOpenGLCapabilitySwitch ()
 
virtual bool isCurrent ()
 Is this GL context the current context ? More...
 
virtual bool isAnyCurrent ()
 Is any GL context the current context ? More...
 
virtual void makeCurrent ()
 make this GL context current - so it is implicit in subsequent GL calls More...
 
void registerAsCurrent ()
 Put this GL context to the end of the context list. More...
 
virtual void resetCurrent ()
 reset the GL context so this context is not implicit in subsequent GL calls. More...
 
virtual void restoreDefaultFramebuffer ()
 unbind the GL_FRAMEBUFFER to its default state, needed for gtk3 More...
 
virtual void swapBuffers ()
 
virtual void sync ()
 
void show ()
 
void setWinPosAndSize (const Point &rPos, const Size &rSize)
 
virtual const GLWindowgetOpenGLWindow () const =0
 
SystemChildWindowgetChildWindow ()
 
const SystemChildWindowgetChildWindow () const
 
bool isInitialized ()
 
void setVCLOnly ()
 VCL promiscuously re-uses its own contexts: More...
 
bool isVCLOnly ()
 
virtual SystemWindowData generateWinData (vcl::Window *pParent, bool bRequestLegacyContext)
 

Static Public Member Functions

static rtl::Reference< OpenGLContextCreate ()
 
static void ReleaseFramebuffer (OpenGLFramebuffer *pFramebuffer)
 
static bool IsTextureAttachedAnywhere (GLuint nTexture)
 Method for debugging; check texture is not already attached. More...
 
static void clearCurrent ()
 release bound resources from the current context More...
 
static void prepareForYield ()
 release contexts etc. before (potentially) allowing another thread run. More...
 
static bool hasCurrent ()
 Is there a current GL context ? More...
 
static void makeVCLCurrent ()
 make a VCL context (any context) current, create it if necessary. More...
 
static rtl::Reference< OpenGLContextgetVCLContext (bool bMakeIfNecessary=true)
 fetch any VCL context, creating one if bMakeIfNecessary is set. More...
 

Public Attributes

vcl::Region maClipRegion
 
OpenGLContextmpPrevContext
 
OpenGLContextmpNextContext
 

Protected Member Functions

 OpenGLContext ()
 
bool InitGL ()
 
virtual GLWindowgetModifiableOpenGLWindow ()=0
 
virtual bool ImplInit ()
 

Static Protected Member Functions

static void InitGLDebugging ()
 
static void InitChildWindow (SystemChildWindow *pChildWindow)
 
static void BuffersSwapped ()
 

Protected Attributes

VclPtr< vcl::Windowm_xWindow
 
VclPtr< vcl::WindowmpWindow
 
VclPtr< SystemChildWindowm_pChildWindow
 
bool mbInitialized
 
int mnRefCount
 
bool mbRequestLegacyContext
 
bool mbVCLOnly
 
int mnFramebufferCount
 
OpenGLFramebuffermpCurrentFramebuffer
 
OpenGLFramebuffermpFirstFramebuffer
 
OpenGLFramebuffermpLastFramebuffer
 
OpenGLCapabilitySwitch maOpenGLCapabilitySwitch
 

Private Types

typedef std::unordered_map< OString, std::shared_ptr< OpenGLProgram > > ProgramCollection
 

Private Member Functions

virtual void initWindow ()
 
virtual void destroyCurrentContext ()
 
virtual void adjustToNewSize ()
 

Private Attributes

ProgramCollection maPrograms
 
OpenGLProgrammpCurrentProgram
 
std::unique_ptr< RenderStatempRenderState
 

Friends

class OpenGLTests
 

Detailed Description

Definition at line 55 of file OpenGLContext.hxx.

Member Typedef Documentation

typedef std::unordered_map< OString, std::shared_ptr<OpenGLProgram> > OpenGLContext::ProgramCollection
private

Definition at line 172 of file OpenGLContext.hxx.

Constructor & Destructor Documentation

OpenGLContext::OpenGLContext ( )
protected
OpenGLContext::~OpenGLContext ( )
virtual

Member Function Documentation

void OpenGLContext::acquire ( )
inline

Definition at line 63 of file OpenGLContext.hxx.

void OpenGLContext::AcquireDefaultFramebuffer ( )

Definition at line 606 of file OpenGLContext.cxx.

References BindFramebuffer().

OpenGLFramebuffer * OpenGLContext::AcquireFramebuffer ( const OpenGLTexture rTexture)
void OpenGLContext::adjustToNewSize ( )
privatevirtual

Definition at line 327 of file OpenGLContext.cxx.

References getOpenGLWindow(), GLWindow::Height, and GLWindow::Width.

Referenced by setWinPosAndSize().

void OpenGLContext::BindFramebuffer ( OpenGLFramebuffer pFramebuffer)
void OpenGLContext::BuffersSwapped ( )
staticprotected

Definition at line 550 of file OpenGLContext.cxx.

References nBufferSwapCounter.

Referenced by swapBuffers().

void OpenGLContext::clearCurrent ( )
static

release bound resources from the current context

Definition at line 434 of file OpenGLContext.cxx.

References ImplGetSVData(), ImplSVData::maGDIData, and ImplSVGDIData::mpLastContext.

Referenced by makeCurrent(), and resetCurrent().

rtl::Reference< OpenGLContext > OpenGLContext::Create ( )
static
void OpenGLContext::destroyCurrentContext ( )
privatevirtual

Reimplemented in Qt5OpenGLContext.

Definition at line 346 of file OpenGLContext.cxx.

Referenced by reset().

void OpenGLContext::dispose ( void  )
SystemWindowData OpenGLContext::generateWinData ( vcl::Window pParent,
bool  bRequestLegacyContext 
)
virtual

Definition at line 395 of file OpenGLContext.cxx.

SystemChildWindow * OpenGLContext::getChildWindow ( )

Definition at line 582 of file OpenGLContext.cxx.

References m_pChildWindow.

const SystemChildWindow * OpenGLContext::getChildWindow ( ) const

Definition at line 587 of file OpenGLContext.cxx.

References m_pChildWindow.

virtual GLWindow& OpenGLContext::getModifiableOpenGLWindow ( )
protectedpure virtual

Implemented in Qt5OpenGLContext.

Referenced by setWinPosAndSize().

OpenGLCapabilitySwitch& OpenGLContext::getOpenGLCapabilitySwitch ( )
inline

Definition at line 94 of file OpenGLContext.hxx.

virtual const GLWindow& OpenGLContext::getOpenGLWindow ( ) const
pure virtual

Implemented in Qt5OpenGLContext.

Referenced by adjustToNewSize().

OpenGLProgram * OpenGLContext::GetProgram ( const OUString &  rVertexShader,
const OUString &  rFragmentShader,
const OString &  preamble = "" 
)

Definition at line 759 of file OpenGLContext.cxx.

References OpenGLHelper::GetDigest(), maPrograms, and OUStringToOString().

Referenced by UseProgram().

rtl::Reference< OpenGLContext > OpenGLContext::getVCLContext ( bool  bMakeIfNecessary = true)
static
bool OpenGLContext::hasCurrent ( )
static

Is there a current GL context ?

Definition at line 427 of file OpenGLContext.cxx.

References ImplGetSVData(), ImplSVData::maGDIData, and ImplSVGDIData::mpLastContext.

Referenced by OpenGLHelper::debugMsgPrint(), and prepareForYield().

bool OpenGLContext::ImplInit ( )
protectedvirtual

Reimplemented in Qt5OpenGLContext.

Definition at line 234 of file OpenGLContext.cxx.

References VCL_GL_INFO.

Referenced by init().

bool OpenGLContext::init ( vcl::Window pParent)
void OpenGLContext::InitChildWindow ( SystemChildWindow pChildWindow)
staticprotected
bool OpenGLContext::InitGL ( )
protected
void OpenGLContext::InitGLDebugging ( )
staticprotected

Definition at line 276 of file OpenGLContext.cxx.

References VCL_GL_INFO.

void OpenGLContext::initWindow ( )
privatevirtual

Reimplemented in Qt5OpenGLContext.

Definition at line 342 of file OpenGLContext.cxx.

Referenced by init().

bool OpenGLContext::isAnyCurrent ( )
virtual

Is any GL context the current context ?

Reimplemented in Qt5OpenGLContext.

Definition at line 422 of file OpenGLContext.cxx.

bool OpenGLContext::isCurrent ( )
virtual

Is this GL context the current context ?

Reimplemented in Qt5OpenGLContext.

Definition at line 402 of file OpenGLContext.cxx.

References void().

Referenced by makeCurrent(), and reset().

bool OpenGLContext::isInitialized ( )
inline

Definition at line 132 of file OpenGLContext.hxx.

References mbInitialized.

Referenced by getVCLContext().

bool OpenGLContext::IsTextureAttachedAnywhere ( GLuint  nTexture)
static

Method for debugging; check texture is not already attached.

Definition at line 698 of file OpenGLContext.cxx.

References ImplGetSVData(), ImplSVData::maGDIData, ImplSVGDIData::mpLastContext, and mpPrevContext.

Referenced by UnbindTextureFromFramebuffers().

bool OpenGLContext::isVCLOnly ( )
inline

Definition at line 139 of file OpenGLContext.hxx.

Referenced by getVCLContext().

void OpenGLContext::makeCurrent ( )
virtual

make this GL context current - so it is implicit in subsequent GL calls

Reimplemented in Qt5OpenGLContext.

Definition at line 408 of file OpenGLContext.cxx.

References clearCurrent(), isCurrent(), and registerAsCurrent().

Referenced by reset().

void OpenGLContext::makeVCLCurrent ( )
static

make a VCL context (any context) current, create it if necessary.

Definition at line 510 of file OpenGLContext.cxx.

References getVCLContext().

Referenced by OpenGLVCLContextZone::OpenGLVCLContextZone().

void OpenGLContext::prepareForYield ( )
static

release contexts etc. before (potentially) allowing another thread run.

Definition at line 445 of file OpenGLContext.cxx.

References hasCurrent(), ImplGetSVData(), ImplSVData::maGDIData, ImplSVGDIData::mpLastContext, and SAL_INFO.

void OpenGLContext::registerAsCurrent ( )

Put this GL context to the end of the context list.

Definition at line 515 of file OpenGLContext.cxx.

References ImplGetSVData(), ImplSVData::maGDIData, ImplSVGDIData::mpLastContext, mpNextContext, mpPrevContext, mpRenderState, and VCL_GL_INFO.

Referenced by makeCurrent().

void OpenGLContext::release ( )
inline

Definition at line 64 of file OpenGLContext.hxx.

void OpenGLContext::ReleaseFramebuffer ( OpenGLFramebuffer pFramebuffer)
static

Definition at line 714 of file OpenGLContext.cxx.

References OpenGLFramebuffer::DetachTexture().

void OpenGLContext::ReleaseFramebuffer ( const OpenGLTexture rTexture)
void OpenGLContext::ReleaseFramebuffers ( )
void OpenGLContext::requestLegacyContext ( )

Definition at line 115 of file OpenGLContext.cxx.

References mbRequestLegacyContext.

void OpenGLContext::reset ( )
void OpenGLContext::resetCurrent ( )
virtual

reset the GL context so this context is not implicit in subsequent GL calls.

Reimplemented in Qt5OpenGLContext.

Definition at line 538 of file OpenGLContext.cxx.

References clearCurrent().

Referenced by reset().

void OpenGLContext::restoreDefaultFramebuffer ( )
virtual

unbind the GL_FRAMEBUFFER to its default state, needed for gtk3

Definition at line 309 of file OpenGLContext.cxx.

void OpenGLContext::setVCLOnly ( )
inline

VCL promiscuously re-uses its own contexts:

Definition at line 138 of file OpenGLContext.hxx.

void OpenGLContext::setWinPosAndSize ( const Point rPos,
const Size rSize 
)
void OpenGLContext::show ( )

Definition at line 574 of file OpenGLContext.cxx.

References m_pChildWindow, m_xWindow, and vcl::Window::Show().

RenderState& OpenGLContext::state ( )
inline

Definition at line 89 of file OpenGLContext.hxx.

Referenced by AcquireFramebuffer().

void OpenGLContext::swapBuffers ( )
virtual

Reimplemented in Qt5OpenGLContext.

Definition at line 544 of file OpenGLContext.cxx.

References BuffersSwapped().

void OpenGLContext::sync ( )
virtual

Definition at line 568 of file OpenGLContext.cxx.

References void().

void OpenGLContext::UnbindTextureFromFramebuffers ( GLuint  nTexture)
OpenGLProgram * OpenGLContext::UseProgram ( const OUString &  rVertexShader,
const OUString &  rFragmentShader,
const OString &  preamble = "" 
)

Friends And Related Function Documentation

friend class OpenGLTests
friend

Definition at line 57 of file OpenGLContext.hxx.

Member Data Documentation

VclPtr<SystemChildWindow> OpenGLContext::m_pChildWindow
protected

Definition at line 158 of file OpenGLContext.hxx.

Referenced by dispose(), getChildWindow(), init(), setWinPosAndSize(), show(), and ~OpenGLContext().

VclPtr<vcl::Window> OpenGLContext::m_xWindow
protected

Definition at line 156 of file OpenGLContext.hxx.

Referenced by init(), setWinPosAndSize(), and show().

vcl::Region OpenGLContext::maClipRegion

Definition at line 179 of file OpenGLContext.hxx.

Referenced by reset().

OpenGLCapabilitySwitch OpenGLContext::maOpenGLCapabilitySwitch
protected

Definition at line 169 of file OpenGLContext.hxx.

ProgramCollection OpenGLContext::maPrograms
private

Definition at line 173 of file OpenGLContext.hxx.

Referenced by GetProgram(), and reset().

bool OpenGLContext::mbInitialized
protected

Definition at line 159 of file OpenGLContext.hxx.

Referenced by init(), InitGL(), and reset().

bool OpenGLContext::mbRequestLegacyContext
protected

Definition at line 161 of file OpenGLContext.hxx.

Referenced by requestLegacyContext().

bool OpenGLContext::mbVCLOnly
protected

Definition at line 162 of file OpenGLContext.hxx.

int OpenGLContext::mnFramebufferCount
protected

Definition at line 164 of file OpenGLContext.hxx.

Referenced by AcquireFramebuffer(), and reset().

int OpenGLContext::mnRefCount
protected

Definition at line 160 of file OpenGLContext.hxx.

Referenced by ~OpenGLContext().

OpenGLFramebuffer* OpenGLContext::mpCurrentFramebuffer
protected

Definition at line 165 of file OpenGLContext.hxx.

Referenced by BindFramebuffer(), and ReleaseFramebuffer().

OpenGLProgram* OpenGLContext::mpCurrentProgram
private

Definition at line 174 of file OpenGLContext.hxx.

Referenced by UseProgram().

OpenGLFramebuffer* OpenGLContext::mpFirstFramebuffer
protected

Definition at line 166 of file OpenGLContext.hxx.

Referenced by AcquireFramebuffer(), and reset().

OpenGLFramebuffer* OpenGLContext::mpLastFramebuffer
protected
OpenGLContext* OpenGLContext::mpNextContext

Definition at line 183 of file OpenGLContext.hxx.

Referenced by OpenGLContext(), registerAsCurrent(), and ~OpenGLContext().

OpenGLContext* OpenGLContext::mpPrevContext
std::unique_ptr<RenderState> OpenGLContext::mpRenderState
private

Definition at line 176 of file OpenGLContext.hxx.

Referenced by registerAsCurrent(), and reset().

VclPtr<vcl::Window> OpenGLContext::mpWindow
protected

Definition at line 157 of file OpenGLContext.hxx.

Referenced by init().


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