Paul Golds > SDL-OpenGL-Cg > README

Download:
SDL-OpenGL-Cg-0.01.tar.gz

Annotate this POD

View/Report Bugs
Source  

cgCopyProgram</pre> <pre> Usage : (my $prog2 = cgCopyProgram($prog1) or die &quot;Cannot dupe&quot;; Purpose : Creates a copy of a program and adds it to the same context. Returns : A copy of the program on success, or undef for failure. Throws : None Comments :</pre> <pre> See Also : cgCompileProgram, cgDestroyProgram</pre> <p> </p> <h2><a name="cgcreatecontext">cgCreateContext</a></h2> <pre>

 Usage     : my $context = cgCreateContext() or die &quot;Cannot create context&quot;;
 Purpose   : Obtain a Cg context that programs can be stored in.
 Returns   : An identifier for the context, or false for failure.
 Throws    : None
 Comments  :</pre>
<pre>
 See Also  : DestroyContext</pre>
<p>
</p>
<h2><a name="cgcreateprogram">cgCreateProgram</a></h2>
<pre>
 Usage     : my $program = cgCreateProgram
               ($context, $type, $program_code, $profile, $entry, $args);
             $program or die(&quot;Cannot create program&quot;);
 Purpose   : Creates a cgShader program from a string containing source. 
 Returns   : The program itself, or undef if an error has occured.
 Throws    : None
 Comments  : Context is a CGcontext returned from CreateContext,
             Type is either SDL::OpenGL::Cg::SOURCE or
               SDL::OpenGL::Cg::Object dependant upon whether the
               shader is compiled or not.
             Program_code is the entire source code for the shader, as
               a single string.
             Entry is the name of the entry point of the shader.
             Args is an array reference containing strings which
               are passed directly to the compiler (Currently
               unimplemented).</pre>
<pre>
 See Also  : cgBindProgram, cgCopyProgram, cgCreateProgramFromFile,
             cgLoadProgram</pre>
<p>
</p>
<h2><a name="cgcreateprogramfromfile">cgCreateProgramFromFile</a></h2>
<pre>
 Usage     : my $program = cgCreateProgramFromFile
               ($context, $type, $file, $profile, $entry, $args);
             $program or die(&quot;Cannot create program&quot;);
 Purpose   : Creates a cgShader program from a file.
 Returns   : The program itself, or undef if an error has occured.
 Throws    : None
 Comments  : Context is a CGcontext returned from CreateContext,
             Type is either SDL::OpenGL::Cg::SOURCE or
               SDL::OpenGL::Cg::Object dependant upon whether the
               shader is compiled or not.
             File is the name of the file containing the shader.
             Entry is the name of the entry point of the shader.
             Args is an array reference containing strings which
               are passed directly to the compiler (Currently
               unimplemented).</pre>
<pre>
 See Also  : cgBindProgram, cgCopyProgram, cgCreateProgram,
             cgLoadProgram</pre>
<p>
</p>
<h2><a name="cgdestroycontext">cgDestroyContext</a></h2>
<pre>

 Usage     : cgDestroyContext($context) or die &quot;Cannot destroy context&quot;;
 Purpose   : Deletes a context and all of the programs it contains.
 Returns   : True if the context has been successfully deleted,
             false if it hasn't.
 Throws    : None
 Comments  :</pre>
<pre>
 See Also  : cgCreateContext</pre>
<p>
</p>
<h2><a name="cgdisableprofile">cgDisableProfile</a></h2>
<pre>
 Usage     : cgDisableProfile(PROFILE_FP20()) or die &quot;Cannot disable FP20&quot;;
 Purpose   : Deactivate a profile
 Returns   : True if the profile is successfully disabled, false if
             it failed for some reason
 Throws    : None
 Comments  :</pre>
<pre>
 See Also  : cgEnableProfile, cgIsProfileSupported, PROFILE CONSTANTS</pre>
<p>
</p>
<h2><a name="cgenableprofile">cgEnableProfile</a></h2>
<pre>

 Usage     : cgEnableProfile(PROFILE_FP20()) or die &quot;Cannot enable FP20&quot;;
 Purpose   : Activate a profile
 Returns   : True if the profile is successfully enabled, false if
             it failed for some reason.
 Throws    : None
 Comments  :</pre>
<pre>
 See Also  : cgDisableProfile, cgIsProfileSupported, cgGetLatestProfile
             PROFILE CONSTANTS</pre>
<p>
</p>
<h2><a name="cggeterror">cgGetError</a></h2>
<pre>
 Usage     : my $err = cgGetError();
 Purpose   : Obtaining the error code of the last error which occured. 
 Returns   : The error code.
 Throws    : None
 Comments  :</pre>
<pre>
 See Also  :</pre>
<p>
</p>
<h2><a name="cggetlastlisting">cgGetLastListing</a></h2>
<pre>

 Usage     : my $listing = cgGetLastListing($context);
 Purpose   : Obtain the results of the last listing compiled in a given
             context, often used for working out why a shader compilation
             failed.
 Returns   : The output string, or undef if no program has been compiled
             in that context.
 Throws    : None
 Comments  :</pre>
<pre>
 See Also  :</pre>
<p>
</p>
<h2><a name="cggetlatestprofile">cgGetLatestProfile</a></h2>
<pre>

 Usage     : my $profile = cgGetLatestProfile(CG_VERTEX());
 Purpose   : Obtaining the profile code of the last profile of a class
             to have been enabled.
 Returns   : The profile code.
 Throws    : None
 Comments  :</pre>
<pre>

 See Also  : cgEnableProfile, cgDisableProfile</pre>
<pre>

cgGetNamedParameter</pre> <pre> Usage : my $param = cgGetNamedParameter($program, 'paramname'); Purpose : Returns a handle to a shader's parameter so it can be manipulated. Throws : None Comments :

 See Also  : cgSetMatrixParameterc, cgSetMatrixParameterr, cgSetParameter,
             cgSetStateMatrixParameter</pre>
<p>
</p>
<h2><a name="cggetprofilestring">cgGetProfileString</a></h2>
<pre>
 Usage     : print &quot;FP20 is called &quot;,cgGetProfileString(PROFILE_FP20());
 Purpose   : Obtains the profile name associated with a particular ID.
 Returns   : The name of the profile, or undef if the ID isn't known.
 Throws    : None
 Comments  :</pre>
<pre>
 See Also  : PROFILE CONSTANTS</pre>
<p>
</p>
<h2><a name="cgisprofilesupported">cgIsProfileSupported</a></h2>
<pre>

 Usage     : my $can_fp20 = cgIsProfileSupported(PROFILE_FP20);
 Purpose   : Find out whether a given profile is supported.
 Returns   : True is the profile is supported, false is it
             isn't.
 Arguments : The profile ID to be checked.
 Throws    : None
 Comments  :</pre>
<pre>
 See Also  : PROFILE CONSTANTS, cgDisableProfile, cgEnableProfile</pre>
<p>
</p>
<h2><a name="cgloadprogram">cgLoadProgram</a></h2>
<pre>
 Usage     : cgLoadProgram($prog) or die (&quot;Cannot load program&quot;);
 Purpose   : Loads a compiled program into memory.
 Returns   : True if the program was loaded successfully, false
             if there was an error.
 Arguments : The program to be loaded.
 Throws    : None
 Comments  : Should be called after cgCompileProgram() and before
             cgBindProgram().</pre>
<pre>
 SeeAlso   : cgBindProgram, cgCompileProgram</pre>
<p>
</p>
<h2><a name="cgsetmatrixparameterc">cgSetMatrixParameterc</a></h2>
<pre>
 Usage     : cgSetMatrixParameterc ($param, @vals) or die &quot;Error!&quot;;
 Purpose   : Sets the value of a matrix parameter
 Returns   : True if the assignment went okay, false if there
             was an error.
 Arguments : The parameter to be set, and the values to set it to.
 Throws    : None
 Comments  : Differs from cgSetMatrixParameterr in that this version
             expects the data to be in column format.
 TODO      : Currently only sets float4x4 matrices.</pre>
<pre>
 SeeAlso   : cgGetNamedParameter, cgSetMatrixParameterc, cgSetParameter,
             cgSetStateMatrixParameter</pre>
<p>
</p>
<h2><a name="cgsetmatrixparameterr">cgSetMatrixParameterr</a></h2>
<pre>
 Usage     : cgSetMatrixParameterr ($param, @vals) or die &quot;Error!&quot;;
 Purpose   : Sets the value of a matrix parameter
 Returns   : True if the assignment went okay, false if there
             was an error.
 Arguments : The parameter to be set, and the values to set it to.
 Throws    : None
 Comments  : Differs from cgSetMatrixParameterc in that this version
             expects the data to be in row format.
 TODO      : Currently only sets float4x4 matrices.</pre>
<pre>
 SeeAlso   : cgGetNamedParameter, cgSetMatrixParameterc, cgSetParameter,
             cgSetStateMatrixParameter</pre>
<p>
</p>
<h2><a name="cgsetstatematrixparameter">cgSetStateMatrixParameter</a></h2>
<pre>
 Usage     : cgSetStateMatrixParameter($param,
              CG_MODELVIEW_PROJECTION_MATRIX(), CG_MATRIX_IDENTITY())
              or die &quot;Error!&quot;;
 Purpose   : To allow parameters to follow the OpenGL matrix state
             more easily, to allow setting Modelview etc. for the
             shaders.
 Returns   : True if the parameter was set without difficulty,
             undefined if a problem was experienced.
 Arguments : None
 Throws    : None
 Comments  : The second argument indicates which of OpenGL's matrices
             it should follow, and the third indicates which of the
             transforms to apply as it's copied.  See MATRIX CONSTANTS
             for more information.

COMPILE CONSTANT/pre <pre> Usage : my $from_source = CG_SOURCE(); Purpose : To indicate whether Cg code is to be built from source or simply read from a compiled object. Returns : The constant's ID Arguments : None Throws : None Comments : Currently includes CG_SOURCE and CG_OBJECT.

PROFILE CONSTANT/pre <pre> Usage : my $fp20 = CG_PROFILE_FP20(); Purpose : A set of constants for the Cg profile IDs. Returns : The profile ID. Argument : None Throws : None Comments : Currently includes CG_PROFILE_FP20, CG_PROFILE_FP30, CG_PROFILE_VP20, CG_PROFILE_VP30, CG_PROFILE_ARBFP1 and CG_PROFILE_ARBVP1.</pre> <pre> See Also : cgEnableProfile, cgDisableProfile</pre> <p> </p> <h2><a name="matrix_constants">MATRIX CONSTANT/a</h2> <pre> Usage : cgSetStateMatrixParameter($param, CG_MODELVIEW_PROJECTION_MATRIX(), CG_MATRIX_IDENTITY()) or die &quot;Error!&quot;; Purpse : Identifies the different OpenGL matrices and the transforms that can be applied to them as they are transfered to the shader. Comments : Matrix identification constants include: CG_MODELVIEW_MATRIX, CG_PROJECTION_MATRIX, CG_TEXTURE_MATRIX, CG_MODELVIEW_PROJECTION_MATRIX. Transformation identification constants include: CG_MATRIX_IDENTITY, CG_MATRIX_TRANSPOSE, CG_MATRIX_INVERSE, CG_MATRIX_INVERSE_TRANSPOSE.</pre> <p> </p> <hr /> <h1><a name="usage">USAGE</a></h1> <p> </p> <hr /> <h1><a name="test_scripts">TEST SCRIPT/a</h1> <p>The test-scripts subdirectory of the install contains a set of scripts intended to demonstrate Cg coding. Whilst at the moment these are pretty much really there more to ensure correct functioning of various parts of the module they should act to ensure the module works on a given machine.</p> <p>In order to run these you should be in the test-scripts directory. Many of them use relative paths to find their shader files and so attempting to run them from another directory will result in files not being found.</p> <p> </p> <hr /> <h1><a name="bugs">BUG/a</h1> <p>This module is currently judged to be PRE-ALPHA. Whilst I have made some efforts to make it as bug-free as possible I have no doubt that there are many bugs lurking in the undergrowth, waiting to bite the unwary.</p> <p>Also, at present only a small (but important) fraction of the C API is supported. I am still working on the rest of the API and expect a complete version to be released reasonably soon.</p> <p> </p> <hr /> <h1><a name="support">SUPPOR/a</h1> <p> </p> <hr /> <h1><a name="history">HISTOR/a</h1> <p>0.01 Tue Aug 19 Release 0.01 released. This contained a subset of the functionality of the libraries, enough only to run and control a basic shader.</p> <p>0.00 Wed Jul 30 Work began!</p> <p> </p> <hr /> <h1><a name="author">AUTHO/a</h1> <pre> Paul Golds Molt@Simbio51s.com

</pre> <p> </p> <hr /> <h1><a name="copyright">COPYRIGH/a</h1> <p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

</p> <p>The full text of the license can be found in the LICENSE file included with this module.

</p> <p> </p> <hr /> <h1><a name="see_also">SEE ALS/a</h1> <p>perl(1), SDL, SDL::OpenGL

</p>

</body>

</html>

syntax highlighting: