I am making a camera filter app, for that I am using opengles and CameraX, when I use PreviewView everything works fine but when I use GlSurfaceView the preview starts to skew as I move my device sideways.
- I am creating a texture in the renderer
- creating a surface texture out of the texture
- creating a surface provider from that surface texture
- finally providing this surface provider to the CameraX.
This way I am allowing cameraX to provide preview on the texture which I am manipulating through opengles to create colour filters.
Everything works just when I tilt the phone the image starts skewing and the skew increases as the angle of tilt increases.

Please take a look at the SurfaceProcessor API. It's designed for injecting things like OpenGL renderer into CameraX pipeline. It's compatible with
PreviewView. You can find a sample code here: https://github.com/androidx/androidx/blob/androidx-main/camera/camera-core/src/main/java/androidx/camera/core/processing/DefaultSurfaceProcessor.java