我按照https://stackoverflow.com/a/31095254/6655884进行了以下操作(向版本指令添加了\ n换行符)

public class OrwellShaders {
    public class Vertex {
        public static final String vertex  =
            "#version 330 es\n " +
            "layout (location = 0) in vec3 aPos;\n " +
            "layout (location = 1) in vec2 aTexCoord;\n " +
            "\n " +
            "out vec2 TexCoord;\n " +
            "\n " +
            "void main()\n " +
            "{\n " +
            "    gl_Position = vec4(aPos, 1.0);\n " +
            "    TexCoord = vec2(aTexCoord.x, aTexCoord.y);\n " +
            "};\n";
    }


但我仍然收到Adreno error Invalid #version shader

我的手机装有Android 8,因此应该有支持。我没有使用GLSurfaceView,所以没有setEGLContextClientVersion(3)我只是在使用

egl = (EGL10) EGLContext.getEGL();
        eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
        if (eglDisplay == EGL10.EGL_NO_DISPLAY) {
        //...

最佳答案

删除“ #version 330 es \ n”。我有一个类似的错误,删除此错误使GLSL可以编译

10-08 07:56
查看更多