source: OGRE/trunk/ogrenew/RenderSystems/GL/src/GLSL/include/OgreGLSLGpuProgram.h @ 692

Revision 692, 3.3 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

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-2005 The OGRE Team
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-----------------------------------------------------------------------------
24*/
25
26#ifndef __GLSLGpuProgram_H__
27#define __GLSLGpuProgram_H__
28
29// Precompiler options
30#include "OgreGLSLExtSupport.h"
31#include "OgreGLGpuProgram.h"
32
33
34namespace Ogre {
35
36    /** GLSL low level compiled shader object - this class is used to get at the linked program object
37                and provide an interface for GLRenderSystem calls.  GLSL does not provide access to the
38                low level code of the shader so this class is really just a dummy place holder.
39                GLSL uses a program object to represent the active vertex and fragment programs used
40                but Ogre materials maintain seperate instances of the active vertex and fragment programs
41                which creates a small problem for GLSL integration.  The GLSLGpuProgram class provides the
42                interface between the GLSLLinkProgramManager , GLRenderSystem, and the active GLSLProgram
43                instances.
44        */
45    class GLSLGpuProgram : public GLGpuProgram
46    {
47    private:
48                /// GL Handle for the shader object
49                GLSLProgram* mGLSLProgram;
50
51                /// keep track of the number of vertex shaders created
52                static GLuint mVertexShaderCount;
53                /// keep track of the number of fragment shaders created
54                static GLuint mFragmentShaderCount;
55
56        public:
57        GLSLGpuProgram(GLSLProgram* parent);
58                ~GLSLGpuProgram();
59
60                /// @copydoc Resource::unload
61                void unload(void);
62
63                /// Execute the binding functions for this program
64                void bindProgram(void);
65                /// Execute the unbinding functions for this program
66                void unbindProgram(void);
67                /// Execute the param binding functions for this program
68                void bindProgramParameters(GpuProgramParametersSharedPtr params);
69                /// Execute the pass iteration param binding functions for this program
70                void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params);
71
72                /// Get the assigned GL program id
73                const GLuint getProgramID(void) const
74                { return mProgramID; }
75
76                /// overides parent method and does nothing since there is nothing to load
77                void load(void);
78
79                /// get the GLSLProgram for the shader object
80                GLSLProgram* getGLSLProgram(void) const { return mGLSLProgram; }
81
82    protected:
83        /// Overridden from GpuProgram
84        void loadFromSource(void);
85
86
87    };
88
89
90}
91
92
93#endif // __GLSLGpuProgram_H__
Note: See TracBrowser for help on using the repository browser.