24 lines
466 B
Haskell
24 lines
466 B
Haskell
|
module Types.Texture where
|
||
|
|
||
|
import SDL (($=), get)
|
||
|
|
||
|
import qualified Graphics.Rendering.OpenGL as GL
|
||
|
|
||
|
-- internal imports
|
||
|
|
||
|
import Classes.Bindable
|
||
|
|
||
|
data Texture = Texture
|
||
|
{ textureId :: GL.TextureObject
|
||
|
, textureSlot :: GL.TextureUnit
|
||
|
}
|
||
|
deriving (Eq, Show)
|
||
|
|
||
|
instance Bindable Texture where
|
||
|
|
||
|
bind t = do
|
||
|
GL.activeTexture $= textureSlot t
|
||
|
GL.textureBinding GL.Texture2D $= Just (textureId t)
|
||
|
|
||
|
unbind t = GL.textureBinding GL.Texture2D $= Nothing
|