Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/GL/include/OgreGLGpuProgram.h @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 4.2 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 __GLGpuProgram_H__
31#define __GLGpuProgram_H__
32
33#include "OgreGLPrerequisites.h"
34#include "OgreGpuProgram.h"
35#include "OgreHardwareVertexBuffer.h"
36
37namespace Ogre {
38
39    /** Generalised low-level GL program, can be applied to multiple types (eg ARB and NV) */
40    class _OgrePrivate GLGpuProgram : public GpuProgram
41    {
42    public:
43        GLGpuProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
44            const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
45        virtual ~GLGpuProgram();
46
47        /// Execute the binding functions for this program
48        virtual void bindProgram(void) {}
49        /// Execute the binding functions for this program
50        virtual void unbindProgram(void) {}
51
52        /// Execute the param binding functions for this program
53        virtual void bindProgramParameters(GpuProgramParametersSharedPtr params) {}
54                /// Bind just the pass iteration parameters
55                virtual void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params) {}
56
57
58        /// Get the assigned GL program id
59        const GLuint getProgramID(void) const
60        { return mProgramID; }
61
62                /** Get the attribute index for a given semantic.
63                @remarks
64                        This can be used to identify the attribute index to bind non-builtin
65                        attributes like tangent and binormal.
66                */
67                virtual GLuint getAttributeIndex(VertexElementSemantic semantic);
68                /** Test whether attribute index for a given semantic is valid.
69                */
70                virtual bool isAttributeValid(VertexElementSemantic semantic);
71
72    protected:
73                /** Overridden from GpuProgram, do nothing */
74                void loadFromSource(void) {}
75        /// @copydoc Resource::unloadImpl
76        void unloadImpl(void) {}
77
78        GLuint mProgramID;
79        GLenum mProgramType;
80    };
81
82    /** Specialisation of the GL low-level program for ARB programs. */
83    class _OgrePrivate GLArbGpuProgram : public GLGpuProgram
84    {
85    public:
86        GLArbGpuProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
87            const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
88        virtual ~GLArbGpuProgram();
89
90        /// @copydoc GpuProgram::setType
91        void setType(GpuProgramType t);
92
93
94        /// Execute the binding functions for this program
95        void bindProgram(void);
96        /// Execute the unbinding functions for this program
97        void unbindProgram(void);
98        /// Execute the param binding functions for this program
99        void bindProgramParameters(GpuProgramParametersSharedPtr params);
100                /// Bind just the pass iteration parameters
101                void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params);
102
103        /// Get the GL type for the program
104        const GLuint getProgramType(void) const
105        { return mProgramType; }
106
107    protected:
108        void loadFromSource(void);
109        /// @copydoc Resource::unloadImpl
110        void unloadImpl(void);
111
112    };
113
114
115
116}; // namespace Ogre
117
118#endif // __GLGpuProgram_H__
Note: See TracBrowser for help on using the repository browser.