-- | Initializes a buffer object.
initializeBuffer :: (Storable a) => BufferTarget -> [a] -> IO BufferObject
initializeBuffer t array = do
    buffer <- genObjectName
    bindBuffer t $= Just buffer

    withArray array $ \ptr -> do
        bufferData t $= (fromIntegral $ arrayByteSize array, ptr, StaticDraw)

    bindBuffer ElementArrayBuffer $= Nothing
    return buffer


-- | Initializes OpenGL objects.
initializeBuffer :: (Storable a) => BufferTarget -> [a] -> IO BufferObject
initializeBuffer t array = do
    buffer <- genObjectName
    bindBuffer t $= Just buffer

    withArray array $ \ptr -> do
        bufferData t $= (fromIntegral $ arrayByteSize array, ptr, StaticDraw)

    bindBuffer ElementArrayBuffer $= Nothing
    return buffer


-- | Initializes OpenGL objects.
initializeBuffer t array = do
    buffer <- genObjectName
    bindBuffer t $= Just buffer

    withArray array $ \ptr -> do
        bufferData t $= (fromIntegral $ arrayByteSize array, ptr, StaticDraw)

    bindBuffer ElementArrayBuffer $= Nothing
    return buffer


-- | Initializes OpenGL objects.