SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLGLProgramGeneric Class Reference

Generic Shader Program class inherited from SLGLProgram. More...

#include <SLGLProgramGeneric.h>

Inheritance diagram for SLGLProgramGeneric:
[legend]

Public Member Functions

 ~SLGLProgramGeneric () override=default
 
 SLGLProgramGeneric (SLAssetManager *am, const SLstring &vertShaderFile, const SLstring &fragShaderFile)
 If s is not NULL, ownership of SLGLProgram is given to SLScene (automatic deletion) More...
 
 SLGLProgramGeneric (SLAssetManager *am, const SLstring &vertShaderFile, const SLstring &fragShaderFile, const SLstring &geomShaderFile)
 If s is not NULL, ownership of SLGLProgram is given to SLScene (automatic deletion) More...
 
void beginShader (SLCamera *cam, SLMaterial *mat, SLVLight *lights) override
 starter for derived classes More...
 
void endShader () override
 
- Public Member Functions inherited from SLGLProgram
 SLGLProgram (SLAssetManager *am, const string &vertShaderFile, const string &fragShaderFile, const string &geomShaderFile="", const string &programName="")
 Ctor with a vertex and a fragment shader filename. More...
 
 ~SLGLProgram () override
 
void deleteDataGpu ()
 Delete all Gpu data. More...
 
void addShader (SLGLShader *shader)
 SLGLProgram::addShader adds a shader to the shader list. More...
 
void init (SLVLight *lights)
 
void initTF (const char *writeBackAttrib[], int size)
 
void beginUse (SLCamera *cam, SLMaterial *mat, SLVLight *lights)
 
SLint passLightsToUniforms (SLVLight *lights, SLuint nextTexUnit) const
 
void endUse ()
 SLGLProgram::endUse stops the shader program. More...
 
void useProgram ()
 
void addUniform1f (SLGLUniform1f *u)
 add float uniform More...
 
void addUniform1i (SLGLUniform1i *u)
 add int uniform More...
 
SLuint progID () const
 
SLVGLShadershaders ()
 
SLint getUniformLocation (const SLchar *name) const
 
SLint uniform1f (const SLchar *name, SLfloat v0) const
 Passes the float value v0 to the uniform variable "name". More...
 
SLint uniform2f (const SLchar *name, SLfloat v0, SLfloat v1) const
 Passes the float values v0 & v1 to the uniform variable "name". More...
 
SLint uniform3f (const SLchar *name, SLfloat v0, SLfloat v1, SLfloat v2) const
 Passes the float values v0, v1 & v2 to the uniform variable "name". More...
 
SLint uniform4f (const SLchar *name, SLfloat v0, SLfloat v1, SLfloat v2, SLfloat v3) const
 Passes the float values v0,v1,v2 & v3 to the uniform variable "name". More...
 
SLint uniform1i (const SLchar *name, SLint v0) const
 Passes the int values v0 to the uniform variable "name". More...
 
SLint uniform2i (const SLchar *name, SLint v0, SLint v1) const
 Passes the int values v0 & v1 to the uniform variable "name". More...
 
SLint uniform3i (const SLchar *name, SLint v0, SLint v1, SLint v2) const
 Passes the int values v0, v1 & v2 to the uniform variable "name". More...
 
SLint uniform4i (const SLchar *name, SLint v0, SLint v1, SLint v2, SLint v3) const
 Passes the int values v0, v1, v2 & v3 to the uniform variable "name". More...
 
SLint uniform1fv (const SLchar *name, SLsizei count, const SLfloat *value) const
 Passes 1 float value py pointer to the uniform variable "name". More...
 
SLint uniform2fv (const SLchar *name, SLsizei count, const SLfloat *value) const
 Passes 2 float values py pointer to the uniform variable "name". More...
 
SLint uniform3fv (const SLchar *name, SLsizei count, const SLfloat *value) const
 Passes 3 float values py pointer to the uniform variable "name". More...
 
SLint uniform4fv (const SLchar *name, SLsizei count, const SLfloat *value) const
 Passes 4 float values py pointer to the uniform variable "name". More...
 
SLint uniform1iv (const SLchar *name, SLsizei count, const SLint *value) const
 Passes 1 int value py pointer to the uniform variable "name". More...
 
SLint uniform2iv (const SLchar *name, SLsizei count, const SLint *value) const
 Passes 2 int values py pointer to the uniform variable "name". More...
 
SLint uniform3iv (const SLchar *name, SLsizei count, const SLint *value) const
 Passes 3 int values py pointer to the uniform variable "name". More...
 
