Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            context = Cg.CreateContext();

            Cg.SetErrorCallback(errorDelegate);
            cgVertexProfile = CgGL.GetLatestProfile(CgGLEnum.Vertex);

            string[] vArgs = CgGL.GetOptimalOptions(cgVertexProfile);

            if (cgVertexProfile != CgProfile.Unknown)
            {
                if (CgGL.IsProfileSupported(cgVertexProfile))
                {
                    CgGL.SetOptimalOptions(cgVertexProfile);
                }
            }

            cgVertexProgram = Cg.CreateProgramFromFile(
               context,                  // Cg runtime context
               CgEnum.Source,            // Program in human-readable form
               vertexProgramFileName,    // Name of file containing program
               cgVertexProfile,          // Profile: OpenGL ARB vertex program
               cgVertexEntryFuncName,    // Entry function name
               vArgs);                   // Extra compiler options

            CgGL.LoadProgram(cgVertexProgram);

            vertexParamModelViewProj = Cg.GetNamedParameter(cgVertexProgram, "modelViewProj");

            cgFragmentProfile = CgGL.GetLatestProfile(CgGLEnum.Fragment);
            string[] fArgs = CgGL.GetOptimalOptions(cgFragmentProfile);

            if (cgFragmentProfile != CgProfile.Unknown)
            {
                if (CgGL.IsProfileSupported(cgFragmentProfile))
                {
                    CgGL.SetOptimalOptions(cgFragmentProfile);
                }
            }

            cgFragmentProgram = Cg.CreateProgram(
                context,                   // Cg runtime context */
                CgEnum.Source,             // Program in human-readable form */
                "float4 main(uniform float4 c) : COLOR { return c; }",
                cgFragmentProfile,         // Profile: OpenGL ARB vertex program */
                "main",                    // Entry function name */
                fArgs);                    // Extra compiler options */

            CgGL.LoadProgram(cgFragmentProgram);

            fragmentParamColor = Cg.GetNamedParameter(cgFragmentProgram, "c");
        }
Beispiel #2
0
 /// <summary>
 /// <para>cgCreateParameterAnnotation adds a new annotation to the specified param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this param. CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT, CG_FLOAT, CG_BOOL, or CG_STRING.</para>
 /// <para>VERSION: cgCreateParameterAnnotation was introduced in Cg 1.5.</para>
 /// </summary>
 /// <param name="parm">The param to which the new annotation will be added.</param>
 /// <param name="name">The name of the new annotation.</param>
 /// <param name="type">The type of the new annotation.</param>
 /// <returns>Returns the new CGannotation handle on success. Returns NULL if an error occurs.</returns>
 public static CgAnnotation CreateParameterAnnotation(CgParameter param, [In]string name, CgType type)
 {
     return cgCreateParameterAnnotation(param, name, type);
 }
Beispiel #3
0
        protected override void OnLoad(EventArgs e)
        {
            /* Tightly packed texture data. */
            GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
            GL.Enable(EnableCap.Texture2D);
            GL.BindTexture(TextureTarget.Texture2D, 666);

            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb8, 128, 128, 0,
                          PixelFormat.Rgb, PixelType.UnsignedByte, ImageDemon.Array);

            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);

            context = Cg.CreateContext();

            Cg.SetErrorCallback(errorDelegate);

            cgVertexProfile = CgGL.GetLatestProfile(CgGLEnum.Vertex);
            string[] vArgs = CgGL.GetOptimalOptions(cgVertexProfile);

            if (cgVertexProfile != CgProfile.Unknown)
            {
                if (CgGL.IsProfileSupported(cgVertexProfile))
                {
                    CgGL.SetOptimalOptions(cgVertexProfile);
                }
            }

            cgVertexProgram = Cg.CreateProgramFromFile(
               context,                  // Cg runtime context
               CgEnum.Source,            // Program in human-readable form
               VertexProgramFileName,    // Name of file containing program
               cgVertexProfile,          // Profile: OpenGL ARB vertex program
               CgVertexEntryFuncName,    // Entry function name
               vArgs);                   // Extra compiler options

            CgGL.LoadProgram(cgVertexProgram);

            cgFragmentProfile = CgGL.GetLatestProfile(CgGLEnum.Fragment);
            string[] fArgs = CgGL.GetOptimalOptions(cgVertexProfile);

            if (cgFragmentProfile != CgProfile.Unknown)
            {
                if (CgGL.IsProfileSupported(cgFragmentProfile))
                {
                    CgGL.SetOptimalOptions(cgFragmentProfile);
                }
            }

            cgFragmentProgram = Cg.CreateProgramFromFile(
               context,                   // Cg runtime context */
               CgEnum.Source,             // Program in human-readable form */
               FragmentProgramFileName,   // Name of file containing program */
               cgFragmentProfile,         // Profile: OpenGL ARB vertex program */
               CgFragmentEntryFuncName,   // Entry function name */
               fArgs);                    // Extra compiler options */

            CgGL.LoadProgram(cgFragmentProgram);

            fragmentParamDecal = Cg.GetNamedParameter(cgFragmentProgram, "decal");
            CgGL.SetTextureParameter(fragmentParamDecal, 666);
        }
