When loading an .ogsfx
shader instance via MShaderManager::getEffectsFileShader()
or MShaderManager::getEffectsBufferShader()
, the shader is not rendered in the viewport, and no error appears.
How can I obtain shader compile errors?
When loading .ogsfx
shaders, errors occur at bind time rather than at creation time when MShaderManager::getEffectsFileShader()
is called. Call MShaderInstance.bind()
to bind the shader instance to the draw context, then call MShaderManager::getLastError()
or MShaderManager::getLastErrorSource()
to report the effect compile errors.
Alternatively, you can set the following pragma in the shader so that errors occur at creation time:
#pragma FullCompileOnLoad:true;
You must then call MShaderManager::getLastError()
or MShaderManager::getLastErrorSource()
to report the effect compile errors.