Android 为什么在本机活动示例的清单文件中没有声明使用OpenGL ES的功能?

Android 为什么在本机活动示例的清单文件中没有声明使用OpenGL ES的功能?,android,opengl-es,android-ndk,sample,native-activity,Android,Opengl Es,Android Ndk,Sample,Native Activity,直截了当地说: 国家 OpenGL ES版本要求-如果应用程序需要特定版本的OpenGL ES,则必须通过向清单中添加以下设置来声明该要求,如下所示 对于OpenGL ES 2.0: 非常感谢你的阅读。 你可以回答任何你喜欢的问题 注意:如果你回答我,你将成为百万富翁。开玩笑不要把多个问题捆绑在一起。您链接到的示例是针对libGLESv1_CM的链接,它是OpenGL ES 1.x库。所以我不知道为什么页面上说它使用的是OpenGL ES 2.0。 <!-- Tell the system

直截了当地说:

国家

OpenGL ES版本要求-如果应用程序需要特定版本的OpenGL ES,则必须通过向清单中添加以下设置来声明该要求,如下所示

对于OpenGL ES 2.0:

非常感谢你的阅读。 你可以回答任何你喜欢的问题


注意:如果你回答我,你将成为百万富翁。开玩笑

不要把多个问题捆绑在一起。您链接到的示例是针对libGLESv1_CM的链接,它是OpenGL ES 1.x库。所以我不知道为什么页面上说它使用的是OpenGL ES 2.0。
<!-- Tell the system this app requires OpenGL ES 2.0. -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
// initialize OpenGL ES and EGL

    /*
     * Here specify the attributes of the desired configuration.
     * Below, we select an EGLConfig with at least 8 bits per color
     * component compatible with on-screen windows
     */
    const EGLint attribs[] = {
            EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
            EGL_BLUE_SIZE, 8,
            EGL_GREEN_SIZE, 8,
            EGL_RED_SIZE, 8,
            EGL_NONE
    };
    EGLint w, h, format;
    EGLint numConfigs;
    EGLConfig config = nullptr;
    EGLSurface surface;
    EGLContext context;

    EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);

    eglInitialize(display, nullptr, nullptr);

    /* Here, the application chooses the configuration it desires.
     * find the best match if possible, otherwise use the very first one
     */
    eglChooseConfig(display, attribs, nullptr,0, &numConfigs);
    std::unique_ptr<EGLConfig[]> supportedConfigs(new EGLConfig[numConfigs]);
    assert(supportedConfigs);
    eglChooseConfig(display, attribs, supportedConfigs.get(), numConfigs, &numConfigs);
    assert(numConfigs);
    auto i = 0;
    for (; i < numConfigs; i++) {
        auto& cfg = supportedConfigs[i];
        EGLint r, g, b, d;
        if (eglGetConfigAttrib(display, cfg, EGL_RED_SIZE, &r)   &&
            eglGetConfigAttrib(display, cfg, EGL_GREEN_SIZE, &g) &&
            eglGetConfigAttrib(display, cfg, EGL_BLUE_SIZE, &b)  &&
            eglGetConfigAttrib(display, cfg, EGL_DEPTH_SIZE, &d) &&
            r == 8 && g == 8 && b == 8 && d == 0 ) {

            config = supportedConfigs[i];
            break;
        }
    }
    if (i == numConfigs) {
        config = supportedConfigs[0];
    }

    if (config == nullptr) {
        LOGW("Unable to initialize EGLConfig");
        return -1;
    }

    /* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
     * guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
     * As soon as we picked a EGLConfig, we can safely reconfigure the
     * ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
    eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);
    surface = eglCreateWindowSurface(display, config, engine->app->window, nullptr);
    context = eglCreateContext(display, config, nullptr, nullptr);

    if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
        LOGW("Unable to eglMakeCurrent");
        return -1;
    }