SLint uniform4iv (const SLchar *name, GLsizei count, const SLint *value) const
 Passes 4 int values py pointer to the uniform variable "name". More...
 
SLint uniformMatrix2fv (const SLchar *name, SLsizei count, const SLfloat *value, GLboolean transpose=false) const
 Passes a 2x2 float matrix values py pointer to the uniform variable "name". More...
 
void uniformMatrix2fv (SLint loc, SLsizei count, const SLfloat *value, GLboolean transpose=false) const
 Passes a 2x2 float matrix values py pointer to the uniform at location loc. More...
 
SLint uniformMatrix3fv (const SLchar *name, SLsizei count, const SLfloat *value, GLboolean transpose=false) const
 Passes a 3x3 float matrix values py pointer to the uniform variable "name". More...
 
void uniformMatrix3fv (SLint loc, SLsizei count, const SLfloat *value, GLboolean transpose=false) const
 Passes a 3x3 float matrix values py pointer to the uniform at location loc. More...
 
SLint uniformMatrix4fv (const SLchar *name, SLsizei count, const SLfloat *value, GLboolean transpose=false) const
 Passes a 4x4 float matrix values py pointer to the uniform variable "name". More...
 
void uniformMatrix4fv (SLint loc, SLsizei count, const SLfloat *value, GLboolean transpose=false) const
 Passes a 4x4 float matrix values py pointer to the uniform at location loc. More...
 
- Public Member Functions inherited from SLObject
 SLObject (const SLstring &Name="", const SLstring &url="")
 
virtual ~SLObject ()
 
void name (const SLstring &Name)
 
void url (const SLstring &url)
 
const SLstringname () const
 
const SLstringurl () const
 

Additional Inherited Members

- Protected Attributes inherited from SLGLProgram
SLuint _progID
 OpenGL shader program object ID. More...
 
SLbool _isLinked
 Flag if program is linked. More...
 
SLVGLShader _shaders
 Vector of all shader objects. More...
 
SLVUniform1f _uniforms1f
 Vector of uniform1f variables. More...
 
SLVUniform1i _uniforms1i
 Vector of uniform1i variables. More...
 
- Protected Attributes inherited from SLObject
SLstring _name
 name of an object More...
 
SLstring _url
 uniform resource locator More...
 

Detailed Description

Generic Shader Program class inherited from SLGLProgram.

This class only provides the shader begin and end methods. It can be used for simple GLSL shader programs with standard types of uniform variables.

Definition at line 28 of file SLGLProgramGeneric.h.

Constructor & Destructor Documentation

◆ ~SLGLProgramGeneric()

SLGLProgramGeneric::~SLGLProgramGeneric ( )
overridedefault

◆ SLGLProgramGeneric() [1/2]

SLGLProgramGeneric::SLGLProgramGeneric ( SLAssetManager am,
const SLstring vertShaderFile,
const SLstring fragShaderFile 
)
inline

If s is not NULL, ownership of SLGLProgram is given to SLScene (automatic deletion)

Definition at line 34 of file SLGLProgramGeneric.h.

37  : SLGLProgram(am, vertShaderFile, fragShaderFile) { ; }
SLGLProgram(SLAssetManager *am, const string &vertShaderFile, const string &fragShaderFile, const string &geomShaderFile="", const string &programName="")
Ctor with a vertex and a fragment shader filename.
Definition: SLGLProgram.cpp:39

◆ SLGLProgramGeneric() [2/2]

SLGLProgramGeneric::SLGLProgramGeneric ( SLAssetManager am,
const SLstring vertShaderFile,
const SLstring fragShaderFile,
const SLstring geomShaderFile 
)
inline

If s is not NULL, ownership of SLGLProgram is given to SLScene (automatic deletion)

Definition at line 40 of file SLGLProgramGeneric.h.

44  : SLGLProgram(am, vertShaderFile, fragShaderFile, geomShaderFile) { ; }

Member Function Documentation

◆ beginShader()

void SLGLProgramGeneric::beginShader ( SLCamera cam,
SLMaterial mat,
SLVLight lights 
)
inlineoverridevirtual

starter for derived classes

Implements SLGLProgram.

Definition at line 46 of file SLGLProgramGeneric.h.

48  { beginUse(cam, mat, lights); }
void beginUse(SLCamera *cam, SLMaterial *mat, SLVLight *lights)

◆ endShader()

void SLGLProgramGeneric::endShader ( )
inlineoverridevirtual

Implements SLGLProgram.

Definition at line 49 of file SLGLProgramGeneric.h.

49 { endUse(); }
void endUse()
SLGLProgram::endUse stops the shader program.

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