您好,抱歉我的英语。

我正在Eclipse Luna Ide上用openGLES2.0开发一个Android应用程序,而OpenGL ES扩展“ GL_OES_element_index_uint”在Android模拟器中不起作用。尝试使用“ UNSIGNED_INT”类型调用“ glDrawElements”时崩溃,并显示接下来的两条错误消息。

E/emuglGLESv2_enc(764): unsupported index buffer type 5125
E/eglCodecCommon(764): **** ERROR unknown type 0x1405 (glSizeof,72)


当我通过调用“ glGetString(GL_EXTENSIONS)”请求OpenGL扩展时,它告诉我支持扩展GL_OES_element_index_uint。

为了激活GL扩展,我在渲染器类中调用了“ glEnable(GL_EXTENSIONS)”。

而且我还将下一个指令同时放在两个着色器(顶点和片段)中,以便也激活着色器中的扩展名:
 #extension GL_OES_element_index_uint:启用

编译着色器的结果表明不支持此功能,正如您在我在此处发布的日志行中所见。

我不知道我做错了什么,还是模拟器的崩溃是由于与openGLES扩展程序和Android模拟器不兼容造成的

谢谢您的帮助。

这是我的日志的一部分。

05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bc640 android.hardware.location.network fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bc6d0 android.hardware.location fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bc750 android.software.input_methods fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bc7d8 android.hardware.touchscreen.multitouch.jazzhand fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bc880 android.hardware.touchscreen.multitouch fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bc918 android.hardware.screen.landscape fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bc9a8 android.hardware.screen.portrait fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bca30 android.hardware.sensor.compass fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bcab8 android.hardware.faketouch fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bcb38 android.hardware.camera fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bcbb0 android.hardware.camera.any fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bcc30 android.hardware.bluetooth fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bccb0 android.hardware.touchscreen.multitouch.distinct fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bcd58 android.software.home_screen fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bcdd8 android.hardware.microphone fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bce58 android.hardware.camera.autofocus fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bcee8 android.hardware.sensor.accelerometer fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bcf80 android.software.live_wallpaper fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bd008 android.hardware.touchscreen fl=0x0}
05-24 12:59:54.278: I/System.out(2203): AEP: FeatureInfo{b31bd088 android.software.app_widgets fl=0x0}
05-24 12:59:54.298: I/System.out(2203): AEP: FeatureInfo{b31bd108 glEsVers=2.0 fl=0x0}
05-24 12:59:54.308: I/System.out(2203): repetOnResume: 0
05-24 12:59:54.358: D/libEGL(2203): loaded /system/lib/egl    /libEGL_emulation.so
05-24 12:59:54.358: D/(2203): HostConnection::get() New Host Connection established 0xb7abdd10, tid 2203
05-24 12:59:54.408: D/libEGL(2203): loaded /system/lib/egl/libGLESv1_CM_emulation.so
05-24 12:59:54.408: D/libEGL(2203): loaded /system/lib/egl/libGLESv2_emulation.so
05-24 12:59:54.448: W/EGL_emulation(2203): eglSurfaceAttrib not implemented
05-24 12:59:54.448: D/OpenGLRenderer(2203): Enabling debug mode 0
05-24 12:59:54.448: D/(2203): HostConnection::get() New Host Connection established 0xb7ac3850, tid 2217
05-24 12:59:54.498: I/System.out(2203): GL_EXT_debug_marker GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float GL_OES_texture_npot GL_OES_rgb8_rgba8
05-24 12:59:54.518: V/ShaderHelper(2203): Results of compiling source:
05-24 12:59:54.518: V/ShaderHelper(2203): uniform mat4 u_Matrix;
05-24 12:59:54.518: V/ShaderHelper(2203): attribute vec4 a_Position;
05-24 12:59:54.518: V/ShaderHelper(2203): attribute vec2 a_TextureCoordinates;
05-24 12:59:54.518: V/ShaderHelper(2203): varying vec2 v_TextureCoordinates;
05-24 12:59:54.518: V/ShaderHelper(2203): void main()
05-24 12:59:54.518: V/ShaderHelper(2203): {
05-24 12:59:54.518: V/ShaderHelper(2203):   v_TextureCoordinates = a_TextureCoordinates;
05-24 12:59:54.518: V/ShaderHelper(2203):   gl_Position = u_Matrix * a_Position;
05-24 12:59:54.518: V/ShaderHelper(2203): }
05-24 12:59:54.518: V/ShaderHelper(2203): :
05-24 12:59:54.518: V/ShaderHelper(2203): Results of compiling source:
05-24 12:59:54.518: V/ShaderHelper(2203): #ifdef GL_FRAGMENT_PRECISION_HIGH
05-24 12:59:54.518: V/ShaderHelper(2203):   precision highp float;
05-24 12:59:54.518: V/ShaderHelper(2203): #else
05-24 12:59:54.518: V/ShaderHelper(2203):   precision mediump float;
05-24 12:59:54.518: V/ShaderHelper(2203): #endif
05-24 12:59:54.518: V/ShaderHelper(2203): //precision mediump float;
05-24 12:59:54.518: V/ShaderHelper(2203): uniform sampler2D u_TextureUnit;
05-24 12:59:54.518: V/ShaderHelper(2203): varying vec2 v_TextureCoordinates;
05-24 12:59:54.518: V/ShaderHelper(2203): void main()
05-24 12:59:54.518: V/ShaderHelper(2203): {
05-24 12:59:54.518: V/ShaderHelper(2203):   gl_FragColor = texture2D(u_TextureUnit, v_TextureCoordinates);
05-24 12:59:54.518: V/ShaderHelper(2203): }
05-24 12:59:54.518: V/ShaderHelper(2203): :
05-24 12:59:54.558: V/ShaderHelper(2203): Results of linking program:
05-24 12:59:54.558: V/ShaderHelper(2203): Results of validating program: 1
05-24 12:59:54.558: V/ShaderHelper(2203): Log:
05-24 12:59:54.558: V/ShaderHelper(2203): Results of compiling source:
05-24 12:59:54.558: V/ShaderHelper(2203): #version 150
05-24 12:59:54.558: V/ShaderHelper(2203): #extension     GL_OES_element_index_uint : enable
05-24 12:59:54.558: V/ShaderHelper(2203): uniform mat4 u_Matrix;
05-24 12:59:54.558: V/ShaderHelper(2203): attribute vec4 a_Position;
05-24 12:59:54.558: V/ShaderHelper(2203): void main()
05-24 12:59:54.558: V/ShaderHelper(2203): {
05-24 12:59:54.558: V/ShaderHelper(2203):   gl_Position = u_Matrix * a_Position;
05-24 12:59:54.558: V/ShaderHelper(2203):
05-24 12:59:54.558: V/ShaderHelper(2203): }
05-24 12:59:54.558: V/ShaderHelper(2203): :WARNING: 0:2: '#extension' :  'GL_OES_element_index_uint' is not supported
05-24 12:59:54.558: V/ShaderHelper(2203): Results of compiling source:
05-24 12:59:54.558: V/ShaderHelper(2203): #version 150
05-24 12:59:54.558: V/ShaderHelper(2203): #extension GL_OES_element_index_uint : enable
05-24 12:59:54.558: V/ShaderHelper(2203): #ifdef GL_FRAGMENT_PRECISION_HIGH
05-24 12:59:54.558: V/ShaderHelper(2203):   precision highp float;
05-24 12:59:54.558: V/ShaderHelper(2203): #else
05-24 12:59:54.558: V/ShaderHelper(2203):   precision mediump float;
05-24 12:59:54.558: V/ShaderHelper(2203): #endif
05-24 12:59:54.558: V/ShaderHelper(2203): //precision mediump float;
05-24 12:59:54.558: V/ShaderHelper(2203): uniform vec4 u_Color;
05-24 12:59:54.558: V/ShaderHelper(2203): void main()
05-24 12:59:54.558: V/ShaderHelper(2203): {
05-24 12:59:54.558: V/ShaderHelper(2203):   gl_FragColor = u_Color;
05-24 12:59:54.558: V/ShaderHelper(2203): }
05-24 12:59:54.558: V/ShaderHelper(2203): :WARNING: 0:2: '#extension' :  'GL_OES_element_index_uint' is not supported
05-24 12:59:54.578: V/ShaderHelper(2203): Results of linking program:
05-24 12:59:54.578: V/ShaderHelper(2203): Results of validating program: 1
05-24 12:59:54.578: V/ShaderHelper(2203): Log:

最佳答案

最后,我在真实设备上运行了应用程序。我认为问题在于PC的GPU中未实现“ GL_OES_element_index_uint”扩展,因此仿真器无法将该扩展转换为HOST GPU。

如果您尝试在主机GPU中使用openGL ES扩展(OES_extensions),则该模拟器似乎无用,因为PC的GPU无法理解这些扩展。

10-07 19:15
查看更多