CreateCgShader

From OxeyeWiki

Jump to: navigation, search

video.createCgShader(vertexShaderName, fragmentShaderName[, baseMaterial[, vertexFileMain, fragmentFileMain]])

This method creates a shader material based on a vertex and fragment shader HLSL file.

Parameter Expected Type Description
vertexShaderName A string The filename of the vertex shader.
fragmentShaderName A string The filename of the fragment shader.
baseMaterial Optional integer Shaders use the transparent alpha channel material as default (material type 12). Set this integer to use a different base material.
vertexFileMain Optional string The name of the shader method in the vertex shader file. Defaults to "main".
fragmentFileMain Optional string The name of the shader method in the fragment shader file. Defaults to "main".
Returns

Returns the new material type ID, or -1 if the shader fails to load.

Daisymoon Video Lib


Example

local function createShaderMaterial()
   local vShader = "shaders/baseVertexCG.vsh"
   local pShader = "shaders/blackAndWhite.psh"
   local baseType = 12
   return video.createCgShader(vShader, pShader, baseType, "main", "main")
end

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox