Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is almost certainly down to having some form of filtering enabled.</p> <p>I note that you're turning on anisotropic filtering. Even without mip-mapping, this will cause pixels outside of your sub-texture to be fetched, causing artefacts like you are seeing here.</p> <p>You really need to turn that off, as well as getting rid of the mip-mapping.</p> <p>Also, I think your UV generation is off, and contains some errors. Those probably aren't the issue here, but I'd recommend fixing them.</p> <p>For example, here you add half a texel:</p> <pre><code>glm::vec2 t1(0.5/TEXTURE_SIZE, 0.5/TEXTURE_SIZE); </code></pre> <p>However this is later scaled down, so actually you're only offsetting by a small amount. It's probably unnecessary anyway (why do you think you need to do this at all?), but it's almost certainly not doing what you think its doing. A very small offset might be a good idea to prevent any rounding errors slipping the fetched texel into the next sub-texture, but only a tiny amount.</p> <p>Then you do this:</p> <pre><code>double u = ((double)(ID % numCols) / (double)numCols); double v = ((double)(ID / numRows) / (double)numRows); </code></pre> <p>You should be using the same value to both divide and modulo <code>ID</code>. It only works because you have the same number of rows and columns.</p> <p>Finally you calculate the UVs like this:</p> <pre><code>t1.x/TILE_TEXTURE_SIZE + u </code></pre> <p>Dividing by the tile size is wrong. It should be <code>* TILE_SIZE / TEXTURE_SIZE</code>. Fortunately for you this happens to be the same (256 / 16 = 16). If you have different sized textures, it wouldn't work.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload