CreateCgShader
From OxeyeWiki
(Difference between revisions)
Jeb (Talk | contribs)
(Created page with '{{VideoMethod| video.createCgShader(vertexShaderName, fragmentShaderName[, baseMaterial[, vertexFileMain, fragmentFileMain]]) | This method creates a shader material based on a v...')
(Created page with '{{VideoMethod| video.createCgShader(vertexShaderName, fragmentShaderName[, baseMaterial[, vertexFileMain, fragmentFileMain]]) | This method creates a shader material based on a v...')
Latest revision as of 20:21, 2 January 2010
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. |
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