Penny
September 21, 2015, 2:42pm
1
Hi,
I am implementing texture arrays. The problem is that the textures dont seem to wrap according to the settings.
Code snippets as follows…
TextureArray dmta=new TextureArray(dma);
dmta.setWrap(Texture2D.WrapMode.Repeat);
material.setParam("DiffuseMaps",VarType.TextureArray,dmta);
frag…
if i just use the following the surface is blank…
vec4 diffuseColor1=texture2D(m_DIFFUSEMAPS[1],texCoord1);
To make it work I have to do the following…
vec2 tc1;
tc1.x=fract(texCoord1.x);
tc1.y=fract(texCoord1.y);
vec4 diffuseColor1=texture2D(m_DIFFUSEMAPS[1],tc1);
Why doesnt the wrap mode work in texture arrays?
is wrap mode legacy from the Texture object that just is not implemented in TextureArray?
It would be nice to know the answers to these. The work around code is fine but I would like to put my concerns of “is this the correct way” to bed.
Many Thanks
Penny
I had at some point I had repeating texturemaps in arrays, but this is quite a while ago, when they were new.
Penny
September 21, 2015, 3:19pm
3
I realise now that the TextureArray is not being passed to the frag.
Here are the code snippets…
j2md…
MaterialParameters
{
Texture2D DiffuseMaps
Texture2D HeightMaps
}
vert…
nothing declared or any mention in regard to maps.
frag…
uniform sampler2D m_DIFFUSEMAPS[6];
uniform sampler2D m_HEIGHTMAPS[6];
I cant seem to find an example of implementation. What am I doing wrong?
Many Thanks
Penny
Penny
September 21, 2015, 3:20pm
4
I tried changinh the materialParameters from Texture2D to TextureArray with no errors and no change in results.
There’s an example on how to use them here:
#import "Common/ShaderLib/GLSLCompat.glsllib"
#extension GL_EXT_texture_array : enable
// #extension GL_EXT_gpu_shader4 : enable
uniform vec4 m_Color;
#if defined(HAS_GLOWMAP) || defined(HAS_COLORMAP) || (defined(HAS_LIGHTMAP) && !defined(SEPARATE_TEXCOORD))
#define NEED_TEXCOORD1
#endif
#ifdef HAS_COLORMAP
#if !defined(GL_EXT_texture_array) && __VERSION__ < 130
#error Texture arrays are not supported, but required for this shader.
#endif
uniform sampler2DArray m_ColorMap;
#endif
#ifdef NEED_TEXCOORD1
This file has been truncated. show original
Penny
September 21, 2015, 6:56pm
6
Sorted thank you.
The wiki & documentation have lots of broken links which makes it difficult to understand some aspects. I will retain the link to the examples for future reference.
Many Thanks
Do you know of any specific pages which have issues with links?
Penny
September 21, 2015, 7:44pm
8
It may well be user contributed content links that are broken. I especially notice a lot by mifth. All the links to the shaddow blow project are defunct or the location does not hold the source. If I come across any links that are broken I will keep you informed.
Regards
Penny
Just so you know, you can login onto the wiki with your credentials and modify any pages.
1 Like