mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +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() {
|
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,
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user