So ive been messing around with the glowShader from on of the samples and i made it togglable. Before i toggle the glowshader on all my texture are wrapped in the repeat way, but when i toggle the shader on it clears the material and sets the texture wrapping to the default where it just stretches it over the geometry. So when i toggle it on i also try to reapply the texture and reset the wrapping to tiled, but when i do nothing changes. is it because the shader is not allowing it? (I have only basic understanding of how shaders work and verry little knowledge of what all shaders control) here is my Code
def enableFilters(self, player, level):
#self.filters.setBloom(mintrigger=.35)
self.filters.setBloom(blend=(1, 0, .2, 1), desat=-1, intensity=3, size="small")
self.filters.setCartoonInk(separation=-.5)
self.filters.setAmbientOcclusion(numsamples = 16, radius = 0.05, amount = 10, strength = 0.01, falloff = 0.000002)
player.setShader(self.glowShader)
level.setShader(self.glowShader)
self.tex = loader.loadTexture("./textures/platform.png")
self.tex.setWrapU(Texture.WMRepeat)
self.tex.setWrapV(Texture.WMRepeat)
for i in range(len(level.getChildren())):
print(level.getChild(i))
child = level.getChild(i)
print(child.getChild(0))
if level.getChild(i) == "render/renderDummy/Box":
self.tex = loader.loadTexture("./textures/platform.png")
self.tex.setWrapU(Texture.WMRepeat)
self.tex.setWrapV(Texture.WMRepeat)
print("wtf")
child.getChild(0).clearTexture()
child.getChild(0).setTexture(self.tex)
child.getChild(0).setTexScale(TextureStage.getDefault(), 10, 10)
#level.getChild(i).getChild(0).getTexture().setWrapU(Texture.WMRepeat)
#level.getChild(i).getChild(0).getTexture().setWrapU(Texture.WMRepeat)
child.setTexture(self.tex)
self.tex.setWrapU(Texture.WMRepeat)
self.tex.setWrapV(Texture.WMRepeat)
#render.setShader(self.glowShader)
and here is the shader code
//Cg
//
void vshader(float4 vtx_position : POSITION,
float2 vtx_texcoord0 : TEXCOORD0,
uniform float4x4 mat_modelproj,
out float4 l_position : POSITION,
out float2 l_texcoord0 : TEXCOORD0)
{
l_position=mul(mat_modelproj, vtx_position);
l_texcoord0=vtx_texcoord0;
}
void fshader(float2 l_texcoord0 : TEXCOORD0,
uniform sampler2D tex_0 : TEXUNIT0,
out float4 o_color : COLOR)
{
float4 texColor=tex2D(tex_0, l_texcoord0);
o_color=texColor*2*(texColor.w - 0.5);
}