Beispiel #4
0
 /// <summary>
 /// <para>Returns the source param to which param is connected.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param.</para>
 /// <para>VERSION: cgGetConnectedParameter was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The destination param.</param>
 /// <returns>Returns the connected source param if param is connected to one. Returns NULL otherwise.</returns>
 public static CgParameter GetConnectedParameter(CgParameter param)
 {
     return cgGetConnectedParameter(param);
 }
Beispiel #5
0
 /// <summary>
 /// <para>cgGetArrayTotalSize returns the total number of elements of the array specified by param.</para>
 /// <para>The total number of elements is equal to the product of the size of each dimension of the array.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param.</para>
 /// <para>VERSION: cgGetArrayTotalSize was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="param">The array param handle.</param>
 /// <returns>Returns the total size of param if pararm is an array. Returns 0 if param is not an array, or if an error occurs.</returns>
 public static int GetArrayTotalSize(CgParameter param)
 {
     return cgGetArrayTotalSize(param);
 }
Beispiel #6
0
 /// <summary>
 /// <para>cgGetArrayParameter returns the param of array param specified by index.</para>
 /// <para>cgGetArrayParameter is used when inspecting elements of an array param in a program.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_ARRAY_PARAM_ERROR is generated if param is not an array param. CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is outside the bounds of param.</para>
 /// <para>VERSION: cgGetArrayParameter was introduced in Cg 1.1.</para>
 /// </summary>
 /// <param name="param">The array param handle.</param>
 /// <param name="index">The index into the array.</param>
 /// <returns>Returns the param at the specified index of param if param references an array, and the index is valid. Returns NULL otherwise.</returns>
 public static CgParameter GetArrayParameter(CgParameter param, int index)
 {
     return cgGetArrayParameter(param, index);
 }
Beispiel #7
0
 /// <summary>
 /// <para>cgDisconnectParameter disconnects an existing connection made with cgConnectParameter between two parameters.</para>
 /// <para>Since a given param can only be connected to one source param, only the destination param is required as an argument to cgDisconnectParameter.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param.</para>
 /// <para>VERSION: cgDisconnectParameter was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The destination param in the connection that will be disconnected.</param>
 public static void DisconnectParameter(CgParameter param)
 {
     cgDisconnectParameter(param);
 }
Beispiel #8
0
 /// <summary>
 /// <para>cgCreateSamplerStateAssignment creates a new state assignment for the given state and sampler param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para>
 /// <para>VERSION: cgCreateSamplerStateAssignment was introduced in Cg 1.5.</para>
 /// </summary>
 /// <param name="param">The sampler param to which the new state assignment will be associated.</param>
 /// <param name="state">The state for which to create the new state assignment.</param>
 /// <returns>Returns the handle to the created sampler state assignment.</returns>
 public static CgStateAssignment CreateSamplerStateAssignment(CgParameter param, CgState state)
 {
     return cgCreateSamplerStateAssignment(param, state);
 }
Beispiel #9
0
 /// <summary>
 /// <para>cgSetParameter4i sets the value of a given scalar or vector param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.</para>
 /// <para>VERSION: cgSetParameter4i was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="param">The param that will be set.</param>
 /// <param name="x, y, z, w">The values used to set param.</param>
 public static void SetParameter4i(CgParameter param, int x, int y, int z, int w)
 {
     cgSetParameter4i(param, x, y, z, w);
 }
Beispiel #10
0
 /// <summary>
 /// <para>cgSetParameter4fv sets the value of a given scalar or vector param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.</para>
 /// <para>VERSION: cgSetParameter4fv was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The param that will be set.</param>
 /// <param name="v">Array of values to use to set param.</param>
 public static void SetParameter4fv(CgParameter param, float[] v)
 {
     cgSetParameter4fv(param, v);
 }
