android - Dots on depth image -



android - Dots on depth image -

i'm trying depth buffer on android device (nexus 7). because cannot attach depth buffer (opengl es), i've tried utilize shaders in order encode depth values in g , b components of color buffer. shaders :

static const char gvertexshader[] = "varying vec2 texcoord; \n" "void main() \n" "{ \n" " gl_position = gl_modelviewprojectionmatrix * gl_vertex; \n" " texcoord = gl_multitexcoord0.xy/gl_multitexcoord0.w; \n" "} \n"; static const char gfragmentshader[] = #ifdef __android__ "precision highp float; \n" #endif "uniform sampler2d modeltexture; \n" "varying vec2 texcoord; \n" "void main() \n" "{ \n" " gl_fragcolor.r = texture2d(modeltexture, texcoord).r; \n" " float depth = gl_fragcoord.z; \n" " gl_fragcolor.g = depth; \n" " gl_fragcolor.b = depth; \n" " gl_fragcolor.a = 1.0; \n" "} \n";

on pc, results ok (it should city buildings faces, same depth each), image g channel:

but on android, results has texture of "dots" on it, meaning closer pixels :

the android configuration :

egl_buffer_size: 32 egl_alpha_size: 8 egl_blue_size: 8 egl_green_size: 8 egl_red_size: 8 egl_depth_size: 16 egl_stencil_size: 0 egl_config_caveat: 12344 egl_config_id: 25 egl_level: 0 egl_max_pbuffer_height: 2048 egl_max_pbuffer_pixels: 4194304 egl_max_pbuffer_width: 2048 egl_native_renderable: 0 egl_native_visual_id: 1 egl_native_visual_type: -1 egl_samples: 0 egl_sample_buffers: 0 egl_surface_type: 3175 egl_transparent_type: 12344 egl_transparent_red_value: 0 egl_transparent_green_value: 0 egl_transparent_blue_value: 0 egl_bind_to_texture_rgb: 0 egl_bind_to_texture_rgba: 0 egl_min_swap_interval: 1 egl_max_swap_interval: 1 egl_luminance_size: 0 egl_alpha_mask_size: 8 egl_color_buffer_type: 12430 egl_renderable_type: 4 egl_conformant: 4

what cause ? there way read depth buffer on android device ?

try disabling dithering:

gles20.gldisable(gles20.gl_dither);

android opengl-es depth-buffer

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -