glGetString(GL_VERSION) returns “OpenGL ES-CM 1.1” but my phone supports OpenGL 2

前端 未结 2 674
情深已故
情深已故 2021-01-22 18:37

I\'m trying to make an NDK based OpenGL application. At some point in my code, I want to check the OpenGL version available on the device.

I\'m using the following code

2条回答
  •  迷失自我
    2021-01-22 19:19

    Thanks to the hints given by mstorsjo, I managed to have the correct initialisation code, shown here if other people struggle with this.

    const EGLint attrib_list[] = {
            // this specifically requests an Open GL ES 2 renderer
            EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, 
            // (ommiting other configs regarding the color channels etc...
            EGL_NONE
    };
    
    EGLConfig config;
    EGLint num_configs;
    eglChooseConfig(display, attrib_list, &config, 1, &num_configs);
    
    // ommiting other codes 
    
    const EGLint context_attrib_list[] = { 
            // request a context using Open GL ES 2.0
            EGL_CONTEXT_CLIENT_VERSION, 2, 
            EGL_NONE 
    };
    EGLContext context = eglCreateContext(display, config, NULL, context_attrib_list);
    

提交回复
热议问题