MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Cg Direct3D9 Runtime API                     cgD3D9BindProgram(3)



NAME
     cgD3D9BindProgram - activate a program with D3D

SYNOPSIS
       #include 

       HRESULT cgD3D9BindProgram( CGprogram program );


PARAMETERS
     program The program to activate with D3D.

RETURN VALUES
     Returns D3DOK if the function succeeds.

     Returns the D3D failure code if the function fails due to a
     D3D call.

DESCRIPTION
     cgD3D9BindProgram activates a program with D3D. The program
     is activated using IDirect3Device9::::::::SetVertexShader or
     IDirect3Device9::::::::SetPixelShader depending on the program's
     profile type.

     D3D allows only one vertex shader and one pixel shader to be
     active at any given time, so activating a program of a given
     type implicitly deactivates any other program of a that
     type.

     If parameter shadowing is enabled for program, this call
     will set the D3D state for all shadowed parameters
     associated with program. If a parameter associated with
     program has not been shadowed when this function is called,
     the D3D state associated with that parameter is not
     modified.

     If parameter shadowing is disabled, only the D3D shader is
     activated, and no other D3D state is modified.

EXAMPLES
       / vertexProg and pixelProg are CGprograms initialized elsewhere
       / pDev is an IDirect3Device9 interface intialized elsewhere
       ...
       HRESULT hr = cgD3D9BindProgram(vertexProg);
       HRESULT hr2 = cgD3D9BindProgram(pixelProg);
       / Draw a quad using the vertex and pixel shader
       / A vertex and index buffer are set up elsewhere.
       HRESULT hr3 = pDev->DrawIndexedPrimitve(D3DPTRIANGLELIST, 0, 4, 0, 2);


ERORS
     cgD3D9Failed is generated if a D3D function returns an



Cg Toolkit 2.1            Last change:                          1






Cg Direct3D9 Runtime API                     cgD3D9BindProgram(3)



     error.

     CGD3D9ERNOTLOADED is returned if program was not loaded
     with the cgD3D9LoadProgram.

     CGD3D9ERNODEVICE is returned if a required D3D device is
     NUL.  This usually occurs when an expanded interface
     routine is called but a D3D device has not been set with
     cgD3D9SetDevice.

HISTORY
     cgD3D9BindProgram was introduced in Cg 1.1.

SEE ALSO
     cgD3D9LoadProgram, cgD3D9EnableParameterShadowing,
     cgD3D9IsParameterShadowingEnabled, cgD3D9SetUniform,
     cgD3D9SetUniformMatrix, cgD3D9SetTextureParameter






































Cg Toolkit 2.1            Last change:                          2



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™