Here is how I use and upload the texture to OpenGL.
http://pastebin.com/GGjNGhhq
val colData = Array.tabulate(rows, cols)((i, j) => {
//val depth = fbm(i, j)
//val c = getSubSpriteData(depth)._3
val tc = if (((i&8)==0)^((j&8)==0)) List(1.0f, 1.0f, 1.0f) else List(0.0f, 0.0f, 0.0f)
tc
}).flatMap(arr => arr.flatMap(l => l)).array
tileColours = new DataGL(colData, rows, cols, 3, 2)
Distortion:
http://postimg.org/image/46lthwo3z/
This does not occur if I throw my data into an image and then upload it.
Now, if I save this result as an image and upload that to my GPU it works perfectly. However I would rather directly upload data to the GPU than encode it into an image and upload that.
The shader simply does a UV mapping like so:
vec2 getUV() {
vec2 uv = gl_FragCoord.xy/viewport;
uv.y = 1. - uv.y;
return uv;
}
vec3 col = texture2D(subspriteColours, getUV()).rgb;
I should add that I am not using PO2 dimensions, which strangely enough work without issue. The data stored is a dimension of (120, 45), however I can save the non-po2 data as a non-po2 image and load that perfectly. The issue is purely when uploading the above data (or any, but this example shows the problem perfectly), I have tried other RGB modes as well, but the issue persists, which leads me to believe a possible driver issue.