Defining Software Shader Local Entry Points

To inform HOOPS Luminate that a custom software shading callback is located in the program executable file itself, just do:

RED::RenderShader shader;
RED::ShaderProgramID sshid;
RED::ShaderString ssh;
RED::Version version;

// Define the software shader callback entry point as local.
RC_TEST( ssh.SoftShaderStart( "", "SoftwareShader", version ) );
ssh.ShaderEnd();

// Load the software shader.
RC_TEST( iresmgr->LoadShaderFromString( sshid, ssh ) );

// Create the render code to bind vertex position data.
RED::RenderCode rcode;
rcode.BindChannel( RED_VSH_VERTEX, RED::MCL_VERTEX );

// Setup the shader.
RC_TEST( shader.SetRenderCode( rcode, RED_L0, RED::HW_SOFT_TRACER ) );
RC_TEST( shader.SetVertexProgramId( sshid, RED_L0, resmgr, RED::HW_SOFT_TRACER ) );
RC_TEST( shader.SetPixelProgramId( sshid, RED_L0, resmgr, RED::HW_SOFT_TRACER ) );

// Register the shading callback to the resource manager.
RC_TEST( iresmgr->RegisterShadingCallback( "SoftwareShader", SoftwareShader, NULL ) );

The ‘SoftwareShader’ method must be defined elsewhere in the same executable file otherwise the engine will return with an error code during the rendering of the shader.

Note

You can also go the way described in Defining Software Shader DLL Entry Points and set the shader file to be the program executable itself instead of a DLL.