mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphicsdriver/opengl: Use GL_RGBA8 as the internal format at glTexImage2D
Related: #810
This commit is contained in:
parent
815f2a6b35
commit
f5044f3d8f
@ -145,7 +145,7 @@ func (c *context) newTexture(width, height int) (textureNative, error) {
|
||||
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
|
||||
// If data is nil, this just allocates memory and the content is undefined.
|
||||
// https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml
|
||||
gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, int32(width), int32(height), 0, gl.RGBA, gl.UNSIGNED_BYTE, nil)
|
||||
gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, int32(width), int32(height), 0, gl.RGBA, gl.UNSIGNED_BYTE, nil)
|
||||
return nil
|
||||
})
|
||||
return texture, nil
|
||||
|
@ -172,6 +172,8 @@ func (c *context) newTexture(width, height int) (textureNative, error) {
|
||||
// In Ebiten, textures are filled with pixels laster by the filter that ignores destination, so it is fine
|
||||
// to leave textures as uninitialized here. Rather, extra memory allocating for initialization should be
|
||||
// avoided.
|
||||
|
||||
// gl.RGBA8 is available as of WebGL 2.
|
||||
gl.Call("texImage2D", texture2d, 0, rgba, width, height, 0, rgba, unsignedByte, nil)
|
||||
|
||||
return textureNative(t), nil
|
||||
|
@ -130,7 +130,7 @@ func (c *context) newTexture(width, height int) (textureNative, error) {
|
||||
gl.TexParameteri(mgl.TEXTURE_2D, mgl.TEXTURE_MIN_FILTER, mgl.NEAREST)
|
||||
gl.TexParameteri(mgl.TEXTURE_2D, mgl.TEXTURE_WRAP_S, mgl.CLAMP_TO_EDGE)
|
||||
gl.TexParameteri(mgl.TEXTURE_2D, mgl.TEXTURE_WRAP_T, mgl.CLAMP_TO_EDGE)
|
||||
gl.TexImage2D(mgl.TEXTURE_2D, 0, mgl.RGBA, width, height, mgl.RGBA, mgl.UNSIGNED_BYTE, nil)
|
||||
gl.TexImage2D(mgl.TEXTURE_2D, 0, mgl.RGBA8, width, height, mgl.RGBA, mgl.UNSIGNED_BYTE, nil)
|
||||
|
||||
return textureNative(t), nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user