summaryrefslogtreecommitdiff
path: root/src/LambdaCube
diff options
context:
space:
mode:
authorCsaba Hruska <csaba.hruska@gmail.com>2016-02-24 00:36:30 +0100
committerCsaba Hruska <csaba.hruska@gmail.com>2016-02-24 00:36:30 +0100
commit58c2fbe70b78a2e8d9f5b4d8e79b7b39d0b9c1b6 (patch)
treec28d89e97802d9bc43e9c3310c5bae54159ad497 /src/LambdaCube
parentc7c3fb7a7f8a4d4fc8677ab78317e9e5ac0ac092 (diff)
improve texture uploading
Diffstat (limited to 'src/LambdaCube')
-rw-r--r--src/LambdaCube/GL/Data.hs18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/LambdaCube/GL/Data.hs b/src/LambdaCube/GL/Data.hs
index c1e2737..56955d1 100644
--- a/src/LambdaCube/GL/Data.hs
+++ b/src/LambdaCube/GL/Data.hs
@@ -68,20 +68,10 @@ uploadTexture2DToGPU = uploadTexture2DToGPU' True False True False
68uploadTexture2DToGPU' :: Bool -> Bool -> Bool -> Bool -> DynamicImage -> IO TextureData 68uploadTexture2DToGPU' :: Bool -> Bool -> Bool -> Bool -> DynamicImage -> IO TextureData
69uploadTexture2DToGPU' isFiltered isSRGB isMip isClamped bitmap' = do 69uploadTexture2DToGPU' isFiltered isSRGB isMip isClamped bitmap' = do
70 let bitmap = case bitmap' of 70 let bitmap = case bitmap' of
71 ImageRGB8 i@(Image w h _) -> bitmap' -- pixelFoldMap (\(PixelRGB8 r g b) -> [PixelRGBA8 r g b maxBound]) i 71 ImageRGB8 i@(Image w h _) -> bitmap'
72 ImageRGBA8 i@(Image w h _) -> bitmap' -- pixelFoldMap (\(PixelRGBA8 r g b a) -> [PixelRGBA8 r g b a]) i 72 ImageRGBA8 i@(Image w h _) -> bitmap'
73 ImageYCbCr8 i@(Image w h _) -> ImageRGB8 $ convertImage i -- $ Image w h $ SV.fromList $ pixelFoldMap (\p -> let PixelRGB8 r g b = convertPixel p in [PixelRGBA8 r g b maxBound]) i 73 ImageYCbCr8 i@(Image w h _) -> ImageRGB8 $ convertImage i
74 ImageCMYK16 _ -> error "uploadTexture2DToGPU: ImageCMYK16" 74 di -> ImageRGBA8 $ convertRGBA8 di
75 ImageCMYK8 _ -> error "uploadTexture2DToGPU: ImageCMYK8"
76 ImageRGBA16 _ -> error "uploadTexture2DToGPU: ImageRGBA16"
77 ImageRGBF _ -> error "uploadTexture2DToGPU: ImageRGBF"
78 ImageRGB16 _ -> error "uploadTexture2DToGPU: ImageRGB16"
79 ImageYA16 _ -> error "uploadTexture2DToGPU: ImageYA16"
80 ImageYA8 _ -> error "uploadTexture2DToGPU: ImageYA8"
81 ImageYF _ -> error "uploadTexture2DToGPU: ImageYF"
82 ImageY16 _ -> error "uploadTexture2DToGPU: ImageY16"
83 ImageY8 _ -> error "uploadTexture2DToGPU: ImageY8"
84 _ -> error "uploadTexture2DToGPU: unknown image"
85 75
86 glPixelStorei GL_UNPACK_ALIGNMENT 1 76 glPixelStorei GL_UNPACK_ALIGNMENT 1
87 to <- alloca $! \pto -> glGenTextures 1 pto >> peek pto 77 to <- alloca $! \pto -> glGenTextures 1 pto >> peek pto