@@ -139,11 +139,10 @@ makeUniformVar :: (UniformComponent a, Storable (b a))
139
139
=> (UniformLocation -> b a -> IO () )
140
140
-> UniformLocation -> StateVar (b a )
141
141
makeUniformVar setter location = makeStateVar getter (setter location)
142
- where getter = do
143
- program <- fmap fromJust $ get currentProgram
144
- allocaBytes maxUniformBufferSize $ \ buf -> do
145
- getUniform program location buf
146
- peek buf
142
+ where getter = do program <- fmap fromJust $ get currentProgram
143
+ allocaBytes maxUniformBufferSize $ \ buf -> do
144
+ getUniform program location buf
145
+ peek buf
147
146
148
147
instance UniformComponent a => Uniform (Vertex2 a ) where
149
148
uniform = makeUniformVar $ \ location (Vertex2 x y) -> uniform2 location x y
@@ -199,12 +198,11 @@ instance UniformComponent a => Uniform (Index1 a) where
199
198
instance Uniform TextureUnit where
200
199
uniform loc@ (UniformLocation ul) = makeStateVar getter setter
201
200
where setter (TextureUnit tu) = uniform1 loc (fromIntegral tu :: GLint )
202
- getter = do
203
- program <- fmap fromJust $ get currentProgram
204
- allocaBytes (sizeOf (undefined :: GLint )) $ \ buf -> do
205
- glGetUniformiv (programID program) ul buf
206
- tuID <- peek buf
207
- return . TextureUnit $ fromIntegral tuID
201
+ getter = do program <- fmap fromJust $ get currentProgram
202
+ allocaBytes (sizeOf (undefined :: GLint )) $ \ buf -> do
203
+ glGetUniformiv (programID program) ul buf
204
+ tuID <- peek buf
205
+ return . TextureUnit $ fromIntegral tuID
208
206
uniformv location count = uniform1v location count . (castPtr :: Ptr TextureUnit -> Ptr GLint )
209
207
210
208
--------------------------------------------------------------------------------
0 commit comments