Friday, 15 June 2012

c++ - OpenGL ES Depth Buffer rendering (iOS simulator VS real device) -


While providing a depth buffer with an iOS simulator, that's fine. But rendering on the real device gives bad results: Depth is provided with only a few values ​​(no fade) such as when you display an image in a 256 value color range.

Here the code is FBO generation:

  Glaginfreafbuffers (1, and View FBO); Glencutters (2, texture_scine); GlobeTechnologies (GL_EducationEndy, Texture_scine [0]); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); GltexPamerMarty (GL_EducationEd.D., GL_Whartwor_Wapper, GLCLAMPMOODEGEG); GlTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, widthResolution, heightResolution, 0, GL_RGBA, GL_ UNSIGNED_BYTE, NULL); Globbdenactation (GL_EnglishEddi, Texture_scine [1]); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); GltexPamerMarty (GL_EducationEd.D., GL_Whartwor_Wapper, GLCLAMPMOODEGEG); GlTexImage2D (GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, widthResolution, heightResolution, 0, GL_DEPTH_COMPONENT, GL_UnSIGNED_INT, NULL); // TODO: Can not GL_DEPTH_COMPONENT GL_ UNSIGNED_BYTE? GlobeFramebuffer (GL_FRAMBFF, CNFBO); Glaufmeshbutterfecture 2D (GL_Framabuffer, GL_Color_ATATTT0, GL_TEXTURE_2D, Texture_scene [0], 0); Glowframebutterations2D (GL_framebuafer, GL_DEPT_ATATTitimation, GL_ITORRDD, Texture_scine [1], 0);  

It seems that the working value for GL_DEPTH_ATTACHMENT fbo is GL_UNSIGNED_INT but it is not enough to render the depth ...

PS: To get the right depth, I do not want to re-display the view in z-values ​​in a GL_ COLOR_ATTACHMENT0 (for performance reasons) and do not use OpenGL ES 3.0 or newer metal (iPhone 4S support).

Any ideas?

There is no depth buffer support in ES1 or 2. View the answer to this question:


No comments:

Post a Comment