I've just created a simple test program and it seems to work perfectly. Could you do the same so we can all see where the problem lies?
Here's my dba code:
` standard 3D template for camera controls and display
set display mode desktop width(), desktop height(), 32
sync on: sync rate 60: sync
autocam off
position camera 0, 50, -300
point camera 0, 0, 0
create bitmap 1, 64, 64
cls rgb(0,0,0)
ink rgb(0,255,0), rgb(0,0,0)
text 24, 32, "HI!"
get image 1, 0, 0, 64, 64
set current bitmap 0
load effect "test.fx", 1, 0
make object cube 1, 50
texture object 1, 0, 1
set object effect 1, 1
global cx#
global cy#
cx# = camera angle x()
cy# = camera angle y()
repeat
text 20, 20, "cam X angle = "+str$(camera angle x(),2)
text 20, 40, "cam Y angle = "+str$(camera angle y(),2)
positionCamera()
scroll object texture 1, 0, 0.01, 0.01
sync
until spacekey()
end
function positionCamera()
control camera using arrowkeys 0, 1, 0
cx# = cx# + mousemovey(): cy# = cy# + mousemovex()
rotate camera cx#, cy#, 0
endfunction
Shader:
// Simple shader to test use of DBPro "scroll object texture" command
// Created 1 June 2010.
float4x4 wvp : WorldViewProjection;
texture baseTexture < string ResourceName = ""; >;
sampler baseSample = sampler_state
{ texture = <baseTexture>;
mipFilter = linear;
magFilter = linear;
minFilter = linear;
addressU = wrap;
addressV = wrap;
};
struct VSInput
{ float4 pos : position;
float2 UV : texcoord0;
};
struct VSOutput
{ float4 pos : position;
float2 UV : texcoord0;
};
struct PSInput
{ float2 UV : texcoord0;
};
struct PSOutput { float4 col : Color; };
VSOutput VShader(VSInput In, VSOutput Out)
{ Out.pos = mul(In.pos, wvp);
Out.UV = In.UV;
return Out;
}
PSOutput PShader(PSInput In, PSOutput Out)
{ Out.col = tex2D(baseSample, In.UV);
return Out;
}
technique test
{ pass p0
{ vertexShader = compile vs_2_0 VShader();
pixelShader = compile ps_2_0 PShader();
}
}
Edit
Here's a better example. This scrolls the stage 1 texture but not the stage 0 texture.
dba code:
` standard 3D template for camera controls and display
set display mode desktop width(), desktop height(), 32
sync on: sync rate 60: sync
autocam off
position camera 0, 50, -300
point camera 0, 0, 0
create bitmap 1, 64, 64
cls rgb(0,0,0)
ink rgb(0,255,0), rgb(0,0,0)
text 24, 32, "HI!"
get image 1, 0, 0, 64, 64
set current bitmap 0
load effect "test.fx", 1, 0
make object cube 1, 50
convert object fvf 1, 530 ` = default 274 + 256 for stage 1 coords added
` now give the object's stage 1 coords some values - double the stage 0 values so we can see what's happening
lock vertexdata for limb 1, 0
nv = get vertexdata vertex count()-1
for v = 0 to nv
set vertexdata uv v, 1, get vertexdata u(v,0)*2, get vertexdata v(v,0)*2
next v
unlock vertexdata
texture object 1, 0, 1
texture object 1, 1, 1
set object effect 1, 1
global cx#
global cy#
cx# = camera angle x()
cy# = camera angle y()
repeat
text 20, 20, "cam X angle = "+str$(camera angle x(),2)
text 20, 40, "cam Y angle = "+str$(camera angle y(),2)
positionCamera()
scroll object texture 1, 1, 0.01, 0.01
sync
until spacekey()
end
function positionCamera()
control camera using arrowkeys 0, 1, 0
cx# = cx# + mousemovey(): cy# = cy# + mousemovex()
rotate camera cx#, cy#, 0
endfunction
Shader:
// Simple shader to test use of DBPro "scroll object texture" command
// Created 1 June 2010.
float4x4 wvp : WorldViewProjection;
texture baseTexture < string ResourceName = ""; >;
texture baseTexture2 < string ResourceName = ""; >;
sampler baseSample = sampler_state
{ texture = <baseTexture>;
mipFilter = linear;
magFilter = linear;
minFilter = linear;
addressU = wrap;
addressV = wrap;
};
sampler baseSample2 = sampler_state
{ texture = <baseTexture2>;
mipFilter = linear;
magFilter = linear;
minFilter = linear;
addressU = wrap;
addressV = wrap;
};
struct VSInput
{ float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
};
struct VSOutput
{ float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
};
struct PSInput
{ float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
};
struct PSOutput { float4 col : Color; };
VSOutput VShader(VSInput In, VSOutput Out)
{ Out.pos = mul(In.pos, wvp);
Out.UV0 = In.UV0;
Out.UV1 = In.UV1;
return Out;
}
PSOutput PShader(PSInput In, PSOutput Out)
{ Out.col = tex2D(baseSample, In.UV0) + tex2D(baseSample2, In.UV1).grba;
return Out;
}
technique test
{ pass p0
{ vertexShader = compile vs_2_0 VShader();
pixelShader = compile ps_2_0 PShader();
}
}
Again it seems to work perfectly. Looks like you might be doing something wrong.