混合在Desire HD和A500 Tab上的工作方式不同

时间:2012-02-09 21:45:05

标签: android opengl-es tablet libgdx blending

我正在使用libgdx以及gdxlw制作动态壁纸,这是一个基于libgdx的小框架,可以更容易地使用OpenGL制作动态壁纸。

首先,我确保我没有使用GL20。我希望尽可能地保持GL10 / GL11。我正在使用简单的OrthographicCamera。

我做的每个渲染电话:

1 ... 使用

gl11.glClearColor(1, 1, 1, 1);

gl11.glClear(GL11.GL_COLOR_BUFFER_BIT);

我用白色填充屏幕。

2 ... 我使用SpriteBatch和

在顶部绘制一个黑色方块

batch.setBlendFunction(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

3 ... 除此之外,我使用SpriteBatch和

绘制一个大的(通常是缩放的)图像

batch.setBlendFunction(GL11.GL_DST_COLOR, GL11.GL_ONE_MINUS_DST_COLOR);

然后只绘制那个已经是黑色而不是白色的大图像。它按照我的预期工作,非常适合我的项目。

这完全适用于我的HTC Desire HD(Android 2.3.5)。但是,当我在Acer Iconia A500平板电脑(Android 3.2.1)上运行相同的应用程序时,无需混合即可在黑白背景上绘制大图像。

无论我在绘制大图像时尝试更改混合,结果总是相同的。黑色正方形是不可见的,它应该是。大图像只是在它上方推土机。

我能做错什么? 我可以错过什么吗?

有一点需要注意的是,我尝试在(之后)绘制一些随机精灵,用各种混合绘制大图像,这证明事实上不同种类的混合确实起作用。换句话说,混合并未完全禁用。

混合时,大图像的行为与较小图像的行为不同吗?

另一个有趣的事情是,当我在大图像上使用线性滤波时,你实际上可以非常模糊地画出黑色方块。但是,使用最近的过滤不可见。

请原谅我疑惑的问题;我现在唯一想到的是“为什么会这样?”我一整天都把头发拉过来,尝试了很多方法但没有成功。

libgdx与平板电脑或Android 3 +不兼容吗?我找不到任何引用。

gdxlw是罪魁祸首吗?

编辑:我做了一些测试,发现如果我改变应用程序使用GL20而不是GL11,我的Desire HD会得到与我的Acer Iconia A500相同的结果。也就是说,我看到我的大图像,非常(!)模糊地看到它背后的黑色。

另外,我正在查看我的 logcat在Acer Iconia A500平板电脑上运行GL11版本。它声明......

02-10 10:58:19.010: D/libEGL(9907): loaded /system/lib/egl/libGLES_android.so
02-10 10:58:19.020: D/libEGL(9907): loaded /system/lib/egl/libEGL_tegra.so
02-10 10:58:19.040: I/DEBUG(81): tid 9915 does not exist in pid 9893. ignoring debug request
02-10 10:58:19.040: D/libEGL(9907): loaded /system/lib/egl/libGLESv1_CM_tegra.so
02-10 10:58:19.040: D/libEGL(9907): loaded /system/lib/egl/libGLESv2_tegra.so
02-10 10:58:19.050: D/QuickLog(9907): checkGL20 is: true
02-10 10:58:19.080: D/HAL(9907): [HAL] hw_get_module:share library path:/system/lib/hw/gralloc.tegra.so
02-10 10:58:19.290: D/HAL(9907): [HAL] hw_get_module:share library path:/system/lib/hw/gralloc.tegra.so
02-10 10:58:19.290: D/AndroidGraphics(9907): GL20: true
02-10 10:58:19.300: D/AndroidGraphics(9907): OGL renderer: NVIDIA AP
02-10 10:58:19.300: D/AndroidGraphics(9907): OGL vendor: NVIDIA Corporation
02-10 10:58:19.300: D/AndroidGraphics(9907): OGL version: OpenGL ES-CM 1.1
02-10 10:58:19.300: D/AndroidGraphics(9907): OGL extensions: GL_EXT_bgra GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_s3tc GL_EXT_texture_format_BGRA8888 GL_NV_texture_npot_2D_mipmap GL_OES_byte_coordinates GL_OES_compressed_ETC1_RGB8_texture GL_OES_compressed_paletted_texture GL_OES_draw_texture GL_OES_extended_matrix_palette GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_fbo_render_mipmap GL_OES_fixed_point GL_OES_framebuffer_object GL_OES_matrix_get GL_OES_matrix_palette GL_OES_point_size_array GL_OES_point_sprite GL_OES_query_matrix GL_OES_read_format GL_OES_rgb8_rgba8 GL_OES_single_precision GL_OES_stencil8 GL_OES_texture_cube_map GL_OES_vertex_half_float 
02-10 10:58:19.300: D/AndroidGraphics(9907): framebuffer: (5, 6, 5, 0)
02-10 10:58:19.300: D/AndroidGraphics(9907): depthbuffer: (16)
02-10 10:58:19.300: D/AndroidGraphics(9907): stencilbuffer: (0)

...对我来说听起来像是按照预期使用OpenGL ES 1.1。我无法找到有关“CM”代表什么的信息。但是,查看我的Desire HD logcat 运行相同的应用程序版本:

02-10 11:04:16.515: D/AndroidGraphics(10851): GL20: true
02-10 11:04:16.525: D/AndroidGraphics(10851): OGL renderer: Adreno 205
02-10 11:04:16.525: D/AndroidGraphics(10851): OGL vendor: Qualcomm
02-10 11:04:16.525: D/AndroidGraphics(10851): OGL version: OpenGL ES-CM 1.1
02-10 11:04:16.525: D/AndroidGraphics(10851): OGL extensions: GL_AMD_compressed_3DC_texture GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_APPLE_texture_2D_limited_npot GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_OES_blend_equation_separate GL_OES_blend_func_separate GL_OES_blend_subtract GL_OES_compressed_ETC1_RGB8_texture GL_OES_compressed_paletted_texture GL_OES_depth_texture GL_OES_draw_texture GL_OES_framebuffer_object GL_OES_matrix_palette GL_OES_packed_depth_stencil GL_OES_point_size_array GL_OES_point_sprite GL_OES_read_format GL_OES_rgb8_rgba8 GL_OES_stencil_wrap GL_OES_EGL_image GL_OES_texture_cube_map GL_OES_texture_env_crossbar GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_texture_mirrored_repeat GL_QCOM_binning_control GL_QCOM_extended_get GL_QCOM_tiled_rendering 
02-10 11:04:16.535: D/AndroidGraphics(10851): framebuffer: (5, 6, 5, 0)
02-10 11:04:16.535: D/AndroidGraphics(10851): depthbuffer: (16)
02-10 11:04:16.535: D/AndroidGraphics(10851): stencilbuffer: (0)

...它声明它使用与平板电脑相同的OpenGL版本。

如果两个版本的版本相同,那么两个实现是否应该完全相同?

硬件,一个是Nvidia Tegra和另一个高通,会有所作为吗?

OpenGL 1.1是否在Tegra设备上以某种方式模拟“不完美”?

我也看到“OGL扩展”列表有所不同。例如,搜索包含“混合”的任何内容,我在我的欲望高清上找到了GL_OES_blend_equation_separateGL_OES_blend_func_separateGL_OES_blend_subtract,而在我的A500上,我找不到任何内容。

如果问题出在这些扩展中,我可以如何(如果可能)解决这个问题?

编辑:好的,现在我按照我想要的方式工作,但我只使用GL20。我仍然希望尽可能使用GL10或GL11解决问题,但是,因为我希望更多的设备能够运行该应用程序。

0 个答案:

没有答案