Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Questions: GL_LINEAR is not working in android GLES 3.0

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2014
    Posts
    3

    Questions: GL_LINEAR is not working in android GLES 3.0

    Hi, I tried using Texture parameters for MIN and MAG FILTER as GL_LINEAR, but it gives a black screen for me.
    Is there a way to implement this interpolation in 3D texturing? i am getting distorded images by using GL_NEAREST.

    Thanks

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    787
    Hmm, something rather basic like linear texture filtering should normally work.
    My suspicion would be that there is something else wrong especially when you say that GL_NEAREST produces 'distorted' images - I would expect them to be pixelated, not distorted. Is it possible that your glPixelStore settings (in particular GL_UNPACK_ALIGNMENT) are incorrect when uploading the texture data?

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2014
    Posts
    3

    Questions: GL_LINEAR is not working in android GLES 3.0

    Actually, Image doesnt even appear on GL_LINEAR. GL_NEAREST produces blurred images where there is slight distortion. Is there any mathematical algorithm which i can implement in th shader to counter the interpolation issue?
    \My pixel store parameters seem to be fine.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    787
    Ok.
    It's possible to manually implement linear sampling in the shader (but a bit tedious to handle the different wrap modes and not as efficient as letting the hardware do it). For a texture of size W by H pixels the pixel centers are located at texture coords u = i/W + 1/2W and v = i/H + 1/2H for i in [0,W-1], j in [0,H-1]. You need to find the 4 texels closest to the sample location (s,t) and bilinearly interpolate their values.
    For sampling at (s,t) where the fractional part of (s*W) > 1/2W you want texels s*W, (s+1)*W, otherwise s*W, (s-1)*W and similar for the vertical direction.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •