I made a simple app that takes an input image and outputs a processed one using a fragment shader. When using a 2^n image it’s OK. But if I use a rectangular not-power-of-2 image I get a black stitch running from top to bottom.
This is the original:

This is after being processed:

Here’s my fragment shader:
precision mediump float;
uniform vec2 uSize;
uniform sampler2D sTexture;
void main()
{
gl_FragColor = texture2D(sTexture, vec2(gl_FragCoord) / uSize)
}
Where, uSize is a vec2 having the size of the image
Generally I can work with a power-of-2 textures, but as OGLES2 supports rectangular textures I was thinking of sparing myself some work.
Thanks!
UPDATE
Here go my vertices:
static GLfloat vVertices[] =
{
-1.0f, 1.0f, 0.0f,
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
1.0f, 1.0f, 0.0f,
-1.0f, 1.0f, 0.0f,
};
And here is the vertex shader:
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
}
UPDATE
Now, that’s strange. Here are the two triangles rendered separately (first using the first 3 vertices, and then using the next (last) three).
Here go for the square image (as expected):


And here are how the same triangles look for the rectangle image/texture. They look bizarre:


They don’t look like triangles at all. Does anyone know what’s happening?
Seems the drivers were bad. Updating them fixed the problem.