我有一個Android應用程序使用GLSurfaceView
進行渲染。該應用程序適用於我們所有的設備,除了一個:我們Zenfone豪華2.在我們GLSurfaceView
構造我做在Zenfone Deluxe 2上使用setEGLConfigChooser時OpenGL應用程序崩潰
setEGLConfigChooser(
8, 8, 8, 8, // rgba
24, // depth
8); // stencil
這始終工作除了Zenfone豪華2它崩潰,給下面的堆棧跟蹤:
10-13 10:37:07.975 10066-10066/com.my.company.demo V/Monotype: SetAppTypeFace- try to flip, app = com.my.company.demo
10-13 10:37:07.975 10066-10066/com.my.company.demo V/Monotype: Typeface getFontPathFlipFont - systemFont = default#default
10-13 10:37:08.045 10066-10066/com.my.company.demo W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
10-13 10:37:08.065 10066-10066/com.my.company.demo V/Monotype: SetAppTypeFace- try to flip, app = com.my.company.demo
10-13 10:37:08.065 10066-10066/com.my.company.demo V/Monotype: Typeface getFontPathFlipFont - systemFont = default#default
10-13 10:37:08.335 10066-10107/com.my.company.demo D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
10-13 10:37:08.405 10066-10107/com.my.company.demo I/OpenGLRenderer: Initialized EGL, version 1.4
10-13 10:37:08.405 10066-10107/com.my.company.demo W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
10-13 10:37:08.415 10066-10105/com.my.company.demo E/AndroidRuntime: FATAL EXCEPTION: GLThread 1298
Process: com.my.company.demo, PID: 10066
java.lang.RuntimeException: createContext failed: EGL_BAD_CONFIG
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1196)
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1187)
at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1037)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1404)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1243)
因此,我只是取消了對setEGLConfigChooser
的調用,然後應用程序運行良好。 OpenGL然後給我RGBB的(8, 8, 8, 0)
,深度緩衝區的24
以及模板緩衝區的8
。好的,那麼我將這些值設置爲setEGLConfigChooser
,但是應用仍然會以相同的輸出崩潰。
我不知道該怎麼做或如何解決它。該documentation爲setEGLConfigChooser
狀態
安裝配置選擇器將選擇一個配置至少指定depthSize和stencilSize,並具有完全相同的指定redSize,greenSize,blueSize和alphaSize。
如果調用此方法,則必須在調用setRenderer(Renderer)之前調用該方法。
如果未調用setLCLConfigChooser方法,那麼默認情況下視圖將選擇深度緩衝區深度至少爲16位的RGB_888表面。
對此問題沒有多大幫助。可能是什麼問題?我非常希望能夠以更通用的方式調用setEGLConfigChooser
來定位所有設備。
更多設備信息:
的Zenfone豪華2是具有的PowerVR盜賊G6430 GPU x86的設備。我已經下載並安裝了最新的軟件更新。
gl10.glGetString(GL10.GL_VENDOR);
給"Imagination Technologies"
gl10.glGetString(GL10.GL_RENDERER);
給"PowerVR Rogue G6430"
gl10.glGetString(GL10.GL_VERSION);
給"OpenGL ES 3.1 build [email protected]"
gl10.glGetString(GL10.GL_EXTENSIONS);
給GL_EXT_debug_marker GL_EXT_blend_minmax GL_EXT_color_buffer_float GL_EXT_copy_image GL_EXT_discard_framebuffer GL_EXT_draw_buffers GL_EXT_draw_buffers_indexed GL_EXT_geometry_shader GL_EXT_geometry_point_size GL_EXT_gpu_shader5 GL_EXT_multi_draw_arrays GL_EXT_multisampled_render_to_texture GL_EXT_occlusion_query_boolean GL_EXT_primitive_bounding_box GL_EXT_pvrtc_sRGB GL_EXT_read_format_bgra GL_EXT_robustness GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_io_blocks GL_EXT_shader_pixel_local_storage GL_EXT_shader_texture_lod GL_EXT_shadow_samplers GL_EXT_tessellation_shader GL_EXT_tessellation_point_size GL_EXT_texture_border_clamp GL_EXT_texture_buffer GL_EXT_texture_cube_map_array GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_sRGB_decode GL_IMG_multisampled_render_to_texture GL_IMG_program_binary GL_IMG_read_format GL_IMG_shader_binary GL_IMG_texture_compression_pvrtc GL_IMG_texture_compression_pvrtc2 GL_IMG_texture_format_BGRA8888 GL_IMG_texture_npot GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_KHR_debug GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_depth_texture GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_EGL_sync GL_OES_element_index_uint GL_OES_fragment_precision_high GL_OES_draw_buffers_indexed GL_OES_get_program_binary GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_required_internalformat GL_OES_rgb8_rgba8 GL_OES_sample_shading GL_OES_sample_variables GL_OES_shader_image_atomic GL_OES_shader_multisample_interpolation GL_OES_standard_derivatives GL_OES_surfaceless_context GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_npot GL_OES_texture_stencil8 GL_OES_texture_storage_multisample_2d_array GL_OES_vertex_array_object GL_OES_vertex_half_float
我的問題不是關於選擇哪個值,而是關於'setEGLConfigChooser'中的某個特定設備的崩潰,而我的其他設備在調用時會工作。它也會在使用與設備在不調用'setEGLConfigChooser'時完全相同的配置時崩潰。 –
EGL_BAD_CONFIG絕對意味着由於您傳入的配置不正確而導致崩潰。所以這意味着你必須小心你可以選擇的值。 – andras