Beispiel #11
0
 /// <summary>
 /// <para>cgSetParameter4f sets the value of a given scalar or vector param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.</para>
 /// <para>VERSION: cgSetParameter4f was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The param that will be set.</param>
 /// <param name="x, y, z, w">The values used to set param.</param>
 public static void SetParameter4f(CgParameter param, float x, float y, float z, float w)
 {
     cgSetParameter4f(param, x, y, z, w);
 }
Beispiel #12
0
 /// <summary>
 /// <para>cgSetParameter4dv sets the value of a given scalar or vector param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.</para>
 /// <para>VERSION: cgSetParameter4dv was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The param that will be set.</param>
 /// <param name="v">Array of values to use to set param.</param>
 public static void SetParameter4dv(CgParameter param, double[] v)
 {
     cgSetParameter4dv(param, v);
 }
Beispiel #13
0
 /// <summary>
 /// <para>cgSetParameter4d sets the value of a given scalar or vector param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.</para>
 /// <para>VERSION: cgSetParameter4d was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The param that will be set.</param>
 /// <param name="x, y, z, w">The values used to set param.</param>
 public static void SetParameter4d(CgParameter param, double x, double y, double z, double w)
 {
     cgSetParameter4d(param, x, y, z, w);
 }
Beispiel #14
0
 /// <summary>
 /// <para>cgSetParameter3i sets the value of a given scalar or vector param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.</para>
 /// <para>VERSION: cgSetParameter3i was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="param">The param that will be set.</param>
 /// <param name="x, y, z">The values used to set param.</param>
 public static void SetParameter3i(CgParameter param, int x, int y, int z)
 {
     cgSetParameter3i(param, x, y, z);
 }
Beispiel #15
0
 /// <summary>
 /// <para>cgSetParameter3f sets the value of a given scalar or vector param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.</para>
 /// <para>VERSION: cgSetParameter3f was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The param that will be set.</param>
 /// <param name="x, y, z">The values used to set param.</param>
 public static void SetParameter3f(CgParameter param, float x, float y, float z)
 {
     cgSetParameter3f(param, x, y, z);
 }
Beispiel #16
0
 /// <summary>
 /// <para>cgSetStringParameterValue allows the application to  set the value of a string param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_TYPE_ERROR is generated if param is not string-typed. CG_INVALID_PARAMETER_ERROR is generated if value is NULL.</para>
 /// <para>VERSION: cgSetStringParameterValue was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="param">The param whose value will be set.</param>
 /// <param name="value">The string to set the param's value as.</param>
 public static void SetStringParameterValue(CgParameter param, string value)
 {
     cgSetStringParameterValue(param, value);
 }
Beispiel #17
0
 /// <summary>
 /// <para>cgSetTextureStateAssignment sets the value of a state assignment of texture type to an effect param of type CG_TEXTURE.</para>
 /// <para>ERROR: CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment. CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of texture type. CG_ARRAY_SIZE_MISMATCH_ERROR is generated if sa is an array and not a scalar. CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param.</para>
 /// <para>VERSION: cgSetTextureStateAssignment was introduced in Cg 1.5.</para>
 /// </summary>
 /// <param name="sa">A state assignment of type CG_TEXTURE.</param>
 /// <param name="param">An effect param of type CG_TEXTURE.</param>
 /// <returns>Returns CG_TRUE if it succeeds in setting the state assignment. Returns CG_FALSE otherwise.</returns>
 public static CgBool SetTextureStateAssignment(CgStateAssignment sa, CgParameter param)
 {
     return cgSetTextureStateAssignment(sa, param);
 }
Beispiel #18
0
 /// <summary>
 /// <para>cgSetParameter4iv sets the value of a given scalar or vector param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.</para>
 /// <para>VERSION: cgSetParameter4iv was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="param">The param that will be set.</param>
 /// <param name="v">Array of values to use to set param.</param>
 public static void SetParameter4iv(CgParameter param, int[] v)
 {
     cgSetParameter4iv(param, v);
 }
