Shader android error:“ Invalid version shader”

问题描述 投票:0回答:1

我遵循了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) {
        //...
java android opengl-es
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.