I only want to show second half portion of an image in my glcontrol, in a condition that only 0.7 to 0. 9 of second half is want to see in glControl. For that I have done like below. But it shows portion of first half of image too. Please help to correct the shader code.
public void CreateShaders()
{
/***********Vert Shader********************/
vertShader = GL.CreateShader(ShaderType.VertexShader);
GL.ShaderSource(vertShader, @"attribute vec3 a_position;
varying vec2 vTexCoordIn;
void main() {
vTexCoordIn=( a_position.xy+1)/2 ;
gl_Position = vec4(a_position,1);
}");
GL.CompileShader(vertShader);
/***********Frag Shader ****************/
fragShader = GL.CreateShader(ShaderType.FragmentShader);
GL.ShaderSource(fragShader, @"precision highp float;
uniform sampler2D sTexture;
varying vec2 vTexCoordIn;
void main ()
{
vec2 vTexCoord=vec2(vTexCoordIn.x,vTexCoordIn.y);
float rightsliderStartval=0.7;//0.5 to 1.0
float rightsliderEndval=0.9;//1.0 to 0.5
float rightsliderDelta=rightsliderEndval-rightsliderStartval;
vec4 color= texture2D(sTexture, vec2((0.5+vTexCoord.x)-(rightsliderStartval-0.5)-(1.0-rightsliderEndval), vTexCoord.y));
gl_FragColor = color;
}");
GL.CompileShader(fragShader);
}