diff --git a/internal/graphicscommand/image.go b/internal/graphicscommand/image.go index fb5e29416..0baaa512b 100644 --- a/internal/graphicscommand/image.go +++ b/internal/graphicscommand/image.go @@ -43,7 +43,7 @@ func MaxImageSize() int { // Image represents an image that is implemented with OpenGL. type Image struct { texture opengl.Texture - framebuffer *opengl.FramebufferStruct + framebuffer *opengl.Framebuffer width int height int } @@ -121,7 +121,7 @@ func (i *Image) IsInvalidated() bool { return !opengl.GetContext().IsTexture(i.texture) } -func (i *Image) ensureFramebuffer() (*opengl.FramebufferStruct, error) { +func (i *Image) ensureFramebuffer() (*opengl.Framebuffer, error) { if i.framebuffer != nil { return i.framebuffer, nil } diff --git a/internal/opengl/context.go b/internal/opengl/context.go index 23403c56c..7afb3c2f0 100644 --- a/internal/opengl/context.go +++ b/internal/opengl/context.go @@ -96,7 +96,7 @@ func (c *Context) bindFramebuffer(f framebufferNative) { c.lastFramebuffer = f } -func (c *Context) SetViewport(f *FramebufferStruct) { +func (c *Context) SetViewport(f *Framebuffer) { c.bindFramebuffer(f.native) if c.lastViewportWidth != f.width || c.lastViewportHeight != f.height { c.setViewportImpl(f.width, f.height) diff --git a/internal/opengl/context_desktop.go b/internal/opengl/context_desktop.go index 41ff674ee..a18aa82fe 100644 --- a/internal/opengl/context_desktop.go +++ b/internal/opengl/context_desktop.go @@ -169,7 +169,7 @@ func (c *Context) bindFramebufferImpl(f framebufferNative) { }) } -func (c *Context) FramebufferPixels(f *FramebufferStruct, width, height int) ([]byte, error) { +func (c *Context) FramebufferPixels(f *Framebuffer, width, height int) ([]byte, error) { var pixels []byte _ = c.runOnContextThread(func() error { gl.Flush() diff --git a/internal/opengl/context_js.go b/internal/opengl/context_js.go index 3bc1cd396..392f6923b 100644 --- a/internal/opengl/context_js.go +++ b/internal/opengl/context_js.go @@ -204,7 +204,7 @@ func (c *Context) bindFramebufferImpl(f framebufferNative) { gl.Call("bindFramebuffer", framebuffer, js.Value(f)) } -func (c *Context) FramebufferPixels(f *FramebufferStruct, width, height int) ([]byte, error) { +func (c *Context) FramebufferPixels(f *Framebuffer, width, height int) ([]byte, error) { gl := c.gl c.bindFramebuffer(f.native) diff --git a/internal/opengl/context_mobile.go b/internal/opengl/context_mobile.go index 9e0e21922..1c50ed421 100644 --- a/internal/opengl/context_mobile.go +++ b/internal/opengl/context_mobile.go @@ -156,7 +156,7 @@ func (c *Context) bindFramebufferImpl(f framebufferNative) { gl.BindFramebuffer(mgl.FRAMEBUFFER, mgl.Framebuffer(f)) } -func (c *Context) FramebufferPixels(f *FramebufferStruct, width, height int) ([]byte, error) { +func (c *Context) FramebufferPixels(f *Framebuffer, width, height int) ([]byte, error) { gl := c.gl gl.Flush() diff --git a/internal/opengl/framebuffer.go b/internal/opengl/framebuffer.go index b855ff358..e4dd06670 100644 --- a/internal/opengl/framebuffer.go +++ b/internal/opengl/framebuffer.go @@ -14,10 +14,10 @@ package opengl -// FramebufferStruct is a wrapper of OpenGL's framebuffer. +// Framebuffer is a wrapper of OpenGL's framebuffer. // // TODO: Create a new struct Image and embed this struct. -type FramebufferStruct struct { +type Framebuffer struct { native framebufferNative proMatrix []float32 width int @@ -25,12 +25,12 @@ type FramebufferStruct struct { } // NewFramebufferFromTexture creates a framebuffer from the given texture. -func NewFramebufferFromTexture(texture Texture, width, height int) (*FramebufferStruct, error) { +func NewFramebufferFromTexture(texture Texture, width, height int) (*Framebuffer, error) { native, err := theContext.newFramebuffer(texture) if err != nil { return nil, err } - return &FramebufferStruct{ + return &Framebuffer{ native: native, width: width, height: height, @@ -38,8 +38,8 @@ func NewFramebufferFromTexture(texture Texture, width, height int) (*Framebuffer } // NewScreenFramebuffer creates a framebuffer for the screen. -func NewScreenFramebuffer(width, height int) *FramebufferStruct { - return &FramebufferStruct{ +func NewScreenFramebuffer(width, height int) *Framebuffer { + return &Framebuffer{ native: theContext.getScreenFramebuffer(), width: width, height: height, @@ -51,7 +51,7 @@ func NewScreenFramebuffer(width, height int) *FramebufferStruct { // A projection matrix converts the coodinates on the framebuffer // (0, 0) - (viewport width, viewport height) // to the normalized device coodinates (-1, -1) - (1, 1) with adjustment. -func (f *FramebufferStruct) ProjectionMatrix() []float32 { +func (f *Framebuffer) ProjectionMatrix() []float32 { if f.proMatrix != nil { return f.proMatrix } @@ -59,7 +59,7 @@ func (f *FramebufferStruct) ProjectionMatrix() []float32 { return f.proMatrix } -func (f *FramebufferStruct) Delete() { +func (f *Framebuffer) Delete() { if f.native != theContext.getScreenFramebuffer() { theContext.deleteFramebuffer(f.native) }