From 15087ac542c4d96d6a4787b54ed5b68a6f2d8265 Mon Sep 17 00:00:00 2001 From: bloeys Date: Wed, 23 Feb 2022 07:35:49 +0400 Subject: [PATCH] Specify RGBA8 as internal opengl format --- assets/textures.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/textures.go b/assets/textures.go index c581a09..fed036d 100755 --- a/assets/textures.go +++ b/assets/textures.go @@ -48,6 +48,7 @@ func LoadPNGTexture(file string) (Texture, error) { Pixels: make([]byte, img.Bounds().Dx()*img.Bounds().Dy()*4), } + //NOTE: Load bottom left to top right because this is the texture coordinate system used by OpenGL //NOTE: We only support 8-bit channels (32-bit colors) for now i := 0 for y := img.Bounds().Dy() - 1; y >= 0; y-- { @@ -75,7 +76,7 @@ func LoadPNGTexture(file string) (Texture, error) { gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) // load and generate the texture - gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, tex.Width, tex.Height, 0, gl.RGBA, gl.UNSIGNED_BYTE, unsafe.Pointer(&tex.Pixels[0])) + gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, tex.Width, tex.Height, 0, gl.RGBA, gl.UNSIGNED_BYTE, unsafe.Pointer(&tex.Pixels[0])) gl.GenerateMipmap(gl.TEXTURE_2D) SetTexture(tex)