0
votes

There are a great number of questions relating to exactly two points in texture coordinates, and my shader already works with that concept. 1.0, 1.0 shows the entire image, and 1.0 / frame in one dimension or another displays the appearance of... well, unfortunately, it displays everything between 0.0 of the quad, to the decimal value of the division of the frame.

What I'd like to do is, from the shader, control all four points of the texture coordinates. In every tutorial and every sample, the texture coordinate vec is always a vec2, implying that you only have control over the two end-points, and not the starting points. Is there a way to eliminate this limitation?

To give you an idea of why I want to do this (If it isn't blatantly obvious already), I'd like to pick a tile or animated frame out of a larger sheet.

Ideally, I'd also be able to find the dimensions (Width and height) of the image in the shader, but if necessary, it isn't that difficult to pass those values in. I believe at this time I'm using GLSL 2, meaning I'm unable to use the textureSize2D function in the shader (Already tried it).

1
There seems to be a gross misunderstanding about the two UV coordinates that you get passed per vertex to the shader. You may want to re-read some of the tutorials, or google ones that especially cover atlas mapping.JustSid
Any chance you could point me in the right direction? I've searched GLSL atlas mapping, texture atlas and regular atlas map and it isn't coming up with anything helpful. Is there something I'm missing? A great number of people MENTION it, but no-one says what it is or how it works or anything of the sort.Drake M.

1 Answers

0
votes

Simplifying things UV coodrinate pair you pass to texture command means a point to read from texture. just one point, not an area. Depending on sampler state and whether minification/magnification occur or not more then one texel can be used to calculate value of that point, but still it is one value connected to UV provided.