0

When format GL_RGB5_A1 is used with unsigned_byte texture data (no mipmap), the applied texture is blocky with min/mag filters GL_NEAREST. When same code used for format GL_RGBA8, the applied texture is smooth. My assumption was that for RGBA8 too using GL_NEAREST filters the texture image should be blocky as attached. OPGNELES 3.0 supports this format and type for textures. Its a 3D texture of size 256x256x256 applied using glTexImage3D and viewport is set for 640x480. Texture is generated as below

for(k = 0; k < 256; k++) for(j = 0; j < 256; j++) for(i = 0; i < 256; i++)
{
    pUBPointer[0] = 255-i;
    pUBPointer[1] = 255-j;
    pUBPointer[2] = 255-k;
    pUBPointer[3] = 0xFF;

    pUBPointer += 4;
}

Is it expected?

  1. Image for format RGB5_A1
  2. Image for format RGBA8

enter image description here enter image description here

user1896853
  • 107
  • 1
  • 9

1 Answers1

2

Works as intended. nearest takes only one sample from texture from nearest texel. Difference between RGB8 texels (in one direction) is 1/256 - which is visually almost undistunguishable. However, with RGB5, only 5 bits allocated for each colour, so differense is 1/32.

keltar
  • 17,711
  • 2
  • 37
  • 42