[SOLVED] use TextureStage with shader

This are four GeoMipTerrain without shader:

It with shader:

The texcoord is wrong.

I think I set texcoord, this is python code:

self.tssmall = TextureStage("small")
# 再添加一个纹理
self.tssquare = TextureStage("ts")
for i in [0,1]:
	for j in [0,1]:
		self.root[i][j].setPos(-512+j*512, -512+i*512, 0)
		self.root[i][j].setTexture(self.tssmall, loader.loadTexture("tex_grass_003.jpg"))
		self.root[i][j].setTexGen(self.tssmall, TexGenAttrib.MWorldPosition)
		self.root[i][j].setTexTransform(self.tssmall, TransformState.makeScale(0.125))
		self.root[i][j].setTexture(self.tssquare, loader.loadTexture("square.png"))
		self.root[i][j].setTexGen(self.tssquare, TexGenAttrib.MWorldPosition)
		# 设置着色器
		self.root[i][j].setShader(Shader.load(Shader.SLGLSL, "terrainv.glsl", "terrainf.glsl"))

this is vertex shader:

#version 330 compatibility

out Data
	vec3 normal;
	vec2 TexCoord0;
	vec2 TexCoord1;

in vec2 p3d_MultiTexCoord0;
in vec2 p3d_MultiTexCoord1;

void main() {

	vertex.normal = normalize(gl_NormalMatrix * gl_Normal);
	vertex.TexCoord0 = p3d_MultiTexCoord0;
	vertex.TexCoord1 = p3d_MultiTexCoord1;

	gl_Position = ftransform();


#version 330 compatibility

uniform sampler2D p3d_Texture0;
uniform sampler2D p3d_Texture1;

in Data
	vec3 normal;
	vec2 TexCoord0;
	vec2 TexCoord1;

void main()
	vec4 texel;
	float NdotL, NdotHV, intensity,at,af;

	texel = texture2D(p3d_Texture0,frag.TexCoord0);
	texel += texture2D(p3d_Texture1,frag.TexCoord1);

	at = texel.a;
	gl_FragColor = texel;


Does clamping the texture work? Something like:

tex = loader.loadTexture("tex_grass_003.jpg")

Sorry, I understand the problem of where, setTexGen invalid for shader.