packages feed

GLUtil 0.8.2 → 0.8.3

raw patch · 2 files changed

+23/−17 lines, 2 filesdep ~OpenGL

Dependency ranges changed: OpenGL

Files

GLUtil.cabal view
@@ -1,5 +1,5 @@ Name:                GLUtil-Version:             0.8.2+Version:             0.8.3 Synopsis:            Miscellaneous OpenGL utilities. License:             BSD3 License-file:        LICENSE@@ -55,7 +55,7 @@                        linear >= 1.1.3,                        JuicyPixels >= 3,                        OpenGLRaw >= 1.1,-                       OpenGL >= 2.9.2 && < 2.10,+                       OpenGL >= 2.9.2 && < 2.11,                        transformers >= 0.3,                        vector >= 0.7   Build-tools:         cpphs
examples/example1.hs view
@@ -1,14 +1,16 @@ -- | A port of the code presented at [Modern OpenGL with -- Haskell](http://www.arcadianvisions.com/blog/?p=224) to use the -- GLFW-b package.+import Prelude hiding (init) import Control.Applicative-import Control.Monad (when)+import Control.Monad (unless, when)+import Data.Maybe (isNothing)+import Foreign.Storable (sizeOf)+import Graphics.GLUtil import Graphics.Rendering.OpenGL import Graphics.UI.GLFW-import Foreign.Storable (sizeOf) import System.FilePath ((</>)) import TGA -- Small library for TGA file handling-import Graphics.GLUtil  -- | A value to carry around a shader program and its parameters. data Shaders = Shaders { getProgram        :: Program@@ -93,19 +95,23 @@             drawElements TriangleStrip 4 UnsignedInt offset0  animate :: Resources -> IO Resources-animate r = do seconds <- getTime+animate r = do Just seconds <- getTime                let fade = sin seconds * 0.5 + 0.5                return r { fadeFactor = realToFrac fade }  main :: IO ()-main = do _ <- initialize-          _ <- openWindow opts-          setWindowTitle "Chapter 2"-          makeResources >>= (>>) <$> drawInit <*> go-  where opts = defaultDisplayOptions { displayOptions_width = 500-                                     , displayOptions_height = 500-                                     , displayOptions_refreshRate = Just 100 }-        go r = do draw r-                  swapBuffers-                  pollEvents-                  keyIsPressed KeyEsc >>= flip when (animate r >>= go) . not+main = do ok <- init+          when (not ok) (error "Error initializing GLFW!")+          windowHint $ WindowHint'RefreshRate 100+          m@(~(Just w)) <- createWindow 500 500 "Chapter 2" Nothing Nothing+          when (isNothing m) (error "Couldn't create window!")+          makeContextCurrent m+          setWindowTitle w "Chapter 2"+          r0 <- makeResources+          drawInit r0+          let keyIsPressed k = (== KeyState'Pressed) <$> getKey w k+              go r = do draw r+                        swapBuffers w+                        pollEvents+                        keyIsPressed Key'Escape >>= flip unless (animate r >>= go)+          go r0