Beispiel #19
0
 /// <summary>
 /// <para>cgDestroyParameter destroys parameters created with  cgCreateParameter,  cgCreateParameterArray, or cgCreateParameterMultiDimArray.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_NOT_ROOT_PARAMETER_ERROR is generated if the param isn't the top-level param of a struct or array that was created. CG_PARAMETER_IS_NOT_SHARED_ERROR is generated if param does not refer to a param created by one of the cgCreateParameter family of entry points. CG_CANNOT_DESTROY_PARAMETER_ERROR is generated if param is a source param in a connection made by cgConnectParameter. cgDisconnectParameter should be used before calling cgDestroyParameter in such a case.</para>
 /// <para>VERSION: cgDestroyParameter was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The param to destroy.</param>
 public static void DestroyParameter(CgParameter param)
 {
     cgDestroyParameter(param);
 }
Beispiel #20
0
 /// <summary>
 /// <para>cgSetParameterSemantic allows the application to set the semantic of a param in a Cg program.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is not a leaf node, or if the semantic string is NULL.</para>
 /// <para>VERSION: cgSetParameterSemantic was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The program param.</param>
 /// <param name="semantic">The semantic.</param>
 public static void SetParameterSemantic(CgParameter param, string semantic)
 {
     cgSetParameterSemantic(param, semantic);
 }
Beispiel #21
0
 /// <summary>
 /// <para>cgGetArrayDimension returns the dimension of the array specified by param.</para>
 /// <para>cgGetArrayDimension is used when inspecting an array param in a program.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_ARRAY_PARAM_ERROR is generated if param is not an array param.</para>
 /// <para>VERSION: cgGetArrayDimension was introduced in Cg 1.1.</para>
 /// </summary>
 /// <param name="param">The array param handle.</param>
 /// <returns>Returns the dimension of param if param references an array. Returns 0 otherwise.</returns>
 public static int GetArrayDimension(CgParameter param)
 {
     return cgGetArrayDimension(param);
 }
Beispiel #22
0
 /// <summary>
 /// <para>cgSetParameterValuedc allows the application to set the value of any numeric param or param array.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program. CG_INVALID_POINTER_ERROR is generated if v is NULL. CG_NOT_ENOUGH_DATA_ERROR is generated if nelements is less than the total size of param. CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.</para>
 /// <para>VERSION: cgSetParameterValuedc was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="param">The program param whose value will be set.</param>
 /// <param name="nelements">The number of elements in array v.</param>
 /// <param name="v">Source buffer from which the param values will be read.</param>
 public static void SetParameterValuedc(CgParameter param, int nelements, double[] v)
 {
     cgSetParameterValuedc(param, nelements, v);
 }
Beispiel #23
0
 /// <summary>
 /// <para>cgGetArraySize returns the size of the given dimension of the array specified by param.</para>
 /// <para>cgGetArraySize is used when inspecting an array param in a program.</para>
 /// <para>ERROR: CG_INVALID_DIMENSION_ERROR is generated if dimension is less than 0. CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param.</para>
 /// <para>VERSION: cgGetArraySize was introduced in Cg 1.1.</para>
 /// </summary>
 /// <param name="param">The array param handle.</param>
 /// <param name="dimension">The array dimension whose size will be returned.</param>
 /// <returns>Returns the size of param if param is an array. Returns 0 if param is not an array, or an error occurs.</returns>
 public static int GetArraySize(CgParameter param, int dimension)
 {
     return cgGetArraySize(param, dimension);
 }
Beispiel #24
0
 /// <summary>
 /// <para>cgSetParameterValuefc allows the application to set the value of any numeric param or param array.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program. CG_INVALID_POINTER_ERROR is generated if v is NULL. CG_NOT_ENOUGH_DATA_ERROR is generated if nelements is less than the total size of param. CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.</para>
 /// <para>VERSION: cgSetParameterValuefc was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="param">The program param whose value will be set.</param>
 /// <param name="nelements">The number of elements in array v.</param>
 /// <param name="v">Source buffer from which the param values will be read.</param>
 public static void SetParameterValuefc(CgParameter param, int nelements, float[] v)
 {
     cgSetParameterValuefc(param, nelements, v);
 }
Beispiel #25
0
 /// <summary>
 /// <para>cgGetArrayType returns the type of the members of an array.</para>
 /// <para>If the given array is multi-dimensional, it will return the type of the members of the inner most array.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_ARRAY_PARAM_ERROR is generated if param is not an array param.</para>
 /// <para>VERSION: cgGetArrayType was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The array param handle.</param>
 /// <returns>Returns the the type of the inner most array. Returns CG_UNKNOWN_TYPE if an error occurs.</returns>
 public static CgType GetArrayType(CgParameter param)
 {
     return cgGetArrayType(param);
 }
