Remove opengl.Texture.isDirty

This commit is contained in:
Hajime Hoshi 2013-06-23 02:23:45 +09:00
parent edceec9220
commit 420187b45b
2 changed files with 5 additions and 12 deletions

View File

@ -51,11 +51,6 @@ func newGraphicsContext(screenWidth, screenHeight, screenScale int) *GraphicsCon
func (context *GraphicsContext) Clear() { func (context *GraphicsContext) Clear() {
C.glClearColor(0, 0, 0, 1) C.glClearColor(0, 0, 0, 1)
C.glClear(C.GL_COLOR_BUFFER_BIT) C.glClear(C.GL_COLOR_BUFFER_BIT)
// ??
C.glDisableClientState(C.GL_TEXTURE_COORD_ARRAY)
C.glDisableClientState(C.GL_VERTEX_ARRAY)
C.glDisableClientState(C.GL_COLOR_ARRAY)
} }
func (context *GraphicsContext) Fill(clr color.Color) { func (context *GraphicsContext) Fill(clr color.Color) {
@ -196,11 +191,6 @@ func (context *GraphicsContext) SetOffscreen(textureID graphics.TextureID) {
} }
context.setOffscreenFramebuffer(framebuffer, context.setOffscreenFramebuffer(framebuffer,
texture.textureWidth, texture.textureHeight) texture.textureWidth, texture.textureHeight)
if texture.isDirty {
context.Clear()
texture.isDirty = false
}
} }
func (context *GraphicsContext) setOffscreenFramebuffer(framebuffer C.GLuint, func (context *GraphicsContext) setOffscreenFramebuffer(framebuffer C.GLuint,
@ -353,6 +343,11 @@ func (context *GraphicsContext) NewTexture(width, height int) graphics.Texture {
texture := newTexture(width, height) texture := newTexture(width, height)
id := graphics.TextureID(texture.id) id := graphics.TextureID(texture.id)
context.textures[id] = texture context.textures[id] = texture
context.SetOffscreen(id)
context.Clear()
context.resetOffscreen()
return graphics.Texture{ return graphics.Texture{
ID: id, ID: id,
Width: texture.width, Width: texture.width,

View File

@ -26,7 +26,6 @@ type Texture struct {
height int height int
textureWidth int textureWidth int
textureHeight int textureHeight int
isDirty bool
} }
func createTexture(width, height int, pixels []uint8) *Texture { func createTexture(width, height int, pixels []uint8) *Texture {
@ -69,7 +68,6 @@ func createTexture(width, height int, pixels []uint8) *Texture {
C.glBindTexture(C.GL_TEXTURE_2D, 0) C.glBindTexture(C.GL_TEXTURE_2D, 0)
texture.id = textureID texture.id = textureID
texture.isDirty = pixels == nil
return texture return texture
} }