OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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 103 of file C4DrawGL.h.

Constructor & Destructor Documentation

CStdGLCtx::CStdGLCtx ( )
virtual CStdGLCtx::~CStdGLCtx ( )
inlinevirtual

Definition at line 110 of file C4DrawGL.h.

References Clear().

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

Here is the call graph for this function:

Member Function Documentation

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

Referenced by ~CStdGLCtx().

Here is the caller graph for this function:

virtual void CStdGLCtx::Deselect ( )
virtual

Referenced by CStdGL::Clear().

Here is the caller graph for this function:

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

Referenced by CStdGL::CreateContext().

Here is the caller graph for this function:

virtual bool CStdGLCtx::PageFlip ( )
virtual

Referenced by C4Surface::PageFlip().

Here is the caller graph for this function:

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:

void CStdGLCtx::SelectCommon ( )
protected

Definition at line 33 of file C4DrawGLCtx.cpp.

References hVAOs, CStdGL::pCurrCtx, pGL, 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:179
std::vector< unsigned int > VAOsToBeDeleted
Definition: C4DrawGL.h:141
CStdGL * pGL
Definition: C4DrawGL.cpp:905
std::vector< GLuint > hVAOs
Definition: C4DrawGL.h:139

Friends And Related Function Documentation

friend class C4Surface
friend

Definition at line 144 of file C4DrawGL.h.

friend class CStdGL
friend

Definition at line 143 of file C4DrawGL.h.

Member Data Documentation

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

Definition at line 135 of file C4DrawGL.h.

Referenced by CStdGL::FreeVAOID().

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

Definition at line 139 of file C4DrawGL.h.

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

C4Window* CStdGLCtx::pWindow {nullptr}
protected

Definition at line 127 of file C4DrawGL.h.

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

Definition at line 136 of file C4DrawGL.h.

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

Definition at line 141 of file C4DrawGL.h.

Referenced by SelectCommon().


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