ManaPlus
Public Member Functions | Protected Attributes
ShaderProgram Class Reference

#include <shaderprogram.h>

Inheritance diagram for ShaderProgram:
Resource MemoryCounter

Public Member Functions

 ShaderProgram (const unsigned int id, Shader *const vertex, Shader *const fragment)
 
 ~ShaderProgram ()
 
unsigned int getProgramId () const
 
- Public Member Functions inherited from Resource
 Resource ()
 
 ~Resource ()
 
virtual void incRef ()
 
virtual void decRef ()
 
int calcMemoryLocal () const
 
std::string getCounterName () const
 
- Public Member Functions inherited from MemoryCounter
 MemoryCounter ()
 
virtual ~MemoryCounter ()
 
int calcMemory (const int level) const
 
virtual int calcMemoryChilds (const int level) const
 

Protected Attributes

unsigned int mProgramId
 
ShadermVertex
 
ShadermFragment
 

Additional Inherited Members

- Data Fields inherited from Resource
time_t mTimeStamp
 
std::string mIdPath
 
std::string mSource
 
unsigned int mRefCount
 
bool mProtected
 
bool mNotCount
 

Detailed Description

Definition at line 31 of file shaderprogram.h.

Constructor & Destructor Documentation

◆ ShaderProgram()

ShaderProgram::ShaderProgram ( const unsigned int  id,
Shader *const  vertex,
Shader *const  fragment 
)

Definition at line 35 of file shaderprogram.cpp.

37  :
38  Resource(),
39  mProgramId(id),
40  mVertex(vertex),
41  mFragment(fragment)
42 {
43 }
Resource()
Definition: resource.h:40
Shader * mFragment
Definition: shaderprogram.h:48
unsigned int mProgramId
Definition: shaderprogram.h:46
Shader * mVertex
Definition: shaderprogram.h:47

◆ ~ShaderProgram()

ShaderProgram::~ShaderProgram ( )

Definition at line 45 of file shaderprogram.cpp.

46 {
47  if (mProgramId != 0U)
48  mglDeleteProgram(mProgramId);
49  if (mVertex != nullptr)
50  mVertex->decRef();
51  if (mFragment != nullptr)
52  mFragment->decRef();
53 }
virtual void decRef()
Definition: resource.cpp:50

References Resource::decRef(), mFragment, mProgramId, and mVertex.

Member Function Documentation

◆ getProgramId()

unsigned int ShaderProgram::getProgramId ( ) const
inline

Definition at line 42 of file shaderprogram.h.

43  { return mProgramId; }

References mProgramId.

Referenced by MobileOpenGL2Graphics::postInit(), and ModernOpenGLGraphics::postInit().

Field Documentation

◆ mFragment

Shader* ShaderProgram::mFragment
protected

Definition at line 48 of file shaderprogram.h.

Referenced by ~ShaderProgram().

◆ mProgramId

unsigned int ShaderProgram::mProgramId
protected

Definition at line 46 of file shaderprogram.h.

Referenced by getProgramId(), and ~ShaderProgram().

◆ mVertex

Shader* ShaderProgram::mVertex
protected

Definition at line 47 of file shaderprogram.h.

Referenced by ~ShaderProgram().


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