Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/GL/src/GLSL/include/OgreGLSLGpuProgram.h @ 1

Last change on this file since 1 was 1, checked in by landauf, 17 years ago
File size: 3.7 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29
30#ifndef __GLSLGpuProgram_H__
31#define __GLSLGpuProgram_H__
32
33// Precompiler options
34#include "OgreGLSLExtSupport.h"
35#include "OgreGLGpuProgram.h"
36
37
38namespace Ogre {
39
40    /** GLSL low level compiled shader object - this class is used to get at the linked program object
41                and provide an interface for GLRenderSystem calls.  GLSL does not provide access to the
42                low level code of the shader so this class is really just a dummy place holder.
43                GLSL uses a program object to represent the active vertex and fragment programs used
44                but Ogre materials maintain seperate instances of the active vertex and fragment programs
45                which creates a small problem for GLSL integration.  The GLSLGpuProgram class provides the
46                interface between the GLSLLinkProgramManager , GLRenderSystem, and the active GLSLProgram
47                instances.
48        */
49    class _OgrePrivate GLSLGpuProgram : public GLGpuProgram
50    {
51    private:
52                /// GL Handle for the shader object
53                GLSLProgram* mGLSLProgram;
54
55                /// keep track of the number of vertex shaders created
56                static GLuint mVertexShaderCount;
57                /// keep track of the number of fragment shaders created
58                static GLuint mFragmentShaderCount;
59
60        public:
61        GLSLGpuProgram(GLSLProgram* parent);
62                ~GLSLGpuProgram();
63
64
65                /// Execute the binding functions for this program
66                void bindProgram(void);
67                /// Execute the unbinding functions for this program
68                void unbindProgram(void);
69                /// Execute the param binding functions for this program
70                void bindProgramParameters(GpuProgramParametersSharedPtr params);
71                /// Execute the pass iteration param binding functions for this program
72                void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params);
73
74                /// Get the assigned GL program id
75                const GLuint getProgramID(void) const
76                { return mProgramID; }
77
78                /// get the GLSLProgram for the shader object
79                GLSLProgram* getGLSLProgram(void) const { return mGLSLProgram; }
80
81                /// @copydoc GLGpuProgram::getAttributeIndex
82                GLuint getAttributeIndex(VertexElementSemantic semantic);
83               
84                /// @copydoc GLGpuProgram::isAttributeValid
85                bool isAttributeValid(VertexElementSemantic semantic);
86               
87
88    protected:
89        /// Overridden from GpuProgram
90        void loadFromSource(void);
91                /// @copydoc Resource::unloadImpl
92                void unloadImpl(void);
93                /// @copydoc Resource::loadImpl
94                void loadImpl(void);
95
96
97    };
98
99
100}
101
102
103#endif // __GLSLGpuProgram_H__
Note: See TracBrowser for help on using the repository browser.