NAME
    cgCreateObjFromFile - create a cg object type from a shader file

SYNOPSIS
      #include <Cg/cg.h>

      CGobj cgCreateObjFromFile( CGcontext context,
                                 CGenum program_type,
                                 const char * source_file,
                                 CGprofile profile,
                                 const char ** args );

PARAMETERS
    context The context to which the new object will be added.

    program_type
            An enumerant describing the contents of the source string. The
            following enumerants are allowed:

            CG_SOURCE
                source contains Cg source code.

            CG_OBJECT
                source contains object code that resulted from the
                precompilation of some Cg source code.

    source_file
            Name of a file containing source or object code. See
            program_type for more information.

    profile The profile enumerant for the program.

    args    If args is not NULL it is assumed to be an array of
            NULL-terminated strings that will be passed directly to the
            compiler as arguments. The last value of the array must be a
            NULL.

RETURN VALUES
    Returns a CGobj handle on success.

    Returns NULL if an error occurs.

DESCRIPTION
    cgCreateObjFromFile creates a new CGobj which is a source code object
    similar to a .obj or .o in C/C++ programming where various forms of data
    can be extracted. This can be used, for example, to create user defined
    data types from a Cg source string.

EXAMPLES
     // To create a Cg obj:

     CGcontext ctx = cgCreateContext();
     CGobj structObj = cgCreateObjFromFile(ctx, CG_SOURCE, source_file,
                                           CG_PROFILE_ARBVP1, NULL); 
        
     // Now we can get the CGtype:

     CGtype userDefinedMyType = cgGetNamedUserType(structObj, "MyType"); 

     // We could also iterate through all the types in the CGobj printing
     // their names like this:

     int numTypes = cgGetNumUserTypes(structObj);
     for (int i=0; i<numTypes; i++) {
        cout << cgGetTypeString(cgGetUserType(structObj, i)) << endl;
     } 

ERRORS
    CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid
    context.

    CG_INVALID_ENUMERANT_ERROR is generated if program_type is not CG_SOURCE
    or CG_OBJECT.

    CG_UNKNOWN_PROFILE_ERROR is generated if profile is not a supported
    profile.

    CG_COMPILER_ERROR is generated if compilation fails.

HISTORY
    cgCreateObjFromFile was introduced in Cg 2.0.

SEE ALSO
    cgCreateObj, cgDestroyObj

