I’ve made a spritesheet shader, which works fairly well except for with some number combinations.

For example, when:

```
m_SizeX = 7
m_SizeY = 7
m_Position = 14
```

Then I don’t see the “sprite” rendered. I think there’s some numeric or rounding issue but I can’t figure it out:

```
uniform mat4 g_WorldViewProjectionMatrix;
uniform float m_SizeX;
uniform float m_SizeY;
uniform float m_Position;
uniform float m_FlipHorizontal;
attribute vec3 inPosition;
attribute vec2 inTexCoord;
attribute float inTexCoord2;
attribute float inTexCoord3;
varying float vAlpha;
varying vec2 texCoord;
void main(){
float t = m_Position;
#ifdef HAS_VERTEXSHEETPOS
t = inTexCoord2;
vAlpha = inTexCoord3;
#endif
float tPointerY = 1.0 - ((floor(t / m_SizeX)) / m_SizeY) - 1.0 / m_SizeY;
float tPointerYOffset = (floor(t / m_SizeX)) / m_SizeY;
float tPointerX = (t - (tPointerYOffset * m_SizeX * m_SizeY)) / m_SizeX;
if (m_FlipHorizontal == 1.0 ) {
texCoord.x = ( 1.0 - inTexCoord.x ) / m_SizeX + tPointerX;
}
else {
texCoord.x = inTexCoord.x / m_SizeX + tPointerX;
}
texCoord.y = inTexCoord.y / m_SizeY + tPointerY;
gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
}
```

The .j3md is here

and the fragment shader is here