stringProgramm method
Implementation
dynamic stringProgramm(String vertex, String fragment) {
final gl = Engine.flutterGlPlugin.gl;
final vertexShader = stringShader(gl.VERTEX_SHADER, vertex);
if (vertexShader == 0) {
if (kDebugMode) {
print('error vertex shader');
}
return 0;
}
final fragmentShader = stringShader(gl.FRAGMENT_SHADER, fragment);
if (fragmentShader == 0) {
gl.deleteShader(vertexShader);
if (kDebugMode) {
print('error fragment shader');
}
return 0;
}
// Create the program object
final programHandle = gl.createProgram();
if (programHandle == 0) {
if (kDebugMode) {
print('error creating programm');
}
return 0;
}
gl
..attachShader(programHandle, vertexShader)
..attachShader(programHandle, fragmentShader)
..linkProgram(programHandle);
if (kDebugMode) {
print('create program=$programHandle');
}
return programHandle;
}