Skip to main content

Posts

Showing posts with the label float

Accurately Converting NSString to GLFloat - iPhone

Say I have some vertice values which I am reading into my app as a NSString : -7501.6 -6198.2 834.939 -5547.66 -6348.32 2122.65 The values in the source are always 6 figures in length. I need to pass these exact values to OpenGL. If I try to cast as a float (using NSString floatValue) then, as expected, I get an approximate value for each float due to the inexact nature of a float : -7501.600098, -6198.200195, 834.939026 -5547.660156, -6348.319824, 2122.649902 Can anyone suggest a way that I can get these values into OpenGL and retain their exact initial integrity ? Thank you.