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 ( )

◆ ~CStdGLCtx()

virtual CStdGLCtx::~CStdGLCtx ( )
inlinevirtual

Definition at line 111 of file C4DrawGL.h.

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

References Clear().

Here is the call graph for this function:

Member Function Documentation

◆ Clear()

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

Referenced by ~CStdGLCtx().

Here is the caller graph for this function:

◆ Deselect()

virtual void CStdGLCtx::Deselect ( )
virtual

Referenced by CStdGL::Clear().

Here is the caller graph for this function:

◆ Init()

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

Referenced by CStdGL::CreateContext().

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 35 of file C4DrawGLCtx.cpp.

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

References hVAOs, CStdGL::pCurrCtx, pGL, and VAOsToBeDeleted.

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().

◆ 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.

◆ this_context

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

Definition at line 137 of file C4DrawGL.h.

◆ 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: