KiCad PCB EDA Suite
KIGFX::GPU_MANAGER Class Referenceabstract

Class to handle uploading vertices and indices to GPU in drawing purposes. More...

#include <gpu_manager.h>

Inheritance diagram for KIGFX::GPU_MANAGER:
KIGFX::GPU_CACHED_MANAGER KIGFX::GPU_NONCACHED_MANAGER

Public Member Functions

virtual ~GPU_MANAGER ()
 
virtual void BeginDrawing ()=0
 Function BeginDrawing() Prepares the stored data to be drawn. More...
 
virtual void DrawIndices (unsigned int aOffset, unsigned int aSize)=0
 Function DrawIndices() Makes the GPU draw given range of vertices. More...
 
virtual void DrawAll ()=0
 Function DrawIndices() Makes the GPU draw all the vertices stored in the container. More...
 
virtual void EndDrawing ()=0
 Function EndDrawing() Clears the container after drawing routines. More...
 
virtual void SetShader (SHADER &aShader)
 Function SetShader() Allows using shaders with the stored data. More...
 

Static Public Member Functions

static GPU_MANAGERMakeManager (VERTEX_CONTAINER *aContainer)
 

Protected Member Functions

 GPU_MANAGER (VERTEX_CONTAINER *aContainer)
 

Protected Attributes

bool m_isDrawing
 

Drawing status flag.

More...
 
VERTEX_CONTAINERm_container
 

Container that stores vertices data.

More...
 
SHADERm_shader
 

Shader handling

More...
 
int m_shaderAttrib
 

Location of shader attributes (for glVertexAttribPointer)

More...
 

Detailed Description

Class to handle uploading vertices and indices to GPU in drawing purposes.

Definition at line 42 of file gpu_manager.h.

Constructor & Destructor Documentation

GPU_MANAGER::~GPU_MANAGER ( )
virtual

Definition at line 57 of file gpu_manager.cpp.

58 {
59 }
GPU_MANAGER::GPU_MANAGER ( VERTEX_CONTAINER aContainer)
protected

Definition at line 51 of file gpu_manager.cpp.

51  :
52  m_isDrawing( false ), m_container( aContainer ), m_shader( NULL ), m_shaderAttrib( 0 )
53 {
54 }
int m_shaderAttrib
Location of shader attributes (for glVertexAttribPointer)
Definition: gpu_manager.h:95
VERTEX_CONTAINER * m_container
Container that stores vertices data.
Definition: gpu_manager.h:89
bool m_isDrawing
Drawing status flag.
Definition: gpu_manager.h:86
SHADER * m_shader
Shader handling
Definition: gpu_manager.h:92

Member Function Documentation

virtual void KIGFX::GPU_MANAGER::BeginDrawing ( )
pure virtual

Function BeginDrawing() Prepares the stored data to be drawn.

Implemented in KIGFX::GPU_NONCACHED_MANAGER, and KIGFX::GPU_CACHED_MANAGER.

virtual void KIGFX::GPU_MANAGER::DrawAll ( )
pure virtual

Function DrawIndices() Makes the GPU draw all the vertices stored in the container.

Implemented in KIGFX::GPU_NONCACHED_MANAGER, and KIGFX::GPU_CACHED_MANAGER.

virtual void KIGFX::GPU_MANAGER::DrawIndices ( unsigned int  aOffset,
unsigned int  aSize 
)
pure virtual

Function DrawIndices() Makes the GPU draw given range of vertices.

Parameters
aOffsetis the beginning of the range.
aSizeis the number of vertices to be drawn.

Implemented in KIGFX::GPU_NONCACHED_MANAGER, and KIGFX::GPU_CACHED_MANAGER.

virtual void KIGFX::GPU_MANAGER::EndDrawing ( )
pure virtual

Function EndDrawing() Clears the container after drawing routines.

Implemented in KIGFX::GPU_NONCACHED_MANAGER, and KIGFX::GPU_CACHED_MANAGER.

GPU_MANAGER * GPU_MANAGER::MakeManager ( VERTEX_CONTAINER aContainer)
static

Definition at line 42 of file gpu_manager.cpp.

References KIGFX::VERTEX_CONTAINER::IsCached().

Referenced by KIGFX::VERTEX_MANAGER::VERTEX_MANAGER().

43 {
44  if( aContainer->IsCached() )
45  return new GPU_CACHED_MANAGER( aContainer );
46  else
47  return new GPU_NONCACHED_MANAGER( aContainer );
48 }
virtual bool IsCached() const =0
Returns true if the container caches vertex data in RAM or video memory.
void GPU_MANAGER::SetShader ( SHADER aShader)
virtual

Function SetShader() Allows using shaders with the stored data.

Parameters
aShaderis the object that allows using shaders.

Definition at line 62 of file gpu_manager.cpp.

References DisplayError(), KIGFX::SHADER::GetAttribute(), m_shader, and m_shaderAttrib.

63 {
64  m_shader = &aShader;
65  m_shaderAttrib = m_shader->GetAttribute( "attrShaderParams" );
66 
67  if( m_shaderAttrib == -1 )
68  {
69  DisplayError( NULL, wxT( "Could not get the shader attribute location" ) );
70  }
71 }
int m_shaderAttrib
Location of shader attributes (for glVertexAttribPointer)
Definition: gpu_manager.h:95
int GetAttribute(const std::string &aAttributeName) const
Gets an attribute location.
Definition: shader.cpp:160
SHADER * m_shader
Shader handling
Definition: gpu_manager.h:92
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:71

Member Data Documentation

VERTEX_CONTAINER* KIGFX::GPU_MANAGER::m_container
protected
bool KIGFX::GPU_MANAGER::m_isDrawing
protected
SHADER* KIGFX::GPU_MANAGER::m_shader
protected
int KIGFX::GPU_MANAGER::m_shaderAttrib
protected

Location of shader attributes (for glVertexAttribPointer)

Definition at line 95 of file gpu_manager.h.

Referenced by KIGFX::GPU_CACHED_MANAGER::EndDrawing(), KIGFX::GPU_NONCACHED_MANAGER::EndDrawing(), and SetShader().


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