I want to convert a Double to a GLfloat. I want to use it for comparations.
xM <- newIORef 0.0
zM <- newIORef 0.0
mobs <- newIORef []
mapM_ (\x -> colision x xM) mobs
mobs is fulled with a method.
colision mob xC = do
xcama <- get xC
--zcama <- get zC
let menor = mob!!0
let mayor = mob!!7
--if xm>= xmin && xm <= xmax && zm >= zmin && zm <= zmax then renderText (1, (-1.4)) $ "Dead"
--else renderText (1, (-1.4)) $ "Warning..."
renderText (1, (-1.4)) $ "Warning..."
When I try to compile it show me this error:
"Couldn't match type 'Foreign.C.Types.CDouble' with 'Foreign.C.Types.CFloat' Expected type :GLfloat
Actual type: GLdouble
-----Solution:------
I use this code:
import GHC.Float
d2f = realToFrac :: GLdouble -> GLfloat
import GHC.Float
, asrealToFrac
is a standard Haskell function reexported from thePrelude
. – Ørjan Johansen