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() {
C.glClearColor(0, 0, 0, 1)
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) {
@ -196,11 +191,6 @@ func (context *GraphicsContext) SetOffscreen(textureID graphics.TextureID) {
}
context.setOffscreenFramebuffer(framebuffer,
texture.textureWidth, texture.textureHeight)
if texture.isDirty {
context.Clear()
texture.isDirty = false
}
}
func (context *GraphicsContext) setOffscreenFramebuffer(framebuffer C.GLuint,
@ -353,6 +343,11 @@ func (context *GraphicsContext) NewTexture(width, height int) graphics.Texture {
texture := newTexture(width, height)
id := graphics.TextureID(texture.id)
context.textures[id] = texture
context.SetOffscreen(id)
context.Clear()
context.resetOffscreen()
return graphics.Texture{
ID: id,
Width: texture.width,

View File

@ -26,7 +26,6 @@ type Texture struct {
height int
textureWidth int
textureHeight int
isDirty bool
}
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)
texture.id = textureID
texture.isDirty = pixels == nil
return texture
}