Quantcast

Problem with Glut

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem with Glut

ai00rea
I have to make a project for university. I want to make a little game like Pong. For this I decided to use Glut. I followed this tutorial but I didn't succeed: http://netsuperbrain.com/blog/posts/freeglut-windows-hopengl-hglut/

I am using Windows 7. Now I removed all things I installed from my computer about haskell & openGL & GLUT.
And I installed Haskell Platform. I found out that openGL and GLUT are included in this platform. OK but there is one problem:


GHCi, version 7.0.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
[1 of 1] Compiling Main             ( C:\Users\fuRy\Desktop\openGL\teapots.hs, i
nterpreted )
Ok, modules loaded: Main.
*Main> main
Loading package OpenGL-2.2.3.0 ... linking ... done.
Loading package array-0.3.0.2 ... linking ... done.
Loading package containers-0.4.0.0 ... linking ... done.
Loading package GLUT-2.1.2.1 ... <interactive>: glut32: The specified module cou
ld not be found.
can't load .so/.DLL for: glut32 (addDLL: could not load DLL)


Please help me. I tried 2 days to install this. Before that I tried to instal WXHaskell too, and i failed. Or recomand me an library that you use and there are some examples of code to figure out how to use it and is good for my purpose: Pong.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with Glut

Jason Dagit-3


On Sun, May 6, 2012 at 1:34 PM, ai00rea <[hidden email]> wrote:
I have to make a project for university. I want to make a little game like
Pong.

Great!
 
For this I decided to use Glut. I followed this tutorial but I didn't
succeed: http://netsuperbrain.com/blog/posts/freeglut-windows-hopengl-hglut/

I would advise against using GLUT.  I recommend GLFW-b.  You can get it from Hackage. I've tested it on Windows 7, OSX, and Linux. It should just work out of the box.
 


I am using Windows 7. Now I removed all things I installed from my computer
about haskell & openGL & GLUT.
And I installed Haskell Platform. I found out that openGL and GLUT are
included in this platform. OK but there is one problem:


GHCi, version 7.0.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
[1 of 1] Compiling Main             (
C:\Users\fuRy\Desktop\openGL\teapots.hs, i
nterpreted )
Ok, modules loaded: Main.
*Main> main
Loading package OpenGL-2.2.3.0 ... linking ... done.
Loading package array-0.3.0.2 ... linking ... done.
Loading package containers-0.4.0.0 ... linking ... done.
Loading package GLUT-2.1.2.1 ... <interactive>: glut32: The specified module
cou
ld not be found.
can't load .so/.DLL for: glut32 (addDLL: could not load DLL)

You need to find a copy of glut32.dll and put it into the same directory. If you want to use GLUT, I would use the dll from freeglut. By the way, if you want to use ghci with opengl you will need to start ghci with -fno-ghci-sandbox.  Otherwise you will get weird crashes. This applies to GLUT and GLFW-b equally.



Please help me. I tried 2 days to install this. Before that I tried to
instal WXHaskell too, and i failed. Or recomand me an library that you use
and there are some examples of code to figure out how to use it and is good
for my purpose: Pong.

I would use GLFW-b.

You can find some example code for haskell opengl here: https://github.com/dagit/nehe-tuts

That version uses openglraw and glfw-b. If you want to use the non-raw version of the api look at this version in the history of the repo: https://github.com/dagit/nehe-tuts/tree/447f5471f3e7fe07b44dc5d2d87c4a95be35ce75

I hope that helps,
Jason

_______________________________________________
HOpenGL mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/hopengl
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with Glut

Balazs Komuves
In reply to this post by ai00rea

Hello,

Compiling the Haskell OpenGL/GLUT bindings on Windows is unfortunately very complicated,
because they use some Unix tools. It is recommended to use the Haskell Platform instead,
which as you noticed, has them included. If for some reasons you need to compile them manually,
the primary trick is to install a (recent version!) of MinGW/MSys, which provides the necessary
unixy tools.

I have more experience with GLUT than with GLFW, so I can add that GLUT works pretty
robustly too (I use Windows and OSX), even though it clearly shows the age. The only big
problem I remember is with the middle mouse buttons; and there is some inconvenience
with the initialization, and lack of vsync support (which has to be hacked in). However,
it provides a display callback, which as far as I remember, GLFW does not (it only has
a big loop).

As Jason said, to use GLUT, you need to put glut32.dll at a place where Windows finds it
(either at the same directory your executable is - recommended if you distribute your app -,
or some Windows system directory).

Also, with GHCi there are some issues, so first try the compiled version. I'm not up-to-date
regarding how to solve these issues.

OpenGL/GLUT is much simpler than wxHaskell. I had very bad experiences with wxHaskell
(though I believe they were primarily caused by wx itself), but that was some time ago, so it
is possible that it is better now.

Hope this helps,
Balazs


