SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLGLProgramGeneric.h
Go to the documentation of this file.
1 /**
2  * \file SLGLProgramGeneric.h
3  * \authors Marcus Hudritsch
4  * \details Defines a minimal shader program that just starts and stops the
5  * shaders that are hold in the base class SLGLProgram.
6  * \date July 2014
7  * \copyright http://opensource.org/licenses/GPL-3.0
8  * \remarks Please use clangformat to format the code. See more code style on
9  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
10 */
11 
12 #ifndef SLGLPROGRAMMGENERIC_H
13 #define SLGLPROGRAMMGENERIC_H
14 
15 #include <SLGLProgram.h>
16 #include <SLGLProgramManager.h>
17 #include <SLObject.h>
18 
19 class SLMaterial;
20 class SLAssetManager;
21 
22 //-----------------------------------------------------------------------------
23 //! Generic Shader Program class inherited from SLGLProgram
24 /*!
25 This class only provides the shader begin and end methods. It can be used for
26 simple GLSL shader programs with standard types of uniform variables.
27 */
29 {
30 public:
31  ~SLGLProgramGeneric() override = default;
32 
33  //! If s is not NULL, ownership of SLGLProgram is given to SLScene (automatic deletion)
35  const SLstring& vertShaderFile,
36  const SLstring& fragShaderFile)
37  : SLGLProgram(am, vertShaderFile, fragShaderFile) { ; }
38 
39  //! If s is not NULL, ownership of SLGLProgram is given to SLScene (automatic deletion)
41  const SLstring& vertShaderFile,
42  const SLstring& fragShaderFile,
43  const SLstring& geomShaderFile)
44  : SLGLProgram(am, vertShaderFile, fragShaderFile, geomShaderFile) { ; }
45 
46  void beginShader(SLCamera* cam,
47  SLMaterial* mat,
48  SLVLight* lights) override { beginUse(cam, mat, lights); }
49  void endShader() override { endUse(); }
50 };
51 //-----------------------------------------------------------------------------
52 #endif
string SLstring
Definition: SL.h:158
vector< SLLight * > SLVLight
STL vector of light pointers.
Definition: SLLight.h:232
Toplevel holder of the assets meshes, materials, textures and shaders.
Active or visible camera node class.
Definition: SLCamera.h:54
Generic Shader Program class inherited from SLGLProgram.
void beginShader(SLCamera *cam, SLMaterial *mat, SLVLight *lights) override
starter for derived classes
~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)
void endShader() override
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)
Encapsulation of an OpenGL shader program object.
Definition: SLGLProgram.h:56
void beginUse(SLCamera *cam, SLMaterial *mat, SLVLight *lights)
void endUse()
SLGLProgram::endUse stops the shader program.
Defines a standard CG material with textures and a shader program.
Definition: SLMaterial.h:56