Does this bind properly?
When attempting to use it, I get the following error:
java.lang.ClassCastException: [Lcom.jme3.texture.Texture; cannot be cast to com.jme3.texture.Texture
Aren’t those the exact same thing? /boggle
Does this bind properly?
When attempting to use it, I get the following error:
java.lang.ClassCastException: [Lcom.jme3.texture.Texture; cannot be cast to com.jme3.texture.Texture
Aren’t those the exact same thing? /boggle
Actually… if it does bind as expected, where can I find an example of usage? I would have thought passing this a Texture2D array would have been correct, but it doesn’t seem to be.
The “L” means “array of type” and arrays are generally not working with inheritance.
@normen said: The "L" means "array of type" and arrays are generally not working with inheritance.
Ok… understood the first part of that… but not the second. I’ve noticed that this seems to be avoided in all JME shaders. How does one construct and array of textures that will bind properly?
@t0neg0d said: Ok... understood the first part of that... but not the second. I've noticed that this seems to be avoided in all JME shaders. How does one construct and array of textures that will bind properly?
It has to be an array of Texture, not Texture2D
@normen said: It has to be an array of Texture, not Texture2D
Actually… there is a bug in the VarType class. TextureArray is defined as follows:
MultiData is set to false… meaning it expects a single texture…
[java]
TextureArray(false,true,“sampler2DArray”),
[/java]
It should be set to true:
[java]
TextureArray(true,true,“sampler2DArray”),
[/java]
I think this would fix the issue…
EDIT: Guess I should have specified that I had already tried both Texture and Texture2D. The var type internal to the shader is sampler2DArray (and the binding mech), so Texture2D should have worked as well.
This would clean up the Lighting and Shadow shaders quite a bit. Get rid of an ass load of defines and single texture uniforms.
@t0neg0d said: @nehonActually… there is a bug in the VarType class. TextureArray is defined as follows:
MultiData is set to false… meaning it expects a single texture…
[java]
TextureArray(false,true,“sampler2DArray”),
[/java]It should be set to true:
[java]
TextureArray(true,true,“sampler2DArray”),
[/java]I think this would fix the issue…
EDIT: Guess I should have specified that I had already tried both Texture and Texture2D. The var type internal to the shader is sampler2DArray (and the binding mech), so Texture2D should have worked as well.
@t0neg0d said: This would clean up the Lighting and Shadow shaders quite a bit. Get rid of an ass load of defines and single texture uniforms.It would, except it's not supported by opengl 2.0. Started with opengl 2.1 with an extension. Also a texture array is not one uniform, you have one uniform "slot" for each texture in the array.
@nehon said: You have to wrap your textures in a TextureArray class. See TestTextureArray in the repo.It would, except it’s not supported by opengl 2.0. Started with opengl 2.1 with an extension.
Also a texture array is not one uniform, you have one uniform “slot” for each texture in the array.
Ewww… Ok… not worth it then.
Thanks for the info!