summaryrefslogtreecommitdiff
path: root/src/LambdaCube/GL/Util.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-04-30 12:00:46 -0400
committerJoe Crayne <joe@jerkface.net>2019-05-06 19:44:07 -0400
commitfcf51c414e06ff24e7f2ec350ef0cef20b6238d2 (patch)
tree2a22c83cd3bd333667a729b66e13488816c93acd /src/LambdaCube/GL/Util.hs
parent154b25e0ad8a8ecedb02876215d29c12e87e6c93 (diff)
TextureCube support.
Diffstat (limited to 'src/LambdaCube/GL/Util.hs')
-rw-r--r--src/LambdaCube/GL/Util.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/LambdaCube/GL/Util.hs b/src/LambdaCube/GL/Util.hs
index 071e86b..1320f7d 100644
--- a/src/LambdaCube/GL/Util.hs
+++ b/src/LambdaCube/GL/Util.hs
@@ -141,7 +141,8 @@ instance Uniformable (V3 V4F) where uniformContexts _ = contexts $ supports Type
141instance Uniformable (V4 V4F) where uniformContexts _ = contexts $ supports TypeM44F 141instance Uniformable (V4 V4F) where uniformContexts _ = contexts $ supports TypeM44F
142 142
143 143
144instance Uniformable TextureData where uniformContexts _ = DMap.empty -- TODO 144instance Uniformable TextureData where uniformContexts _ = DMap.empty
145instance Uniformable TextureCubeData where uniformContexts _ = DMap.empty
145 146
146mkU :: GLData a c => TypeTag c -> a -> IO GLUniform 147mkU :: GLData a c => TypeTag c -> a -> IO GLUniform
147mkU ty a = GLTypedUniform ty <$> newIORef (GLUniformValue a) 148mkU ty a = GLTypedUniform ty <$> newIORef (GLUniformValue a)
@@ -177,8 +178,9 @@ initializeUniform t = case witnessType t of
177 TypeM44F -> mkU ty (V4 z4 z4 z4 z4) 178 TypeM44F -> mkU ty (V4 z4 z4 z4 z4)
178 179
179 Nothing -> case t of 180 Nothing -> case t of
180 FTexture2D -> GLUniform t <$> newIORef (TextureData 0) 181 FTexture2D -> GLUniform <$> newIORef (Texture2DName 0)
181 _ -> fail $ "initializeUniform: " ++ show t 182 FTextureCube -> GLUniform <$> newIORef (TextureCubeName 0)
183 _ -> fail $ "initializeUniform: " ++ show t
182 184
183 185
184data TypeMismatch c a = TypeMismatch 186data TypeMismatch c a = TypeMismatch