opengl: Update error messages

This commit is contained in:
Hajime Hoshi 2016-11-26 00:57:02 +09:00
parent 443c58104b
commit 3e2f2e9f08
3 changed files with 4 additions and 4 deletions

View File

@ -316,7 +316,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error
if err := c.runOnContextThread(func() error {
s := gl.CreateShader(uint32(shaderType))
if s == 0 {
return errors.New("opengl: glCreateShader failed")
return fmt.Errorf("opengl: glCreateShader failed: shader type: %d", shaderType)
}
cSources, free := gl.Strs(source + "\x00")
gl.ShaderSource(uint32(s), 1, cSources, nil)

View File

@ -268,7 +268,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error
gl := c.gl
s := gl.CreateShader(int(shaderType))
if s == nil {
return Shader{nil}, errors.New("opengl: glCreateShader failed")
return Shader{nil}, fmt.Errorf("opengl: glCreateShader failed: shader type: %d", shaderType)
}
gl.ShaderSource(s, source)
@ -276,7 +276,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error
if !gl.GetShaderParameterb(s, gl.COMPILE_STATUS) {
log := gl.GetShaderInfoLog(s)
return Shader{nil}, errors.New(fmt.Sprintf("opengl: shader compile failed: %s", log))
return Shader{nil}, fmt.Errorf("opengl: shader compile failed: %s", log)
}
return Shader{s}, nil
}

View File

@ -244,7 +244,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error
gl := c.gl
s := gl.CreateShader(mgl.Enum(shaderType))
if s.Value == 0 {
return Shader{}, errors.New("opengl: glCreateShader failed")
return Shader{}, fmt.Errorf("opengl: glCreateShader failed: shader type: %d", shaderType)
}
gl.ShaderSource(s, source)
gl.CompileShader(s)