Documentation ¶
Index ¶
- Constants
- type AttribLocation
- type Framebuffer
- func (fb *Framebuffer) Bind()
- func (fb *Framebuffer) Clear(c color.Color)
- func (fb *Framebuffer) Destroy()
- func (fb *Framebuffer) Draw(x, y, width, height int)
- func (fb *Framebuffer) GetHeight() int
- func (fb *Framebuffer) GetID() uint32
- func (fb *Framebuffer) GetTextureID() uint32
- func (fb *Framebuffer) GetWidth() int
- func (fb *Framebuffer) Resize(width, height int)
- func (fb *Framebuffer) Unbind()
- type FramebufferRenderer
- type GraphicsBackend
- type Renderer
- func (renderer *Renderer) AddFramebuffer(width, height int) (graphics.Framebuffer, error)
- func (renderer *Renderer) Begin()
- func (renderer *Renderer) BindFramebuffer(fb graphics.Framebuffer)
- func (renderer *Renderer) Clear(c color.Color)
- func (renderer *Renderer) Destroy()
- func (renderer *Renderer) Draw()
- func (renderer *Renderer) End()
- func (renderer *Renderer) GetViewportSize() (int, int)
- func (renderer *Renderer) Init()
- func (renderer *Renderer) LoadFont(fontData []byte) (graphics.Font, error)
- func (renderer *Renderer) Render(shape graphics.Renderable)
- func (renderer *Renderer) RenderFramebuffer(fb graphics.Framebuffer, options *graphics.TextureRenderOptions)
- func (renderer *Renderer) RenderText(text string, options *graphics.TextRenderOptions)
- func (renderer *Renderer) RenderTexture(textureID uint32, options *graphics.TextureRenderOptions)
- func (renderer *Renderer) UnbindFramebuffer()
- type TextureAtlas
- type TextureManager
- func (tm *TextureManager) GetManagerID(textureID uint32) (uint32, bool)
- func (tm *TextureManager) RegisterFramebufferTexture(textureID uint32, width, height int)
- func (tm *TextureManager) RegisterTexture(textureID uint32) uint32
- func (tm *TextureManager) UpdateTexture(textureID uint32, img image.Image, xOffset, yOffset int)
- func (tm *TextureManager) UploadTexture(img image.Image) uint32
Constants ¶
View Source
const ( AtlasWidth = 512 AtlasHeight = 512 MaxTextures = 100 MaxVertices = 600000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttribLocation ¶
type AttribLocation uint32
const ( ATTRIB_POS_LOCATION AttribLocation = 0 ATTRIB_SHAPE_POS_LOCATION AttribLocation = 1 ATTRIB_LOCAL_POS_LOCATION AttribLocation = 2 ATTRIB_OPCODE_LOCATION AttribLocation = 3 ATTRIB_RADIUS_LOCATION AttribLocation = 4 ATTRIB_COLOR_LOCATION AttribLocation = 5 ATTRIB_WIDTH_LOCATION AttribLocation = 6 ATTRIB_HEIGHT_LOCATION AttribLocation = 7 ATTRIB_TEX_COORD_LOCATION AttribLocation = 8 ATTRIB_RESOLUTION_LOCATION AttribLocation = 9 ATTRIB_TEXTURE_INDEX_LOCATION AttribLocation = 10 ATTRIB_FONT_INDEX_LOCATION AttribLocation = 11 )
type Framebuffer ¶
type Framebuffer struct { ID uint32 TextureID uint32 RenderID uint32 Width int Height int ClearColor [4]float32 // contains filtered or unexported fields }
func NewFramebuffer ¶
func NewFramebuffer(width, height int, textureManager *TextureManager, mainRenderer *Renderer) (*Framebuffer, error)
func (*Framebuffer) Bind ¶
func (fb *Framebuffer) Bind()
func (*Framebuffer) Clear ¶
func (fb *Framebuffer) Clear(c color.Color)
func (*Framebuffer) Destroy ¶
func (fb *Framebuffer) Destroy()
func (*Framebuffer) Draw ¶
func (fb *Framebuffer) Draw(x, y, width, height int)
func (*Framebuffer) GetHeight ¶
func (fb *Framebuffer) GetHeight() int
func (*Framebuffer) GetID ¶
func (fb *Framebuffer) GetID() uint32
func (*Framebuffer) GetTextureID ¶
func (fb *Framebuffer) GetTextureID() uint32
func (*Framebuffer) GetWidth ¶
func (fb *Framebuffer) GetWidth() int
func (*Framebuffer) Resize ¶
func (fb *Framebuffer) Resize(width, height int)
func (*Framebuffer) Unbind ¶
func (fb *Framebuffer) Unbind()
type FramebufferRenderer ¶
type FramebufferRenderer struct { *Renderer // contains filtered or unexported fields }
func NewFramebufferRenderer ¶
func NewFramebufferRenderer(renderer *Renderer, framebuffer *Framebuffer) (*FramebufferRenderer, error)
func (*FramebufferRenderer) Bind ¶
func (fr *FramebufferRenderer) Bind()
func (*FramebufferRenderer) Clear ¶
func (fr *FramebufferRenderer) Clear(c color.Color)
func (*FramebufferRenderer) Draw ¶
func (fr *FramebufferRenderer) Draw(x, y, width, height int)
func (*FramebufferRenderer) Unbind ¶
func (fr *FramebufferRenderer) Unbind()
type GraphicsBackend ¶
func NewGraphicsBackend ¶
func NewGraphicsBackend(width, height int) (*GraphicsBackend, error)
func (*GraphicsBackend) Close ¶
func (backend *GraphicsBackend) Close()
func (*GraphicsBackend) PollEvents ¶
func (backend *GraphicsBackend) PollEvents() bool
type Renderer ¶
type Renderer struct { Vertices []graphics.Vertex Framebuffers []*Framebuffer VertexCount int Textures []TextureAtlas TextureCount int VAO uint32 VBO uint32 BufferCapacity int ShaderProgram uint32 Font *font.Font FontTextureID uint32 *TextureManager }
func NewRenderer ¶
func NewRenderer() *Renderer
func (*Renderer) AddFramebuffer ¶
func (renderer *Renderer) AddFramebuffer(width, height int) (graphics.Framebuffer, error)
func (*Renderer) BindFramebuffer ¶
func (renderer *Renderer) BindFramebuffer(fb graphics.Framebuffer)
func (*Renderer) GetViewportSize ¶
func (*Renderer) Render ¶
func (renderer *Renderer) Render(shape graphics.Renderable)
func (*Renderer) RenderFramebuffer ¶
func (renderer *Renderer) RenderFramebuffer(fb graphics.Framebuffer, options *graphics.TextureRenderOptions)
func (*Renderer) RenderText ¶
func (renderer *Renderer) RenderText(text string, options *graphics.TextRenderOptions)
func (*Renderer) RenderTexture ¶
func (renderer *Renderer) RenderTexture(textureID uint32, options *graphics.TextureRenderOptions)
func (*Renderer) UnbindFramebuffer ¶
func (renderer *Renderer) UnbindFramebuffer()
type TextureManager ¶
type TextureManager struct {
// contains filtered or unexported fields
}
func NewTextureManager ¶
func NewTextureManager(renderer *Renderer) *TextureManager
func (*TextureManager) GetManagerID ¶
func (tm *TextureManager) GetManagerID(textureID uint32) (uint32, bool)
func (*TextureManager) RegisterFramebufferTexture ¶
func (tm *TextureManager) RegisterFramebufferTexture(textureID uint32, width, height int)
func (*TextureManager) RegisterTexture ¶
func (tm *TextureManager) RegisterTexture(textureID uint32) uint32
func (*TextureManager) UpdateTexture ¶
func (tm *TextureManager) UpdateTexture(textureID uint32, img image.Image, xOffset, yOffset int)
func (*TextureManager) UploadTexture ¶
func (tm *TextureManager) UploadTexture(img image.Image) uint32
Click to show internal directories.
Click to hide internal directories.