From: Mikko Rasa Date: Sun, 19 Sep 2021 10:33:18 +0000 (+0300) Subject: Initialize Texture's format to an invalid value X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=8653af6d620206c1a8bab284721256e9ea4e3b74;p=libs%2Fgl.git Initialize Texture's format to an invalid value This makes it possible to determine if a texture has storage defined or not. --- diff --git a/source/core/pixelformat.h b/source/core/pixelformat.h index 5a5302cd..2f603845 100644 --- a/source/core/pixelformat.h +++ b/source/core/pixelformat.h @@ -54,6 +54,7 @@ inadvisable for programs to rely on it. */ enum PixelFormat { + NO_PIXELFORMAT = 0, R8 = 0x4100|RED, R16F = 0x3200|RED, R32F = 0x3400|RED, diff --git a/source/core/texture.cpp b/source/core/texture.cpp index e607792c..877e4d10 100644 --- a/source/core/texture.cpp +++ b/source/core/texture.cpp @@ -26,8 +26,8 @@ Texture *Texture::scratch_binding = 0; Texture::Texture(GLenum t, ResourceManager *m): id(0), target(t), - format(RGB8), - storage_fmt(RGB8), + format(NO_PIXELFORMAT), + storage_fmt(format), swizzle(NO_SWIZZLE), use_srgb_format(false), auto_gen_mipmap(false)