Beispiel #26
0
 /// <summary>
 /// <para>cgSetParameterValueir allows the application to set the value of any numeric param or param array.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program. CG_INVALID_POINTER_ERROR is generated if v is NULL. CG_NOT_ENOUGH_DATA_ERROR is generated if nelements is less than the total size of param. CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.</para>
 /// <para>VERSION: cgSetParameterValueir was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="param">The program param whose value will be set.</param>
 /// <param name="nelements">The number of elements in array v.</param>
 /// <param name="v">Source buffer from which the param values will be read.</param>
 public static void SetParameterValueir(CgParameter param, int nelements, int[] v)
 {
     cgSetParameterValueir(param, nelements, v);
 }
Beispiel #27
0
 /// <summary>
 /// <para>cgSetParameterVariability allows the  application to change the variability of a param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_ENUMERANT_ERROR is generated if vary is not CG_UNIFORM, CG_LITERAL, or CG_DEFAULT. CG_INVALID_PARAMETER_VARIABILITY_ERROR is generated if the param could not be changed to the variability indicated by vary. CG_INVALID_PARAMETER_TYPE_ERROR is generated if vary is CG_LITERAL and param is a not a numeric param.</para>
 /// <para>VERSION: cgSetParameterVariability was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The parameter.</param>
 /// <param name="vary">The variability to which param will be set.</param>
 public static void SetParameterVariability(CgParameter param, CgEnum vary)
 {
     cgSetParameterVariability(param, vary);
 }
Beispiel #28
0
 /// <summary>
 /// <para>cgSetSamplerState sets the sampler state for a sampler param that was specified via a sampler_state block in a CgFX file.</para>
 /// <para>The corresponding sampler should be bound via the graphics API before this call is made.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param.</para>
 /// <para>VERSION: cgSetSamplerState was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="param">The param handle.</param>
 public static void SetSamplerState(CgParameter param)
 {
     cgSetSamplerState(param);
 }
Beispiel #29
0
        protected override void OnLoad(EventArgs e)
        {
            context = Cg.CreateContext();

            Cg.SetErrorCallback(errorDelegate);

            cgVertexProfile = CgGL.GetLatestProfile(CgGLEnum.Vertex);
            string[] vArgs = CgGL.GetOptimalOptions(cgVertexProfile);

            if (cgVertexProfile != CgProfile.Unknown)
            {
                if (CgGL.IsProfileSupported(cgVertexProfile))
                {
                    CgGL.SetOptimalOptions(cgVertexProfile);
                }
            }

            cgVertexProgram = Cg.CreateProgramFromFile(
               context,                  // Cg runtime context
               CgEnum.Source,            // Program in human-readable form
               VertexProgramFileName,    // Name of file containing program
               cgVertexProfile,          // Profile: OpenGL ARB vertex program
               CgVertexEntryFuncName,    // Entry function name
               vArgs);                   // Extra compiler options

            CgGL.LoadProgram(cgVertexProgram);

            vertexParamTwisting = Cg.GetNamedParameter(cgVertexProgram, "twisting");

            cgFragmentProfile = CgGL.GetLatestProfile(CgGLEnum.Fragment);
            string[] fArgs = CgGL.GetOptimalOptions(cgVertexProfile);

            if (cgFragmentProfile != CgProfile.Unknown)
            {
                if (CgGL.IsProfileSupported(cgFragmentProfile))
                {
                    CgGL.SetOptimalOptions(cgFragmentProfile);
                }
            }

            cgFragmentProgram = Cg.CreateProgramFromFile(
               context,                   // Cg runtime context */
               CgEnum.Source,             // Program in human-readable form */
               FragmentProgramFileName,   // Name of file containing program */
               cgFragmentProfile,         // Profile: OpenGL ARB vertex program */
               CgFragmentEntryFuncName,   // Entry function name */
               fArgs);                    // Extra compiler options */

            CgGL.LoadProgram(cgFragmentProgram);
        }
Beispiel #30
0
 /// <summary>
 /// <para>cgSetParameter3d sets the value of a given scalar or vector param.</para>
 /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.</para>
 /// <para>VERSION: cgSetParameter3d was introduced in Cg 1.2.</para>
 /// </summary>
 /// <param name="param">The param that will be set.</param>
 /// <param name="x, y, z">The values used to set param.</param>
 public static void SetParameter3d(CgParameter param, double x, double y, double z)
 {
     cgSetParameter3d(param, x, y, z);
 }