23 lines
475 B
Haskell
23 lines
475 B
Haskell
module Types.Texture where
|
|
|
|
import SDL (($=), get)
|
|
|
|
import qualified Graphics.Rendering.OpenGL as GL
|
|
|
|
-- internal imports
|
|
|
|
import Classes.Graphics.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
|