pituicat/src/Types/Texture.hs

24 lines
466 B
Haskell
Raw Normal View History

2020-10-12 04:08:33 +00:00
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