Greetings long time no post,
I posted this on the apple developer website yesterday but seeing as they only appear to get 1 topic per day in the gl forum, the site looks a bit dead, Ill try here
If I run the code on the IOS device I get the two following errors
GL_INVALID_ENUM <- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE)
[LEFT]GL_INVALID_ENUM <- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL)
When I run the run example on the IOS device the depthtexture is being treated as a standard rgba texture, but on the IOS simulator its being treated as a depthtexture
Im pretty sure Ive got everything set up correct (though theres a total lack of shadowmapping examples using a depthtexture on the web for IOS)
if I run in the IOS simulator then no errors
this may be related. In both the simulator & the device I get the following message 2012-07-08 11:41:16.477 RollyBolly[1402:11003] Program validate log: Validation Error: Program does not contain vertex shader. Results will be undefined. Validation Error: Program does not contain fragment shader. Results will be undefined. (sounds major right) but it works correct on the IOS simulator
Things to try:
Make sure filtering is GL_NEAREST, and set before the compare mode;
Try doing the ref comparison manually.
glTexParameterf instead of glTexParameteri, the enum handling might have been forgotten in the i version.
The programs compile & link even though this gets reported back (both IOS & simulator) Validation Error: Program does not contain vertex shader. Results will be undefined. Validation Error: Program does not contain fragment shader. Results will be undefined. I would expect the shader not to work based on this text, but it works 100% correct on simulator (boolean result) but on the device the depthtexture is a colortexture
float shadow = shadow2DProjEXT( TEX7, v_shadowCoord ); on simulator returns 0.0 or 1.0
on device it returns between 0.0 and 1.0 i.e. a grey color
if you’ve included the proper headers, GL_COMPARE_REF_TO_TEXTURE should not compile. You meant GL_COMPARE_REF_TO_TEXTURE_EXT, since this functionality is an extension to ES2.
what device are you using, and does it export EXT_shadow_samplers?
@Ilian yes
float shadow = (v_shadowCoord.z / v_shadowCoord.w <= texture2DProj(TEX7, v_shadowCoord).x ) ? 1.0 : 0.0;
works but this is obviously gonna be much slower than
float shadow = shadow2DProjEXT( TEX7, v_shadowCoord );
I wouldnt mind if it was only a few objects/fragments onscreen, but this is gonna be applied to practically every pixel, and the powervr hardware aint exactly fast to start with
Surely someone heres using GL_OES_depth_texture on IOS hardware, is it working for them?
@arekkusuyes see the above code Im using _EXT, I think the apple profiler program strips off the _EXT etc tags when reporting the error
ipod touch 4, yes heres the extension string
GL_OES_depth_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_float GL_OES_texture_half_float GL_OES_vertex_array_object GL_EXT_blend_minmax GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_EXT_separate_shader_objects GL_EXT_shader_texture_lod GL_EXT_texture_filter_anisotropic GL_APPLE_framebuffer_multisample GL_APPLE_rgb_422 GL_APPLE_texture_format_BGRA8888 GL_APPLE_texture_max_level GL_IMG_read_format GL_IMG_texture_compression_pvrtc
cheers arekkusuI think youre right I saw GL_OES_depth_texture & assumed shadowmapping is supported (as the original & most common usage of depth textures is shadowmapping), its a bit crazy why they dont
…as a side note, SGX GLES1/2 drivers on IOS are going to behave differently than on any other device often… essentially from Apple putting their pixie dust on the GLES1/2 implementations… also the “GL_EXT_separate_shader_objects” of GLES1/2 is not at all the same as GL_EXT_separate_shader_objects of OpenGL… it is more like GL_ARB_separate_shader_objects but not quite the same either (I think)…
thanks for that Ilian @kRogue yes Ive come across a few things with the powervr hardware that you have to do differently esp if you want to have decent performance