Do we have a means of loading a texture (i.e. via “loader.loadTexture”) such that its components are given as integer values between 0 and 255 instead of float values between 0.0 and 1.0?
Furthermore, is there anything especial that I need to do when saving out my image in order for it to keep to integral values?
To explain, I want to use an image to encode certain id-values, used both in logic and in shader-rendering. If I’m not much mistaken, the shader-side should be handled by specifying that my texture input be a “usampler2D”, and have applicable calls to “texture2D” then fill out a “uvec4” variable. However, I’m not clear on how to handle this on the Panda side, or indeed, when generating my image in the first place.
I have found mention of the “LoaderOptions” class that may specify a “TF_integer” option. However, thus far my attempts to use this have seemingly failed, both in attempting to render the ID-values in a shader and in attempting to “peek” at them via a TexturePeeker. (Unless, of course, it’s my input texture that’s the problem…)
This is how I’m using “LoaderOptions” at the moment:
bubbleTexOptions = LoaderOptions(flags = LoaderOptions.TF_integer) self.bubbleIDTexture = loader.loadTexture(<image path>, loaderOptions = bubbleTexOptions)