mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
graphics: Better error messages for framebuffer creation
This commit is contained in:
parent
8d4ca8f8a9
commit
fb9f133389
@ -132,8 +132,15 @@ func (c *Context) NewFramebuffer(texture Texture) (Framebuffer, error) {
|
|||||||
gl.BindFramebuffer(gl.FRAMEBUFFER, f)
|
gl.BindFramebuffer(gl.FRAMEBUFFER, f)
|
||||||
|
|
||||||
gl.FramebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, uint32(texture), 0)
|
gl.FramebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, uint32(texture), 0)
|
||||||
if gl.CheckFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE {
|
s := gl.CheckFramebufferStatus(gl.FRAMEBUFFER)
|
||||||
return 0, errors.New("creating framebuffer failed")
|
if s != gl.FRAMEBUFFER_COMPLETE {
|
||||||
|
if s != 0 {
|
||||||
|
return 0, errors.New(fmt.Sprintf("creating framebuffer failed: %d", s))
|
||||||
|
}
|
||||||
|
if e := gl.GetError(); e != gl.NO_ERROR {
|
||||||
|
return 0, errors.New(fmt.Sprintf("creating framebuffer failed: (glGetError) %d", e))
|
||||||
|
}
|
||||||
|
return 0, errors.New(fmt.Sprintf("creating framebuffer failed: unknown error"))
|
||||||
}
|
}
|
||||||
|
|
||||||
return Framebuffer(f), nil
|
return Framebuffer(f), nil
|
||||||
|
@ -195,8 +195,9 @@ func (c *Context) NewFramebuffer(t Texture) (Framebuffer, error) {
|
|||||||
c.bindFramebuffer(Framebuffer{f})
|
c.bindFramebuffer(Framebuffer{f})
|
||||||
|
|
||||||
gl.FramebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, t.Object, 0)
|
gl.FramebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, t.Object, 0)
|
||||||
if gl.CheckFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE {
|
s := gl.CheckFramebufferStatus(gl.FRAMEBUFFER)
|
||||||
return Framebuffer{nil}, errors.New("creating framebuffer failed")
|
if s != gl.FRAMEBUFFER_COMPLETE {
|
||||||
|
return Framebuffer{nil}, errors.New(fmt.Sprintf("creating framebuffer failed: %d", s))
|
||||||
}
|
}
|
||||||
|
|
||||||
return Framebuffer{f}, nil
|
return Framebuffer{f}, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user