mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Remove opengl.Texture.isDirty
This commit is contained in:
parent
edceec9220
commit
420187b45b
@ -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,
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user