Rename Context.TextureID -> ToTexture

This commit is contained in:
Hajime Hoshi 2013-10-18 00:45:12 +09:00
parent cb25b6a9e4
commit e2509e3439
8 changed files with 24 additions and 25 deletions

View File

@ -91,12 +91,12 @@ func (game *Rects) Draw(g graphics.Context) {
g.Fill(0, 0, 0)
game.offscreenInited = true
}
g.DrawTexture(g.TextureID(game.rectTextureID),
g.DrawTexture(g.ToTexture(game.rectTextureID),
game.rectGeometryMatrix(),
game.rectColorMatrix())
g.ResetOffscreen()
g.DrawTexture(g.TextureID(game.offscreenID),
g.DrawTexture(g.ToTexture(game.offscreenID),
matrix.IdentityGeometry(),
matrix.IdentityColor())
}

View File

@ -19,19 +19,19 @@ type TexturePart struct {
}
type Context interface {
TextureID(renderTargetID RenderTargetID) TextureID
ToTexture(renderTargetID RenderTargetID) TextureID
Clear()
Fill(r, g, b uint8)
DrawTexture(textureID TextureID,
DrawTexture(id TextureID,
geometryMatrix matrix.Geometry,
colorMatrix matrix.Color)
DrawTextureParts(textureID TextureID,
DrawTextureParts(id TextureID,
parts []TexturePart,
geometryMatrix matrix.Geometry,
colorMatrix matrix.Color)
ResetOffscreen()
SetOffscreen(renderTargetID RenderTargetID)
SetOffscreen(id RenderTargetID)
}
type TextureFactory interface {

View File

@ -52,7 +52,7 @@ func (context *Context) Init() {
context.screen = context.textures[C.GLuint(screenID)]
}
func (context *Context) TextureID(renderTargetID graphics.RenderTargetID) graphics.TextureID {
func (context *Context) ToTexture(renderTargetID graphics.RenderTargetID) graphics.TextureID {
return graphics.TextureID(renderTargetID)
}
@ -172,7 +172,7 @@ func (context *Context) setOffscreen(renderTarget *Texture) {
C.GLsizei(abs(renderTarget.textureHeight)))
}
func (context *Context) resetOffscreen() {
func (context *Context) setMainFramebufferOffscreen() {
context.setOffscreen(context.mainFramebufferTexture)
}
@ -273,7 +273,7 @@ func (context *Context) NewRenderTarget(width, height int) graphics.RenderTarget
context.setOffscreen((*Texture)(renderTarget))
context.Clear()
context.resetOffscreen()
context.setMainFramebufferOffscreen()
return graphics.RenderTargetID(renderTarget.id)
}

View File

@ -43,8 +43,7 @@ func (device *Device) Update(draw func(graphics.Context)) {
C.glTexParameteri(C.GL_TEXTURE_2D, C.GL_TEXTURE_MIN_FILTER, C.GL_LINEAR)
C.glTexParameteri(C.GL_TEXTURE_2D, C.GL_TEXTURE_MAG_FILTER, C.GL_LINEAR)
// TODO: The name is not good.
context.resetOffscreen()
context.setMainFramebufferOffscreen()
context.Clear()
scale := float64(context.screenScale)