On Sun, May 6, 2012 at 10:34 PM, ai00rea <[hidden email]> wrote:
I have to make a project for university. I want to make a little game like
Pong. For this I decided to use Glut. I followed this tutorial but I didn't
succeed: http://netsuperbrain.com/blog/posts/freeglut-windows-hopengl-hglut/

I am using Windows 7. Now I removed all things I installed from my computer
about haskell & openGL & GLUT.
And I installed Haskell Platform. I found out that openGL and GLUT are
included in this platform. OK but there is one problem:


GHCi, version 7.0.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
[1 of 1] Compiling Main             (
C:\Users\fuRy\Desktop\openGL\teapots.hs, i
nterpreted )
Ok, modules loaded: Main.
*Main> main
Loading package OpenGL-2.2.3.0 ... linking ... done.
Loading package array-0.3.0.2 ... linking ... done.
Loading package containers-0.4.0.0 ... linking ... done.
Loading package GLUT-2.1.2.1 ... <interactive>: glut32: The specified module
cou
ld not be found.
can't load .so/.DLL for: glut32 (addDLL: could not load DLL)


Please help me. I tried 2 days to install this. Before that I tried to
instal WXHaskell too, and i failed. Or recomand me an library that you use
and there are some examples of code to figure out how to use it and is good
for my purpose: Pong.

--
View this message in context: http://haskell.1045720.n5.nabble.com/Problem-with-Glut-tp5689667.html
Sent from the Haskell - HOpenGL mailing list archive at Nabble.com.

_______________________________________________
HOpenGL mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/hopengl


_______________________________________________
HOpenGL mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/hopengl
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with Glut

ai00rea
In reply to this post by ai00rea
    Ambiguous module name `Graphics.UI.GLFW':
      it was found in multiple packages: GLFW-b-0.1.0.2 GLFW-0.5.0.1
Failed, modules loaded: none.





How can i remove one version. I tried reinstalling the Haskell Platform and deleting all files related to glfw, but useless... Please help me.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with Glut

Mark Spezzano-3
Hi

Not sure if this will do the trick, but you might have _two copies_ of the package installed over the top of each other.

You often have this problem if there is a local copy for a specific user and a global, system-wide copy.

If I remember correctly, I think I used the command  

ghc-pkg unregister <package name>

to de-register a package (You might need to type in the full version number of the package that you wish to de-register)

You can use

ghc-pkg list

to see which packages are installed, first.

I don't know the "correct" way to go about installing packages, but I always do a

sudo cabal install --global <package name>

That way I don't end up with local and global duplicates overlapping and cause me and ghc confusion.

Hope that helps.

Mark



On 20/05/2012, at 1:23 AM, ai00rea wrote:

>    Ambiguous module name `Graphics.UI.GLFW':
>      it was found in multiple packages: GLFW-b-0.1.0.2 GLFW-0.5.0.1
> Failed, modules loaded: none.
>
>
>
>
>
> How can i remove one version. I tried reinstalling the Haskell Platform and
> deleting all files related to glfw, but useless... Please help me.
>
> --
> View this message in context: http://haskell.1045720.n5.nabble.com/Problem-with-Glut-tp5689667p5710734.html
> Sent from the Haskell - HOpenGL mailing list archive at Nabble.com.
>
> _______________________________________________
> HOpenGL mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/hopengl
>
>


_______________________________________________
HOpenGL mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/hopengl
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with Glut

ai00rea
10x a lot man. That thing drove me crazy. I searched on google for about an hour and found nothing.10x
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with Glut

ai00rea
In reply to this post by ai00rea
Not in scope: `windowParam'
Failed, modules loaded: none.

on line "windowOpenStatus <- get $ windowParam Opened"

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with Glut

Balazs Komuves
In reply to this post by ai00rea

Hello,

This is actually *two different* packages, exposing the same module (namespace).
GHC has a language extension which allows you to select the correct package:

{-# LANGUAGE PackageImports #-}
module MyModule where
import "glfw-b" Graphics.UI.GLFW
...

This specifies that you want the "GLFW-b" package (as opposed to the "GLFW" package).

You can also hide/expose/delete packages using the ghc-pkg command line tool:

ghc-pkg hide GLFW-0.5.0.1
ghc-pkg expose GLFW-0.5.0.1

I don't recall the remove command by heart (probably "remove" :)

Hope this helps,
Balazs


On Sat, May 19, 2012 at 5:53 PM, ai00rea <[hidden email]> wrote:
   Ambiguous module name `Graphics.UI.GLFW':
     it was found in multiple packages: GLFW-b-0.1.0.2 GLFW-0.5.0.1
Failed, modules loaded: none.





How can i remove one version. I tried reinstalling the Haskell Platform and
deleting all files related to glfw, but useless... Please help me.

--
View this message in context: http://haskell.1045720.n5.nabble.com/Problem-with-Glut-tp5689667p5710734.html
Sent from the Haskell - HOpenGL mailing list archive at Nabble.com.

_______________________________________________
HOpenGL mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/hopengl


_______________________________________________
HOpenGL mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/hopengl
Loading...