aboutsummaryrefslogtreecommitdiff
path: root/Graphics/Glyph/Textures.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-12-03 01:03:52 -0700
committerJosh Rahm <joshuarahm@gmail.com>2022-12-03 01:03:52 -0700
commit11fca081b1241e1915f357fa40baa3e97aceb823 (patch)
treec0312c145d9133cef5e31b04a71bec050097f0f0 /Graphics/Glyph/Textures.hs
parent7dd8c59353167e84dab9e7a1afc16e2290b249e3 (diff)
downloadterralloc-11fca081b1241e1915f357fa40baa3e97aceb823.tar.gz
terralloc-11fca081b1241e1915f357fa40baa3e97aceb823.tar.bz2
terralloc-11fca081b1241e1915f357fa40baa3e97aceb823.zip
Start reviving this ancient project. (It's pretty cool).
Got it to compile using Stack. Skybox works, but nothing else really does. I think this is a problem with how the program is interpreting the surface pixels when calculating the map terrain and elevation. I think some TLC is in order.
Diffstat (limited to 'Graphics/Glyph/Textures.hs')
-rw-r--r--Graphics/Glyph/Textures.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Graphics/Glyph/Textures.hs b/Graphics/Glyph/Textures.hs
index 7e86d2a..ec3e12f 100644
--- a/Graphics/Glyph/Textures.hs
+++ b/Graphics/Glyph/Textures.hs
@@ -1,11 +1,10 @@
module Graphics.Glyph.Textures where
+import Control.Monad
import Data.Array.Storable
import Data.Word
-
-import Graphics.Rendering.OpenGL.Raw.Core31
+import Graphics.GL.Compatibility30
import Graphics.Rendering.OpenGL
-import Control.Monad
data Pixels =
PixelsRGB (Int,Int) (StorableArray Int Word8) |
@@ -32,8 +31,8 @@ attachPixelsToTexture pixels tex =
withStorableArray (pixelsArray pixels) $ \ptr -> do
textureBinding Texture2D $= Just tex
case pixels of
- PixelsRGB (w,h) _ -> glTexImage2D gl_TEXTURE_2D 0 3 (f w) (f h) 0 gl_RGB gl_UNSIGNED_BYTE ptr
- PixelsRGBA (w,h) _ -> glTexImage2D gl_TEXTURE_2D 0 4 (f w) (f h) 0 gl_RGBA gl_UNSIGNED_BYTE ptr
+ PixelsRGB (w,h) _ -> glTexImage2D GL_TEXTURE_2D 0 3 (f w) (f h) 0 GL_RGB GL_UNSIGNED_BYTE ptr
+ PixelsRGBA (w,h) _ -> glTexImage2D GL_TEXTURE_2D 0 4 (f w) (f h) 0 GL_RGBA GL_UNSIGNED_BYTE ptr
where f = fromIntegral