shaderSource method

void shaderSource(
  1. int shader,
  2. String shaderSource
)

Replaces the source code in a shader object

  • shader Specifies the handle of the shader object whose source code is to be replaced.
  • shaderSource Specifies an array of pointers to strings containing the source code to be loaded into the shader.

Implementation

void shaderSource(int shader, String shaderSource) {
  var sourceString = shaderSource.toNativeUtf8();
  var arrayPointer = calloc<Pointer<Int8>>();
  arrayPointer.value = Pointer.fromAddress(sourceString.address);
  gl.glShaderSource(shader, 1, arrayPointer, nullptr);
  calloc.free(arrayPointer);
  calloc.free(sourceString);
}