In the first function I do not understand what I'm doing wrong. This is an error in the line, return compileShader (GLenum (GL_VERTEX_SHADER), ShaderCode) error can not be called 'init with an argument list is'' ($ t3, NSString) '
class ShaderHelper {class function compileVertexShader (ShaderCode: NSString) - & gt; Brightness {return compileShader (GLenum (GL_VERTEX_SHADER), ShaderCode}} class function compileShader (type: GLenum, shaderCode: NSString) - & gt; Glume {var shaderObjectId = glCreateShader (type); If (shaderObjectId == 0) {if (LoggerConfig.props.On) {println} return 0 ( "Could not create new shader!")} Var shaderStringUTF8 = shaderCode.cStringUsingEncoding (NSUTF8StringEncoding) var shaderStringLength: brightness = brightness (Int32 ( ShaderCode.length)); GlShaderSource (shaderObjectId, 1, and shaderStringUTF8, and shaderStringLength) glCompileShader (shaderObjectId) var compileStatus = GLint () glGetShaderiv (shaderObjectId, GLenum (GL_COMPILE_STATUS), and compile status) (compileStatus == 0) {if (LoggerConfig.props .On) {println (failed compilation of "shader.")} glDeleteShader (shaderObjectId) return 0} else if (compileStatus == 1) {if (LoggerConfig.props.On) {println ( "compilation successful")}} return shaderObjectId ; }
The problem is not in compileVertexShader here but with the return of init method and CompileShader , While a GLInt returns and other returns are gluint. If you change those to match, then your error should be gone The error is not very fast while debugging. You should carefully choose the type of parameter and return type and it should be fine.
class ShaderHelper {class function compileVertexShader (ShaderCode: NSString) - & gt; GLuint {return compileShader (GLenum (GL_VERTEX_SHADER), shaderCode: ShaderCode)} class function compileShader (type: GLenum, shaderCode: NSString) - & gt; Glume {var shaderObjectId = glCreateShader (type); If (shaderObjectId == 0) {if (LoggerConfig.props.On) {println} return 0 ( "Could not create new shader!")} Var shaderStringUTF8 = shaderCode.cStringUsingEncoding (NSUTF8StringEncoding) var shaderStringLength: brightness = brightness (Int32 ( ShaderCode.length)); GlShaderSource (shaderObjectId, 1, and shaderStringUTF8, and shaderStringLength) glCompileShader (shaderObjectId) var compileStatus = GLint () glGetShaderiv (shaderObjectId, GLenum (GL_COMPILE_STATUS), and compile status) (compileStatus == 0) {if (LoggerConfig.props .On) {Println ("The compiler of the shader is unsuccessful."}} GlDeleteShader (shaderObjectId) Return 0} else if (LoggerConfig.props.on) {println ("compile successful")}} Return shaderObjectId ; }
Comments
Post a Comment