opengl - Drawing pixel-perfect texture part -


Is it possible to get pixel-perfect exact with glTexCoord2f ()? For example, suppose I have built a 512x512 texture in the OpenGL reference and now I want to draw an arbitrary region from within that structure as a tractor. Suppose that whatever area I want to attract, really uses weird offsets and dimensions which are not more than the size of the texture, for example:

  Texture size: 512x512 The area inside the texture that I want to attract: x = 131 y = 159 width = 243 height = 33  

The problem is that glTexCoord2f () values ​​between 0 and 1 Expect me to convert pixel values ​​to float values For some floating point arithmetic has to be done, which is between 0 and 1, and I'm afraid that pixel- to complete the conversion may have lost the full precision of that integer I know this conversion is not a problem If you paste on the multiplication of texture size, that is, the applied sheet with the item is 16x16, 32x32, 64x64 or something like this, but what is the texture to actually address the arbitrary offset? In Ray? Is pixel-perfectness possible here?

This is not a solution, there is only one workaround that has been used for centuries:

Usually the spray within the atleaz is padded with 1px transparent border, so that floating-point errors are invisible.

We used 1024x1024 Atlas with 32x32 tiles and still we had side-of-the-road errors on some specific camera offsets.


Comments