QuickstartΒΆ
Install the translator package in editable mode from the product repository:
pip install -e ../CrossGL-Translator
Translate a CrossGL shader from Python:
import crosstl
output = crosstl.translate("examples/graphics/SimpleShader.cgl", backend="metal")
print(output)
Or use the command-line interface:
python -m crosstl._crosstl examples/graphics/SimpleShader.cgl --backend metal
Supported targets are registered through crosstl.translator.codegen and can
be inspected at runtime:
import crosstl
print(crosstl.supported_backends())
print(crosstl.supported_sources())