Subpixel positioning

This topic contains 1 reply, has 2 voices, and was last updated by  Xmas 7 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #30203


    I’m wondering what the best way to offset a texture by 0-2 subpixels is. So far I’ve come up with four (read: three) possible solutions:

    • Process the texture before sending it to the shader. This would mean the texture data to be sent could triple.
    • Use alpha-only textures with triple width. The fragment shader would then sample the texture at 3 positions and combine then.
    • Use RGB textures with 2 samplers and swizzle the output.
    • Somehow read the RGB data from the texture with a byte offset. This would require an OpenGL extension, it may not be supported by the hardware (due to swizzling, unaligned access, etc.), but I am interested to know if it is 🙂


    I’d recommend the second approach, using an alpha texture and sampling the texture at three positions. Note that on SGX it is better to use three varyings instead of one varying and applying an offset in the fragment shader.

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.