GLFW

A Haskell binding for GLFW http://haskell.org/haskellwiki/GLFW

Latest on Hackage:0.5.2.5

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed
Maintained by Paul H. Liu
This is a Haskell module for GLFW OpenGL framework
(http://www.glfw.org). It provides an alternative
to GLUT for OpenGL based Haskell programs.

SOE (http://www.cs.yale.edu/homes/hudak/SOE/) now
depends on this package.

The website for this Haskell module is at Haskell Wiki site:
http://haskell.org/haskellwiki/GLFW

=======
Changes
=======

See separate file "Changlog.txt".

============
Installation
============

The package comes together with a (partial) source distribution
of GLFW v2.7.9, which is compiled and installed together with
the Haskell package.

If you already have the Haskell package cabal-install, you can
simply do "cabal install GLFW", and it will download the latest
source from HackageDB, configure, compile, and install it
automatically.

Otherwise, you may follow the standard Cabal package installation
steps:

1. To configure the module, type

runhaskell Setup.hs configure
or

runhaskell Setup.hs configure --user --prefix=DIR

if you want to install the package to your user's directory
instead of the system one (replace DIR with your own directory
choice).

2. To build the module, type

runhaskell Setup.hs build

3. To install, type

runhaskell Setup.hs install

In the process it builds all GLFW C library source code. You may
use "runhaskell Setup.hs build --verbose" to see the actual
compilation steps.

4. Optionally to build its Haddock documentation, type

runhaskell Setup.hs haddock

====
NOTE
====

For Windows users, you may have to include GHC's gcc-lib directory
in your PATH environment, e.g., c:\ghc\ghc-7.6.3\gcc-lib, before
configuring the GLFW module, otherwise it'll complain about missing
program for ld.

For Linux users there is an option to link to a system wide GLFW
dynamical library instead of compilation from source. It can be
done by providing "--flags=dynamic" as an option to cabal configure
command.

For Mac users, unfortunately interactively running GLFW programs
from GHCi would result in a crash if you use GHC 7.6.3 or older.
The only sensible way is to compile and run the program, or use
GHC 7.8 or newer.

=============
Package Usage
=============

The package is tested with GHC 7.4.2 and GHC 7.6.3 on all
three platforms (Linux, Win32/MinGW, and Mac OS X). Though it may
work with older versions of GHC or even Hugs, they are not tested.

It installs a new Haskell package called "GLFW" and the actual
module to import is "Graphics.UI.GLFW". You'll need to pass
"-package GLFW" to GHC if you want to compile it.

GLFW itself is well documented (see GLFW website), and the
Haskell module API is documented via Haddock.

Not all functions are fully tested, and there are still a
few GLFW C functions missing from the Haskell module, namely
the image loading functions. They are excluded because image
handling is a separate issue, and low level buffer manipulation
would obscure their use further. Texture loading from TGA
format is supported both from file and from memory (via a
string buffer).

The Haskell module also provides basic text rendering while
GLFW doesn't. It comes from a free 8x16 font which is made
into a TGA texture, stored as a Haskell string in the file
GLFW.hs (also the reason for its big size). Text rendering
is only possible with Alpha enabled. Again, see SOE.hs from
the SOE package for sample usage.

GLFW doesn't work well with GHC threads, forkIO or threadDelay.
So avoid them if you can.


======================
Additional Information
======================

You may send your bug report and feature request to the package
maintainer: Paul H. Liu <paul@thev.net>.

Lastest GLFW development is hosted in a darcs repository. You
may obtain it by

darcs pull http://code.haskell.org/GLFW

There is also a mailinglist for GLFW deveopers at

http://projects.haskell.org/cgi-bin/mailman/listinfo/glfw

--
Last Updated: Thu Oct 3 PST 2013

Changes

Thu Mar 31 20:14:17 PDT 2016 paul@thev.net
* Bump version to 0.5.2.5

Sun Mar 27 13:01:28 PDT 2016 Sergei Trofimovich <slyfox@community.haskell.org>
* Allow OpenGL-3

Mon Jul 6 00:17:26 PDT 2015 paul@thev.net
* Change tab to space

Mon Jul 6 00:14:07 PDT 2015 paul@thev.net
* Bump version to 0.5.2.4

Mon Jul 6 00:13:52 PDT 2015 paul@thev.net
* Comptability fix for GHC 7.8.4

Tue Jun 23 11:52:53 PDT 2015 plcplc@gmail.com
* Update for ghc 7.10.1

Specifically adressing the change that we now have "class (Applicative m) => Monad m" in base.


Tue Aug 5 15:45:35 PDT 2014 paul@thev.net
* Bump version to 0.5.2.2

Tue Aug 5 15:45:31 PDT 2014 paul@thev.net
* Add NOINLINE to stablize top-level IORefs

Tue Aug 5 11:44:50 PDT 2014 paul@thev.net
* Bump version to 0.5.2.1

Tue Aug 5 11:43:24 PDT 2014 paul@thev.net
* Add IOKit framework for OS X and some minor fix

Thu Oct 3 23:59:17 PDT 2013 paul@thev.net
* Bump version to 0.5.2.0

Thu Oct 3 23:26:34 PDT 2013 paul@thev.net
* Upgrade to glfw C version 2.7.9

Thu Oct 3 23:25:39 PDT 2013 paul@thev.net
* Compatibility fix to work with Cabal 1.18

Sat Nov 3 21:41:09 PDT 2012 paul@thev.net
* Bump version to 0.5.1.0 for release

Sat Nov 3 21:39:46 PDT 2012 paul@thev.net
* Enable 64-bit fix for MouseWheelCallback

Thu Aug 30 20:07:02 PDT 2012 paul@thev.net
* Use Int for MouseWheelCallback

Wed Jun 13 21:53:39 PDT 2012 paul@thev.net
* use C types for FFI

Sat Jun 2 03:58:54 PDT 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Previous GLint was not quite working (linker error). Now fixed.

Sat Jun 2 03:38:31 PDT 2012 Marc Sunet <jeannekamikaze@gmail.com>
* GLint warning fixed.

Mon May 28 02:46:56 PDT 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Update to version 2.7.5
C sources updated, nothing to be done on the Haskell side.
Fixed a warning about unsafePerformIO being deprecated. Using the new function from System.Unsafe.
There are still a few warnings about GLint that could be supressed.

Fri Jan 27 11:07:48 PST 2012 paul@thev.net
* merge the source of StateT into Setup.hs since mtl is not a default library; bump up version

Sat Jan 21 01:08:46 PST 2012 paul@thev.net
* update API doc for windowCloseCallback

Sat Jan 21 01:05:06 PST 2012 paul@thev.net
* update SOE url

Fri Jan 20 13:17:21 PST 2012 paul@thev.net
* cosmetic changes before new release

Fri Jan 20 09:55:56 PST 2012 paul@thev.net
* update README

Fri Jan 20 02:45:53 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Minor docs edit. I mentioned that AutoPollEvent is enabled by default.

Fri Jan 20 01:34:45 PST 2012 paul@thev.net
* use a record for confState

Fri Jan 20 01:34:19 PST 2012 paul@thev.net
* update README

Fri Jan 20 01:06:41 PST 2012 paul@thev.net
* re-org haddock comments

Thu Jan 19 22:55:43 PST 2012 paul@thev.net
* fix example to match new param API

Thu Jan 19 14:24:38 PST 2012 paul@thev.net
* revert back to atexit on x11

Thu Jan 19 12:37:13 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Fixed X11 build.
X11 build now detects the directory where the X11 files are installed and passes that as an include
directory to gcc.
Edited .cabal file so that the X11 section is triggered on FreeBSD, not only on Linux.

Wed Jan 18 01:32:08 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Added myself to the maintainer list.

Mon Jan 16 14:10:07 PST 2012 paul@thev.net
* clean up Setup.hs, and put back the x-cc-name hack for OS X

Sat Jan 14 03:40:41 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Setup.hs now successfully passes the extra libs to the install process.
The extra libs were being passed to the build process, but not the install one, so applications would
fail to link properly.
I haven't figured out how to pass data between hooks, so as a workaround I made the build hook write
the extra libs to a temporary file which is then read by the install hook. The install hook reads the
extra libs, creates a modified PackageDescription and then delegates the rest of the work to the real
install process.

Sat Jan 14 02:46:18 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Setup.hs now passes the extra libraries to the build process.

Sat Jan 14 01:37:47 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Added Setup.hs sysctl check.

Sat Jan 14 01:31:30 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Setup.hs flags auto detection.
I have also edited the .cabal file to add some default flags for Linux.

Wed Jan 11 10:58:17 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Hint and Param type families.
openWindowHint and getParam substituted by param families.

Mon Jan 9 02:00:58 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Added default-language: Haskell98 to cabal file.

Sun Jan 8 21:19:49 PST 2012 paul@thev.net
* mark safe foreign calls

Sun Jan 8 21:18:51 PST 2012 paul@thev.net
* WindowCloseCallback now returns Bool instead of ()

Sun Jan 8 21:04:46 PST 2012 paul@thev.net
* get rid of compilation warning

Thu Jan 5 06:45:05 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* Documentation + glVersion
Documentation has been extended. Added the gettable statevar 'glVersion'.

Thu Jan 5 05:51:37 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* windowPos statevar added

Thu Jan 5 02:51:59 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* WindowParam missing constructors added.
I have added the missing values to the WindowParam enum. In the original glfw library WindowHint and
WindowParam share enum values, so I prepended a P to WindowParam constructors to avoid name clashes.
The result isn't very clean, but I suppose that since WindowHint is used more frequently it should be
ok.

Thu Jan 5 02:20:40 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* WindowHint and openWindowHint redesign
Redesigned WindwoHint and openWindowHint. Also added the Profile enum.

Wed Jan 4 02:30:25 PST 2012 paul@thev.net
* require Cabal >= 1.10, and fix building on 32-bit OS X

Tue Jan 3 10:06:50 PST 2012 Marc Sunet <jeannekamikaze@gmail.com>
* WindowHint - OpenGL context info
Added the following constructors to WindowHint: OpenGLVersionMajor, OpenGLVersionMinor,
OpenGLForwardCompat, OpenGLContext, OpenGLProfile.

Mon Jan 2 15:01:31 PST 2012 paul@thev.net
* add an example (same one I wrote on HaskellWiki)

Mon Jan 2 14:27:45 PST 2012 paul@thev.net
* use default hook when x-cc-name is not available

Mon Jan 2 14:20:10 PST 2012 paul@thev.net
* replace atexit with on_exit on x11

Mon Sep 26 01:59:21 PDT 2011 paul@thev.net
* upgrade to glfw-2.7.2, build darwin through gcc, and bump our version to 0.5.0.0

Mon Sep 26 01:52:52 PDT 2011 paul@thev.net
* fix compilation warnings

Mon Sep 26 01:09:24 PDT 2011 paul@thev.net
* change texture rendering direction to counter-clockwise in renderChar

Wed Sep 16 11:00:09 PDT 2009 paul@thev.net
* change CC option to fit Snow Leopard

Wed Aug 12 17:53:18 PDT 2009 paul@thev.net
* bugfix for the dynamic flag; bump version to 0.4.1 for release.

Wed Aug 12 12:53:09 PDT 2009 paul@thev.net
* update README.txt

Wed Aug 12 12:52:38 PDT 2009 paul@thev.net
* addition to Work around GHC FFI bug 2594 only in GHC < 6.10

Sun Aug 2 05:02:16 PDT 2009 paul@thev.net
* remove use of Int32 and make it compatible with OpenGL 2.3.0.0

Sat Jun 6 21:10:07 PDT 2009 brian@lorf.org
* Work around GHC FFI bug 2594 only in GHC < 6.10

Sat Jun 6 00:03:14 PDT 2009 brian@lorf.org
* Whitespace-only change to LICENSE.

Sat Jun 6 00:01:48 PDT 2009 brian@lorf.org
* hlint cleanliness, Haddock comment improvements.

Fri Jun 5 22:37:10 PDT 2009 brian@lorf.org
* Made small improvements to GLFW.cabal

Fri Jun 5 22:10:19 PDT 2009 brian@lorf.org
* Made small improvements to Setup.hs

Wed Jun 3 06:41:31 PDT 2009 paul@thev.net
* cabal related adjustments
1. adjust to work properly with latest cabal.
2. add -mach=apple as a cc-option for OS X in order not to break GHC 6.10.2.
3. add a "dynamic" flag for Linux to link to GLFW dynamic libs already in system.

Tue Dec 2 19:46:37 PST 2008 brianchina60221@gmail.com
* joystick-related cleanup

Mon Nov 3 15:03:56 PST 2008 shahn@cs.tu-berlin.de
* add derived instance for Ord for Key and SpecialKey

Sat Nov 1 17:50:32 PDT 2008 shahn@cs.tu-berlin.de
* fix 64-bug for mousePosCallback (with dirty hack)

Mon Oct 27 15:41:18 PDT 2008 brianchina60221@gmail.com
* openWindow fixes

Thu Oct 2 03:04:13 PDT 2008 brianchina60221@gmail.com
* marking more foreign imports safe

Thu Oct 2 00:26:39 PDT 2008 brianchina60221@gmail.com
* 'deteced -> detected'

Thu Oct 2 00:25:35 PDT 2008 brianchina60221@gmail.com
* some foreign imports cannot be marked unsafe

Tue Sep 30 11:25:57 PDT 2008 brianchina60221@gmail.com
* miscellaneous simplification

Tue Sep 30 06:26:03 PDT 2008 brianchina60221@gmail.com
* removed unnecessary stuff from foreign imports, added "unsafe"s

Tue Sep 30 00:57:00 PDT 2008 brianchina60221@gmail.com
* bump to 0.4, miscellaneous cleanup

Sat Sep 13 16:20:00 PDT 2008 shahn@cs.tu-berlin.de
* workaround for correct mouse wheel values on 64-bit-machines

Sat Sep 6 12:17:51 PDT 2008 shahn@cs.tu-berlin.de
* fix mousePosCallback bug on 64-bit machines

Thu Sep 4 18:30:11 PDT 2008 paul@thev.net
* fix typo bug in disableSpecial, and improve some error msgs.

Wed Sep 3 19:39:52 PDT 2008 paul@thev.net
* GLFW-0.3 init release
comments powered byDisqus