gordonpagan's picture

Are float variables only allowed using OpenTK with Monotouch for Ipads/Iphones

I am developing stuff for use on Ipads and Iphones. I use OpenTK with Monotouch to get code which loads down to these devices. I am impressed that things work however I have an accuracy problem because I am confined to using 'FLOAT' arrays. The data renders very inaccurately and this is because I need 10 sig figs or more. There are very good reasons of synchronisation why I must use this coordinate system. The irritating line is:-

GL.VertexPointer(3,All.Float,0, positionarray.ToArray());

Unfortunately All.Double does not seem available in the All enumeration.

Off course a solution could be to find an average position and recode so that the positionarray only have very small numbers that are differences from the average value. I could then recombine them when the array is rendered just by doing a translation. However I am not clear that I will still get the same problem as OPENTK has to add the two quantities and saving them in new Float values. The result maybe the same as the resulting significant digits get reduced to 6 or 7.

Before I embark on on trying this step, I would certainly welcome anyone's opinion on this.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tksuoran's picture

Mobile devices are unlikely to support doubles at this time. Even if you manage to feed doubles to the API, it is possible that the implementation will convert doubles to something else, like floats - or you get poor performance.

gordonpagan's picture

Thank you for that. However I do not think that internally the Graphics card in the mobile device uses anything but doubles (or even greater precision per value). I got around this problem by finding an average position (any point within your model would do in fact). I took this average value away from all vertex values. When I rendered the model, I did a GL.Translate(ave.X,ave.Y,ave.Z) before drawing the model. This did the trick. The model was correctly rendered. By deduction I would say that internal to the graphics card greater than Float precision must be used otherwise I would be looking again at a very ragged drawing.