-- |Fill a buffer with data from a 'ForeignPtr'. The application
-- @fromForeignPtr target len fptr@ fills a @target@ 'BufferTarget'
-- with @len@ elements starting from @fptr@.
fromForeignPtr :: forall a. Storable a => 
                  BufferTarget -> Int -> ForeignPtr a -> IO BufferObject
fromForeignPtr target len fptr = withForeignPtr fptr $ fromPtr target numBytes
  where numBytes = sizeOf (undefined::a) * len

-- |Fill a buffer with data from a 'V.Vector'.
fromForeignPtr :: forall a. Storable a => 
                  BufferTarget -> Int -> ForeignPtr a -> IO BufferObject
fromForeignPtr target len fptr = withForeignPtr fptr $ fromPtr target numBytes
  where numBytes = sizeOf (undefined::a) * len

-- |Fill a buffer with data from a 'V.Vector'.
fromForeignPtr target len fptr = withForeignPtr fptr $ fromPtr target numBytes
  where numBytes = sizeOf (undefined::a) * len

-- |Fill a buffer with data from a 'V.Vector'.