The problem here is not the init method, but as the return type in compileVertexShader and compileShader, while one returns GLInt and the other returns GLuint. If you change them to match, your error should disappear.
class ShaderHelper{
class func compileVertexShader(ShaderCode: NSString) ->GLuint{
return compileShader(GLenum(GL_VERTEX_SHADER), shaderCode: ShaderCode)
}
class func compileShader(type: GLenum, shaderCode: NSString) -> GLuint{
var shaderObjectId = glCreateShader(type);
if(shaderObjectId == 0){
if(LoggerConfig.props.On){
println("Could not create new shader!")
}
return 0
}
var shaderStringUTF8 = shaderCode.cStringUsingEncoding(NSUTF8StringEncoding)
var shaderStringLength: GLint = GLint(Int32(shaderCode.length));
glShaderSource(shaderObjectId, 1, &shaderStringUTF8, &shaderStringLength)
glCompileShader(shaderObjectId)
var compileStatus = GLint()
glGetShaderiv(shaderObjectId, GLenum(GL_COMPILE_STATUS), &compileStatus)
if(compileStatus == 0){
if(LoggerConfig.props.On){
println("Compilation of shader failed.")
}
glDeleteShader(shaderObjectId)
return 0
}else if (compileStatus == 1){
if(LoggerConfig.props.On){
println("Compilation Successful")
}
}
return shaderObjectId;
}
. , .