Cg Direct3D10 Runtime API cgD3D10BindProgram(3)
NAME
cgD3D10000BindProgram - activate a program with D3D
SYNOPSIS
#include
HRESULT cgD3D10BindProgram( 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
cgD3D10000BindProgram activates a program with D3D. The program
is activated using ID3D10000Device::::::::SetVertexShader or
ID3D10000Device::::::::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.
EXAMPLES
/ vertexProg and pixelProg are CGprograms initialized elsewhere
/ pDev is an ID3D10Device interface intialized elsewhere
...
HRESULT hr = cgD3D10BindProgram(vertexProg);
HRESULT hr2 = cgD3D10BindProgram(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
cgD3D10000Failed is generated if a D3D function returns an
error.
CGD3D10000ERNOTLOADED is returned if program was not loaded
with the cgD3D10LoadProgram.
CGD3D10000ERNODEVICE 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
cgD3D10SetDevice.
Cg Toolkit 2.1 Last change: 1
Cg Direct3D10 Runtime API cgD3D10BindProgram(3)
HISTORY
cgD3D10000BindProgram was introduced in Cg 2.1.
SEE ALSO
cgD3D10LoadProgram, cgD3D10SetTextureParameter
Cg Toolkit 2.1 Last change: 2
|