withImage :: (PixelData (Color3 GLubyte) -> IO ()) -> IO ()
withImage act =
   withArray [ Color3 (s * 17) (t * 17) (r * 17) |
               r <- [ 0 .. fromIntegral d - 1 ],
               t <- [ 0 .. fromIntegral h - 1 ],
               s <- [ 0 .. fromIntegral w - 1 ] ] $
   act . PixelData RGB UnsignedByte
   where (TextureSize3D w h d) = imageSize
withImage :: (PixelData (Color3 GLubyte) -> IO ()) -> IO ()
withImage act =
   withArray [ Color3 (s * 17) (t * 17) (r * 17) |
               r <- [ 0 .. fromIntegral d - 1 ],
               t <- [ 0 .. fromIntegral h - 1 ],
               s <- [ 0 .. fromIntegral w - 1 ] ] $
   act . PixelData RGB UnsignedByte
   where (TextureSize3D w h d) = imageSize
withImage act =
   withArray [ Color3 (s * 17) (t * 17) (r * 17) |
               r <- [ 0 .. fromIntegral d - 1 ],
               t <- [ 0 .. fromIntegral h - 1 ],
               s <- [ 0 .. fromIntegral w - 1 ] ] $
   act . PixelData RGB UnsignedByte
   where (TextureSize3D w h d) = imageSize