[Haskell-cafe] up-to-date glfw examples

12 views
Skip to first unread message

bri...@aracnet.com

unread,
Jun 23, 2016, 8:51:53 PM6/23/16
to haskell-cafe
Hi,

I've been looking but the examples are all fairly old and are broken in both imports from glfw and opengl.

Just looking for very basic examples that work with the current versions of glfw-b and opengl.

Thank you,

Brian
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

Anthony Cowley

unread,
Jun 24, 2016, 12:27:57 AM6/24/16
to haskell-cafe

bri...@aracnet.com writes:

> Hi,
>
> I've been looking but the examples are all fairly old and are broken in both imports from glfw and opengl.
>
> Just looking for very basic examples that work with the current versions of glfw-b and opengl.
>
> Thank you,
>
> Brian

They're not entirely minimal, but the vinyl-gl repo [1] includes two example programs that can get you going with both glfw-b and opengl. I added a stack file, so you should be able to clone the repo, then,

```
stack build
cd examples
stack exec game2d
stack exec demo3d
```

Anthony

Footnotes:

[1] https://github.com/acowley/vinyl-gl

bri...@aracnet.com

unread,
Jun 24, 2016, 1:32:37 AM6/24/16
to Anthony Cowley, haskell-cafe
On Fri, 24 Jun 2016 00:27:23 -0400
Anthony Cowley <aco...@seas.upenn.edu> wrote:

>
> bri...@aracnet.com writes:
>
> > Hi,
> >
> > I've been looking but the examples are all fairly old and are broken in both imports from glfw and opengl.
> >
> > Just looking for very basic examples that work with the current versions of glfw-b and opengl.
> >

That's very useful.

Thanks!

I also noticed that the glfw-b package has a gears demo which is very good. The only drawback is that it uses "old style" opengl calls.

Brian

Daniel Bergey

unread,
Jun 24, 2016, 10:35:39 AM6/24/16
to bri...@aracnet.com, haskell-cafe
The link below has introductory examples using GLFW-b and modern (VBO)
OpenGL. They build with the 2-month-ago current versions of libraries,
and probably also with the today-current versions.

https://github.com/bergey/haskell-OpenGL-examples/tree/master/wikibook

bergey

bri...@aracnet.com

unread,
Jun 24, 2016, 11:52:53 AM6/24/16
to Daniel Bergey, haskell-cafe
On Fri, 24 Jun 2016 10:35:29 -0400
Daniel Bergey <ber...@teallabs.org> wrote:

> The link below has introductory examples using GLFW-b and modern (VBO)
> OpenGL. They build with the 2-month-ago current versions of libraries,
> and probably also with the today-current versions.
>
> https://github.com/bergey/haskell-OpenGL-examples/tree/master/wikibook
>

Hi Daniel,

This looks really good.

Couple of issues I had when trying to build on my system

cabal: At least the following dependencies are missing:
OpenGLRaw >=3 && <3.2, singletons >=1.0 && <2.1

I have

OpenGLRaw-3.2.0.0
singletons-2.1

However when I went into the cabal file and replaced "<" with "<=" that didn't seem to make the build happy. Also, since you used "<" specifically I thought there might be a good reason for that.

Daniel Bergey

unread,
Jun 24, 2016, 3:54:49 PM6/24/16
to bri...@aracnet.com, haskell-cafe
On 2016-06-24 at 11:52, bri...@aracnet.com wrote:
> cabal: At least the following dependencies are missing:
> OpenGLRaw >=3 && <3.2, singletons >=1.0 && <2.1
>
> I have
>
> OpenGLRaw-3.2.0.0
> singletons-2.1

I just pushed a commit that allows these two package versions.

> However when I went into the cabal file and replaced "<" with "<="
> that didn't seem to make the build happy. Also, since you used "<"
> specifically I thought there might be a good reason for that.

The reason is that the last time I touched this package those versions
weren't out, and I made the conservative assumption that changes in
these versions might require changes in my package.

I figure it's no big deal if someone building my examples needs to use a
2-month-old dependency, but frustrating if what's intended as a tutorial
example fails at compile time.

cheers,
bergey

Sven Panne

unread,
Jun 24, 2016, 5:39:57 PM6/24/16
to Daniel Bergey, haskell-cafe
2016-06-24 21:54 GMT+02:00 Daniel Bergey <ber...@teallabs.org>:
[...] I figure it's no big deal if someone building my examples needs to use a

2-month-old dependency, but frustrating if what's intended as a tutorial
example fails at compile time.

Well, it depends on the definition of "failed": If the examples build cleanly in a fresh cabal sandbox or equivalently via "stack init && stack build", then I wouldn't consider this a failure. A consequence of the package versioning policy is actually that building a non-trivial project outside of a sandbox will fail with a high probability. This wouldn't be the case in an ideal world where every package author makes no mistakes and foresees the future, but alas, that's not the world we live in... :-D

Cheers,
   S.
Reply all
Reply to author
Forward
0 new messages