OpenClonk
CStdGLCtx Class Reference

#include <C4DrawGL.h>

Collaboration diagram for CStdGLCtx:
[legend]

Public Member Functions

 CStdGLCtx ()
 
virtual ~CStdGLCtx ()
 
virtual void Clear (bool multisample_change=false)
 
virtual bool Init (C4Window *pWindow, C4AbstractApp *pApp)
 
virtual bool Select (bool verbose=false)
 
virtual void Deselect ()
 
virtual bool PageFlip ()
 

Protected Member Functions

void SelectCommon ()
 

Protected Attributes

C4WindowpWindow {nullptr}
 
std::list< CStdGLCtx * >::iterator this_context
 
std::vector< GLuint > hVAOs
 
std::vector< unsigned int > VAOsToBeDeleted
 

Static Protected Attributes

static std::list< CStdGLCtx * > contexts
 

Friends

class CStdGL
 
class C4Surface
 

Detailed Description

Definition at line 104 of file C4DrawGL.h.

Constructor & Destructor Documentation

◆ CStdGLCtx()

CStdGLCtx::CStdGLCtx ( )

Referenced by SelectCommon().

Here is the caller graph for this function:

◆ ~CStdGLCtx()

virtual CStdGLCtx::~CStdGLCtx ( )
inlinevirtual

Definition at line 111 of file C4DrawGL.h.

111 { Clear(); } // dtor
virtual void Clear(bool multisample_change=false)

Member Function Documentation

◆ Clear()

virtual void CStdGLCtx::Clear ( bool  multisample_change = false)
virtual

Referenced by C4StartupOptionsDlg::OnClosed(), and SelectCommon().

Here is the caller graph for this function:

◆ Deselect()

virtual void CStdGLCtx::Deselect ( )
virtual

Referenced by CStdGL::Clear(), and SelectCommon().

Here is the caller graph for this function:

◆ Init()

virtual bool CStdGLCtx::Init ( C4Window pWindow,
C4AbstractApp pApp 
)
virtual

Referenced by CStdGL::CreateContext(), C4StartupOptionsDlg::OnClosed(), and SelectCommon().

Here is the caller graph for this function:

◆ PageFlip()

virtual bool CStdGLCtx::PageFlip ( )
virtual

Referenced by C4Surface::PageFlip().

Here is the caller graph for this function:

◆ Select()

virtual bool CStdGLCtx::Select ( bool  verbose = false)
virtual

Referenced by CStdGL::EnsureMainContextSelected(), CStdGL::PrepareRendering(), CStdGL::RestoreDeviceObjects(), and C4TexRef::Unlock().

Here is the caller graph for this function:

◆ SelectCommon()

void CStdGLCtx::SelectCommon ( )
protected

Definition at line 33 of file C4DrawGLCtx.cpp.

References Clear(), Config, contexts, CStdGLCtx(), C4ConfigGraphics::DebugOpenGL, Deselect(), CStdGL::Error(), StdStrBuf::getData(), StdStrBuf::getLength(), C4Config::Graphics, hVAOs, Init(), CStdGL::iPixelFormat, C4ConfigGraphics::MultiSampling, CStdGL::pCurrCtx, pGL, pWindow, this_context, and VAOsToBeDeleted.

34 {
35  pGL->pCurrCtx = this;
36  // set some default states
37  glDisable(GL_DEPTH_TEST);
38  glDepthFunc(GL_LESS);
39  glDisable(GL_CULL_FACE);
40  glEnable(GL_BLEND);
41  // Delete pending VAOs
42  std::vector<GLuint> toBeDeleted;
43  if (!VAOsToBeDeleted.empty())
44  {
45  for (unsigned int i : VAOsToBeDeleted)
46  {
47  if (i < hVAOs.size() && hVAOs[i] != 0)
48  {
49  toBeDeleted.push_back(hVAOs[i]);
50  hVAOs[i] = 0;
51  }
52  }
53 
54  glDeleteVertexArrays(toBeDeleted.size(), &toBeDeleted[0]);
55  VAOsToBeDeleted.clear();
56  }
57 }
CStdGLCtx * pCurrCtx
Definition: C4DrawGL.h:180
std::vector< unsigned int > VAOsToBeDeleted
Definition: C4DrawGL.h:142
CStdGL * pGL
Definition: C4DrawGL.cpp:918
std::vector< GLuint > hVAOs
Definition: C4DrawGL.h:140
Here is the call graph for this function:

Friends And Related Function Documentation

◆ C4Surface

friend class C4Surface
friend

Definition at line 145 of file C4DrawGL.h.

◆ CStdGL

friend class CStdGL
friend

Definition at line 144 of file C4DrawGL.h.

Member Data Documentation

◆ contexts

std::list< CStdGLCtx * > CStdGLCtx::contexts
staticprotected

Definition at line 136 of file C4DrawGL.h.

Referenced by CStdGL::FreeVAOID(), and SelectCommon().

◆ hVAOs

std::vector<GLuint> CStdGLCtx::hVAOs
protected

Definition at line 140 of file C4DrawGL.h.

Referenced by CStdGL::FreeVAOID(), CStdGL::GetVAO(), and SelectCommon().

◆ pWindow

C4Window* CStdGLCtx::pWindow {nullptr}
protected

Definition at line 128 of file C4DrawGL.h.

Referenced by SelectCommon().

◆ this_context

std::list<CStdGLCtx*>::iterator CStdGLCtx::this_context
protected

Definition at line 137 of file C4DrawGL.h.

Referenced by SelectCommon().

◆ VAOsToBeDeleted

std::vector<unsigned int> CStdGLCtx::VAOsToBeDeleted
protected

Definition at line 142 of file C4DrawGL.h.

Referenced by SelectCommon().


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