OGRE  1.8
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreGLSLESProgram.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __GLSLESProgram_H__
29 #define __GLSLESProgram_H__
30 
31 #include "OgreGLES2Prerequisites.h"
33 
34 namespace Ogre {
50  {
51  public:
52 #if !OGRE_NO_GLES2_GLSL_OPTIMISER
53  class CmdOptimisation : public ParamCommand
55  {
56  public:
57  String doGet(const void* target) const;
58  void doSet(void* target, const String& val);
59  };
60 #endif
63  {
64  public:
65  String doGet(const void* target) const;
66  void doSet(void* target, const String& val);
67  };
68 
70  const String& name, ResourceHandle handle,
71  const String& group, bool isManual, ManualResourceLoader* loader);
72  ~GLSLESProgram();
73 
75  GLuint getGLShaderHandle() const { return mGLShaderHandle; }
76  void attachToProgramObject( const GLuint programObject );
77  void detachFromProgramObject( const GLuint programObject );
78  GLuint getGLProgramHandle() const { return mGLProgramHandle; }
79 
81  bool getPassTransformStates(void) const;
82  bool getPassSurfaceAndLightStates(void) const;
83  bool getPassFogStates(void) const;
84 
86  void setPreprocessorDefines(const String& defines) { mPreprocessorDefines = defines; }
88  const String& getPreprocessorDefines(void) const { return mPreprocessorDefines; }
89 
90 #if !OGRE_NO_GLES2_GLSL_OPTIMISER
91  void setOptimiserEnabled(bool enabled) { mOptimiserEnabled = enabled; }
94  bool getOptimiserEnabled(void) const { return mOptimiserEnabled; }
95 
97  void setIsOptimised(bool flag) { mIsOptimised = flag; }
99  bool getIsOptimised(void) { return mIsOptimised; }
100 #endif
101 
103  const String& getLanguage(void) const;
105  GpuProgramParametersSharedPtr createParameters(void);
106 
108  bool compile( const bool checkErrors = false);
109 
110  protected:
112 #if !OGRE_NO_GLES2_GLSL_OPTIMISER
114 #endif
115 
118  void loadFromSource(void);
124  void createLowLevelImpl(void);
126  void unloadHighLevelImpl(void);
128  void unloadImpl(void);
129 
131  void populateParameterNames(GpuProgramParametersSharedPtr params);
133  void buildConstantDefinitions() const;
139  void checkAndFixInvalidDefaultPrecisionError( String &message );
140  private:
145  GLint mCompiled;
150 #if !OGRE_NO_GLES2_GLSL_OPTIMISER
152 #endif
153  };
154 }
155 
156 #endif // __GLSLESProgram_H__
Command object for setting macro defines.
#define _OgreGLES2Export
GLuint mGLShaderHandle
GL handle for shader object.
Interface describing a manual resource loader.
Definition: OgreResource.h:513
bool getIsOptimised(void)
Gets if the GLSL source has been optimised successfully.
bool mIsOptimised
Flag indicating if shader has been successfully optimised.
GLint mCompiled
Flag indicating if shader object successfully compiled.
Specialisation of HighLevelGpuProgram to provide support for OpenGL Shader Language (GLSL ES) for Ope...
void setPreprocessorDefines(const String &defines)
Sets the preprocessor defines use to compile the program.
GLuint getGLProgramHandle() const
unsigned long long int ResourceHandle
Definition: OgreResource.h:40
static CmdPreprocessorDefines msCmdPreprocessorDefines
GLuint getGLShaderHandle() const
GL Shader Handle.
Defines a generic resource handler.
_StringBase String
static CmdOptimisation msCmdOptimisation
const String & getPreprocessorDefines(void) const
Sets the preprocessor defines use to compile the program.
Abstract base class representing a high-level program (a vertex or fragment program).
void setIsOptimised(bool flag)
Sets if the GLSL source has been optimised successfully.
String mPreprocessorDefines
Preprocessor options.
Command object for running the GLSL optimiser.
bool getOptimiserEnabled(void) const
Gets if the GLSL optimiser is enabled.
Abstract class which is command object which gets/sets parameters.