glesv2 :: GLShader :: defaultinit
# Abstract OpenGL ES shader object, implemented by `GLFragmentShader` and `GLVertexShader`
extern class GLShader `{GLuint`}
# Source of the shader, if available
#
# Returns `null` if the source is not available, usually when the shader
# was created from a binary file.
fun source: nullable String
do
var size = glGetShaderiv(self, gl_SHADER_SOURCE_LENGTH)
if size == 0 then return null
return source_native(size).to_s
end
private fun source_native(size: Int): CString `{
GLchar *code = malloc(size);
glGetShaderSource(self, size, NULL, code);
return code;
`}
# Has this shader been compiled?
fun is_compiled: Bool do return glGetShaderiv(self, gl_COMPILE_STATUS) != 0
# Has this shader been deleted?
fun is_deleted: Bool do return glGetShaderiv(self, gl_DELETE_STATUS) != 0
end
lib/glesv2/glesv2.nit:227,1--252,3