Page 1 of 1

[ios]Object at the back was rendered to the front on device

Posted: Sun Jan 05, 2014 7:55 am
by wisp
hi,

I created two planes and set glsles shaders that just output a color. But when I moved the camera, some parts of the plane at the back were rendered to the front, just like they were on the same plane, There was enough distance between two planes, and some other objects on the plane had the same situation. This just happened on device.

I've tried to set DepthCheckEnabled to false, that situation didn't happened, but some parts of other object on the plane disappeared.

I'm using OGRE 1.9 , ios7, glsles2.0 and ipad air

Does anyone have an idea?
Thanks in advance!

Re: [ios]Object at the back was rendered to the front on dev

Posted: Mon Jan 06, 2014 10:01 am
by masterfalcon
Could you give some code that replicates the issue? Do you see any errors in the log? Have you tried the same code on a desktop?

Re: [ios]Object at the back was rendered to the front on dev

Posted: Mon Jan 06, 2014 1:35 pm
by wisp
Sorry, I can not paste code here for some reason, I use the ogre Xcode 4 templates code, and make some changes, and I'm using Xcode 5. Could you show me some special code I should take care? and i can type my code here.

There is one error about texture in the log.

Error loading texture spheremap.png. Texture layer will be blank.

And I have another problem with running SimpleBrowse. It just shows a black screen. There are some errors in the log like this:

object unsurpported by render system in OffsetMapping.material(35): shader name : Examples/OffsetMappingPSAsm.
Compiler error : unknown error in RTShaderSystem.material(23):token class, rtshader_system, unrecognized.

I don't know whether I have compiled ogre correctly, but my code worked fine with those .a files, except the problem above.

I have not tried the code on a desktop, and I'll try it later. it seems ok on simulator.

Re: [ios]Object at the back was rendered to the front on dev

Posted: Mon Jan 06, 2014 3:29 pm
by wisp
I've solved this problem. It's about the shader files.

When I change "precision mediump float" to "precision highp float", it works. But why? Should 64bit system use higher precision?

Re: [ios]Object at the back was rendered to the front on dev

Posted: Mon Jan 06, 2014 4:16 pm
by c6burns
http://www.khronos.org/registry/gles/sp ... 1.0.17.pdf

Check the section on precision and precision qualifiers. It has nothing to do with your CPU. It's a performance feature to allow you to implement lower precision (and thus better performing) variables in your shaders.

Re: [ios]Object at the back was rendered to the front on dev

Posted: Tue Jan 07, 2014 3:06 am
by wisp
I'll read more about it, and thanks, c6burns.