OpenSceneGraph/doc/doc++/osgGL2/ProgramObject.html

270 lines
14 KiB
HTML
Raw Normal View History

2003-07-23 19:27:31 +08:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>class OSGGL2_EXPORT osgGL2::ProgramObject</TITLE>
2004-08-06 14:53:36 +08:00
<META NAME="GENERATOR" CONTENT="DOC++ 3.4.6">
2003-07-23 19:27:31 +08:00
</HEAD>
<BODY BGCOLOR="#ffffff">
2004-08-06 14:53:36 +08:00
<H2>class OSGGL2_EXPORT <A HREF="#DOC.DOCU">osgGL2::ProgramObject</A></H2></H2><BLOCKQUOTE>osgGL2::ProgramObject is an application-level abstraction of the OpenGL Shading Language glProgramObject.</BLOCKQUOTE>
2003-07-23 19:27:31 +08:00
<HR>
<H2>Inheritance:</H2>
<APPLET CODE="ClassGraph.class" WIDTH=600 HEIGHT=65>
<param name=classes value="Mosg::StateAttribute,M,CProgramObject,MProgramObject.html">
<param name=before value="M,M">
<param name=after value="Md_,M">
<param name=indent value="0,1">
<param name=arrowdir value="down">
</APPLET>
<HR>
<DL>
<P><DL>
<DT><H3>Public Methods</H3><DD><DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.67.4.1">ProgramObject</A></B>()
2003-07-23 19:27:31 +08:00
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.67.4.2">ProgramObject</A></B>(const <!1><A HREF="ProgramObject.html#DOC.67.4.2">ProgramObject</A>&amp; rhs, const osg::CopyOp&amp; copyop=osg::CopyOp::SHALLOW_COPY)
2003-07-23 19:27:31 +08:00
<DD><I>Copy constructor using CopyOp to manage deep vs shallow copy</I>
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.67.4.3">META_StateAttribute</A></B>(<!1><A HREF="osgGL2.html">osgGL2</A>, <!1><A HREF="ProgramObject.html">ProgramObject</A>, PROGRAMOBJECT)
2003-07-23 19:27:31 +08:00
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>virtual int <B><A HREF="#DOC.67.4.4">compare</A></B>(const osg::StateAttribute&amp; sa) const
2003-07-23 19:27:31 +08:00
<DD><I>return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs</I>
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>virtual void <B><A HREF="#DOC.67.4.5">apply</A></B>(osg::State&amp; state) const
<DD><I>If enabled, install our shader program in the GL pipeline, performing any shader program rebuild operations that might be pending.</I>
2003-07-23 19:27:31 +08:00
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>virtual void <B><A HREF="#DOC.67.4.6">compileGLObjects</A></B>(osg::State&amp; state) const
2003-07-23 19:27:31 +08:00
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>virtual void <B><A HREF="#DOC.67.4.7">releaseGLObjects</A></B>(osg::State* state=0) const
<DD><I>release an OpenGL objects in specified graphics context if State object is passed, otherwise release OpenGL objexts for all graphics context if State object pointer NULL</I>
2003-07-23 19:27:31 +08:00
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.67.4.8">dirtyProgramObject</A></B>()
<DD><I>Mark us as "dirty" and in need of relinking.</I>
2003-07-23 19:27:31 +08:00
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.67.4.9">dirtyShaderObjects</A></B>()
<DD><I>Mark our attached ShaderObjects as "dirty" and in need of recompilation.</I>
2003-07-23 19:27:31 +08:00
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.67.4.10">enable</A></B>( bool enabled )
<DD><I>An override to control whether the shader program will actually be installed when OSG attempts to apply() </I>
2003-07-23 19:27:31 +08:00
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.67.4.11">addShader</A></B>( <!1><A HREF="ShaderObject.html">ShaderObject</A>* shadObj )
<DD><I>Attach a ShaderObject to this ProgramObject </I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.67.4.12">setUniform</A></B>( const char* uniformName, int value )
<DD><I>Assign a value to a ProgramObject's uniform variable </I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.67.4.13">setUniform</A></B>( const char* uniformName, float value )
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.67.4.14">setUniform</A></B>( const char* uniformName, osg::Vec2 value )
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.67.4.15">setUniform</A></B>( const char* uniformName, osg::Vec3 value )
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.67.4.16">setUniform</A></B>( const char* uniformName, osg::Vec4 value )
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>inline void <B><A HREF="#DOC.67.4.17">setSampler</A></B>( const char* uniformName, int value )
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>static void <B><A HREF="#DOC.67.4.18">deleteObject</A></B>(unsigned int contextID, GLhandleARB handle)
<DD><I>Mark internal GL objects for deletion.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>static void <B><A HREF="#DOC.67.4.19">flushDeletedGL2Objects</A></B>(unsigned int contextID, double currentTime, double&amp; availableTime)
2003-07-23 19:27:31 +08:00
<DD><I>flush all the cached glProgramObjects which need to be deleted in the OpenGL context related to contextID</I>
</DL></P>
2004-08-06 14:53:36 +08:00
<P><DL>
<DT><H3>Protected Classes</H3><DD><DT>
class <B><A HREF="PerContextProgObj.html">PerContextProgObj</A></B>: public osg::Referenced
<DD><I>PCPO is an OSG-internal encapsulation of glProgramObjects per-GL context.</I>
</DL></P>
2003-07-23 19:27:31 +08:00
<P><DL>
<DT><H3>Protected Fields</H3><DD><DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>bool <B><A HREF="#DOC.67.4.24">_enabled</A></B>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif><!1><A HREF="ProgramObject.html#DOC.67.4.25">ShaderObjectList</A> <B><A HREF="#DOC.67.4.26">_shaderObjectList</A></B>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>mutable osg::buffered_value&lt; osg::ref_ptr&lt;<!1><A HREF="PerContextProgObj.html">PerContextProgObj</A>&gt; &gt; <B><A HREF="#DOC.67.4.27">_pcpoList</A></B>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>mutable int <B><A HREF="#DOC.67.4.28">_frameNumberOfLastPCPOUpdate</A></B>
2003-07-23 19:27:31 +08:00
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>mutable <!1><A HREF="osgGL2.html#DOC.67.7">UniformValueList</A> <B><A HREF="#DOC.67.4.29">_univalList</A></B>
2003-07-23 19:27:31 +08:00
</DL></P>
<P><DL>
<DT><H3>Protected Methods</H3><DD><DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>virtual <B><A HREF="#DOC.67.4.21">~ProgramObject</A></B>()
2003-07-23 19:27:31 +08:00
<DT>
2004-08-06 14:53:36 +08:00
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif><!1><A HREF="PerContextProgObj.html">PerContextProgObj</A>* <B><A HREF="#DOC.67.4.22">getPCPO</A></B>(unsigned int contextID) const
<DD><I>Get the PCPO for a particular GL context </I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.67.4.23">updateUniforms</A></B>( int frameNumber ) const
<DD><I>Per frame, copy the list of pending UniformValue updates to each of the PCPOs.</I>
2003-07-23 19:27:31 +08:00
</DL></P>
<P><DL>
2004-08-06 14:53:36 +08:00
<DT><H3>Protected</H3><DD><DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>typedef std::vector&lt; <!1><A HREF="osgGL2.html#DOC.67.3">ShaderObjectPtr</A> &gt; <B><A HREF="#DOC.67.4.25">ShaderObjectList</A></B>
2003-07-23 19:27:31 +08:00
</DL></P>
</DL>
<A NAME="DOC.DOCU"></A>
<HR>
<H2>Documentation</H2>
2004-08-06 14:53:36 +08:00
<BLOCKQUOTE>osgGL2::ProgramObject is an application-level abstraction of the OpenGL Shading Language glProgramObject.
It is an osg::StateAttribute that, when applied, will install an OGLSL
shader program for subsequent rendering.
osgGL2::ShaderObjects containing the actual shader source code are
attached to the ProgramObject, which will then manage the compilation,
linking, and installation of the GL shader program.
ProgramObject will automatically manage per-context instancing of the
internal objects, if that is necessary for a particular display
configuration.</BLOCKQUOTE>
2003-07-23 19:27:31 +08:00
<DL>
<A NAME="ProgramObject"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.1"></A>
2003-07-23 19:27:31 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> ProgramObject()</B></TT>
<DL><DT><DD></DL><P>
<A NAME="ProgramObject"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.2"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> ProgramObject(const <!1><A HREF="ProgramObject.html#DOC.67.4.2">ProgramObject</A>&amp; rhs, const osg::CopyOp&amp; copyop=osg::CopyOp::SHALLOW_COPY)</B></TT>
2003-07-23 19:27:31 +08:00
<DD>Copy constructor using CopyOp to manage deep vs shallow copy
<DL><DT><DD></DL><P>
<A NAME="META_StateAttribute"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.3"></A>
2003-07-23 19:27:31 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> META_StateAttribute(<!1><A HREF="osgGL2.html">osgGL2</A>, <!1><A HREF="ProgramObject.html">ProgramObject</A>, PROGRAMOBJECT)</B></TT>
<DL><DT><DD></DL><P>
<A NAME="compare"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.4"></A>
2003-07-23 19:27:31 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>virtual int compare(const osg::StateAttribute&amp; sa) const </B></TT>
<DD>return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs
<DL><DT><DD></DL><P>
<A NAME="apply"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.5"></A>
2003-07-23 19:27:31 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>virtual void apply(osg::State&amp; state) const </B></TT>
2004-08-06 14:53:36 +08:00
<DD>If enabled, install our shader program in the GL pipeline,
performing any shader program rebuild operations that might
be pending.
2003-07-23 19:27:31 +08:00
<DL><DT><DD></DL><P>
2004-08-06 14:53:36 +08:00
<A NAME="compileGLObjects"></A>
<A NAME="DOC.67.4.6"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>virtual void compileGLObjects(osg::State&amp; state) const </B></TT>
<DL><DT><DD></DL><P>
<A NAME="releaseGLObjects"></A>
<A NAME="DOC.67.4.7"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>virtual void releaseGLObjects(osg::State* state=0) const </B></TT>
<DD>release an OpenGL objects in specified graphics context if State
object is passed, otherwise release OpenGL objexts for all graphics context if
State object pointer NULL
2003-07-23 19:27:31 +08:00
<DL><DT><DD></DL><P>
<A NAME="dirtyProgramObject"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.8"></A>
2003-07-23 19:27:31 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void dirtyProgramObject()</B></TT>
2004-08-06 14:53:36 +08:00
<DD>Mark us as "dirty" and in need of relinking.
<DL><DT><DD></DL><P>
<A NAME="dirtyShaderObjects"></A>
<A NAME="DOC.67.4.9"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void dirtyShaderObjects()</B></TT>
<DD>Mark our attached ShaderObjects as "dirty" and in need of
recompilation.
<DL><DT><DD></DL><P>
<A NAME="enable"></A>
<A NAME="DOC.67.4.10"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void enable( bool enabled )</B></TT>
<DD>An override to control whether the shader program will
actually be installed when OSG attempts to apply()
2003-07-23 19:27:31 +08:00
<DL><DT><DD></DL><P>
<A NAME="addShader"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.11"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void addShader( <!1><A HREF="ShaderObject.html">ShaderObject</A>* shadObj )</B></TT>
<DD>Attach a ShaderObject to this ProgramObject
<DL><DT><DD></DL><P>
<A NAME="setUniform"></A>
<A NAME="DOC.67.4.12"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void setUniform( const char* uniformName, int value )</B></TT>
<DD>Assign a value to a ProgramObject's uniform variable
<DL><DT><DD></DL><P>
<A NAME="setUniform"></A>
<A NAME="DOC.67.4.13"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void setUniform( const char* uniformName, float value )</B></TT>
<DL><DT><DD></DL><P>
<A NAME="setUniform"></A>
<A NAME="DOC.67.4.14"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void setUniform( const char* uniformName, osg::Vec2 value )</B></TT>
<DL><DT><DD></DL><P>
<A NAME="setUniform"></A>
<A NAME="DOC.67.4.15"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void setUniform( const char* uniformName, osg::Vec3 value )</B></TT>
<DL><DT><DD></DL><P>
<A NAME="setUniform"></A>
<A NAME="DOC.67.4.16"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void setUniform( const char* uniformName, osg::Vec4 value )</B></TT>
<DL><DT><DD></DL><P>
<A NAME="setSampler"></A>
<A NAME="DOC.67.4.17"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>inline void setSampler( const char* uniformName, int value )</B></TT>
2003-07-23 19:27:31 +08:00
<DL><DT><DD></DL><P>
<A NAME="deleteObject"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.18"></A>
2003-07-23 19:27:31 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>static void deleteObject(unsigned int contextID, GLhandleARB handle)</B></TT>
2004-08-06 14:53:36 +08:00
<DD>Mark internal GL objects for deletion.
Deletion requests are queued until they can be executed
in the proper GL context.
2003-07-23 19:27:31 +08:00
<DL><DT><DD></DL><P>
<A NAME="flushDeletedGL2Objects"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.19"></A>
2003-07-23 19:27:31 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>static void flushDeletedGL2Objects(unsigned int contextID, double currentTime, double&amp; availableTime)</B></TT>
<DD>flush all the cached glProgramObjects which need to be deleted
in the OpenGL context related to contextID
<DL><DT><DD></DL><P>
<A NAME="~ProgramObject"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.21"></A>
2003-07-23 19:27:31 +08:00
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>virtual ~ProgramObject()</B></TT>
<DL><DT><DD></DL><P>
2004-08-06 14:53:36 +08:00
<A NAME="getPCPO"></A>
<A NAME="DOC.67.4.22"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B><!1><A HREF="PerContextProgObj.html">PerContextProgObj</A>* getPCPO(unsigned int contextID) const </B></TT>
<DD>Get the PCPO for a particular GL context
<DL><DT><DD></DL><P>
<A NAME="updateUniforms"></A>
<A NAME="DOC.67.4.23"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void updateUniforms( int frameNumber ) const </B></TT>
<DD>Per frame, copy the list of pending UniformValue updates to
each of the PCPOs.
<DL><DT><DD></DL><P>
<A NAME="_enabled"></A>
<A NAME="DOC.67.4.24"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>bool _enabled</B></TT>
<DL><DT><DD></DL><P>
2003-07-23 19:27:31 +08:00
<A NAME="ShaderObjectList"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.25"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>typedef std::vector&lt; <!1><A HREF="osgGL2.html#DOC.67.3">ShaderObjectPtr</A> &gt; ShaderObjectList</B></TT>
2003-07-23 19:27:31 +08:00
<DL><DT><DD></DL><P>
<A NAME="_shaderObjectList"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.26"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B><!1><A HREF="ProgramObject.html#DOC.67.4.25">ShaderObjectList</A> _shaderObjectList</B></TT>
2003-07-23 19:27:31 +08:00
<DL><DT><DD></DL><P>
<A NAME="_pcpoList"></A>
2004-08-06 14:53:36 +08:00
<A NAME="DOC.67.4.27"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>mutable osg::buffered_value&lt; osg::ref_ptr&lt;<!1><A HREF="PerContextProgObj.html">PerContextProgObj</A>&gt; &gt; _pcpoList</B></TT>
2003-07-23 19:27:31 +08:00
<DL><DT><DD></DL><P>
2004-08-06 14:53:36 +08:00
<A NAME="_frameNumberOfLastPCPOUpdate"></A>
<A NAME="DOC.67.4.28"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>mutable int _frameNumberOfLastPCPOUpdate</B></TT>
<DL><DT><DD></DL><P>
<A NAME="_univalList"></A>
<A NAME="DOC.67.4.29"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>mutable <!1><A HREF="osgGL2.html#DOC.67.7">UniformValueList</A> _univalList</B></TT>
2003-07-23 19:27:31 +08:00
<DL><DT><DD></DL><P></DL>
<HR><DL><DT><B>This class has no child classes.</B></DL>
<DL><DT><DD></DL><P><P><I><A HREF="index.html">Alphabetic index</A></I> <I><A HREF="HIER.html">HTML hierarchy of classes</A> or <A HREF="HIERjava.html">Java</A></I></P><HR>
<BR>
2004-08-06 14:53:36 +08:00
This page was generated with the help of <A HREF="http://www.linuxsupportline.com/~doc++">DOC++</A>.
2003-07-23 19:27:31 +08:00
</BODY>
</HTML>