ITADN

TextureData.Pixels() and PixelsAt() lead to possible misuse of unsafe.Pointer

#491Openneclepsio 创建于 2025-11-05
N
neclepsiocommented
Both `TextureData.Pixels()` and `TextureData.PixelsAt()` return `uintptr`. `go-gl` requires `unsafe.Pointer` when setting texture data, so the command is: gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, tex.Width(), tex.Height(), 0, gl.RGBA, gl.UNSIGNED_BYTE, unsafe.Pointer(tex.Pixels())) This requires a conversion from `uintptr` to `unsafe.Pointer`, that triggers a warning with `go vet` and other static analyzers due to it being unsafe (if I understand correctly, it's not). Maybe `Pixels` and `PixelsAt` should return a pointer instead of `uintptr`?
0 条评论