Fix missing tex_type
in one of newTexture
. Prevent nil access in destroy
.
This commit is contained in:
parent
90abbac26b
commit
17d6ccc32d
|
@ -329,8 +329,9 @@ proc unbindAllTextures*() =
|
|||
next_texture = 0
|
||||
|
||||
proc destroy*(texture: Texture) =
|
||||
texture.unbind()
|
||||
texture.freeTextureStorage()
|
||||
if texture.storage != nil:
|
||||
texture.unbind()
|
||||
texture.freeTextureStorage()
|
||||
|
||||
proc loadFromPixelsPointer*(self: Texture, pixels: pointer) =
|
||||
let ts = self.storage
|
||||
|
@ -467,7 +468,7 @@ proc newTexture*(engine: MyouEngine, name: string, file_name: string, is_sRGB: b
|
|||
|
||||
# TODO: Api that stores the LoadableResource so it can be re-loaded later
|
||||
# note: format does not matter at this point, will be replaced later
|
||||
let self = engine.newTexture(name, 0, 0, filter=filter, format=RGBA_u8)
|
||||
let self = engine.newTexture(name, 0, 0, filter=filter, format=RGBA_u8, tex_type=tex_type)
|
||||
self.is_sRGB = is_sRGB
|
||||
var res: LoadableResource
|
||||
proc load(ok: bool, err: string, data: SliceMem[byte]) =
|
||||
|
|
Loading…
Reference in a new issue