From h._h._h._ at hotmail.com Fri Feb 16 13:35:31 2007 From: h._h._h._ at hotmail.com (h.) Date: Fri Feb 16 13:34:14 2007 Subject: [HOpenGL] clear [ColorBuffer] Message-ID: Hello, The program: import Graphics.Rendering.OpenGL import Graphics.UI.GLUT main = do _ <- getArgsAndInitialize createWindow "Hello World" displayCallback $= clear [ ColorBuffer ] mainLoop and the problem: The ColorBuffer is not cleared, the window shows what was there before it was created. Creating windows, drawing points,... works all well, but "clear [ ColorBuffer ]" seems not to work. (I'm using the ghc 6.6 on Windows) Thanks in advance for your help. From jamin1001 at yahoo.com Mon Feb 19 05:55:03 2007 From: jamin1001 at yahoo.com (Jamin A. Ohmoto-Frederick) Date: Mon Feb 19 05:48:58 2007 Subject: [HOpenGL] clear [ColorBuffer] In-Reply-To: Message-ID: <28078.26529.qm@web36201.mail.mud.yahoo.com> Looks like you need to flush the graphics commands. try this: // displayCallback $= clear [ ColorBuffer ] displayCallback $= display display = do clear [ ColorBuffer ] flush Did that work? Jamin --- "h." wrote: > Hello, > > The program: > > import Graphics.Rendering.OpenGL > import Graphics.UI.GLUT > > main = do > _ <- getArgsAndInitialize > createWindow "Hello World" > displayCallback $= clear [ ColorBuffer ] > mainLoop > > and the problem: > The ColorBuffer is not cleared, the window shows > what was there before it was > created. > Creating windows, drawing points,... works all well, > but "clear [ > ColorBuffer ]" seems not to work. > (I'm using the ghc 6.6 on Windows) > > Thanks in advance for your help. > > > _______________________________________________ > HOpenGL mailing list > HOpenGL@haskell.org > http://www.haskell.org/mailman/listinfo/hopengl > ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front From sven.panne at aedion.de Mon Feb 19 09:24:49 2007 From: sven.panne at aedion.de (Sven Panne) Date: Mon Feb 19 09:18:47 2007 Subject: [HOpenGL] clear [ColorBuffer] In-Reply-To: References: Message-ID: <200702191524.49963.sven.panne@aedion.de> On Friday 16 February 2007 19:35, h. wrote: > [...] and the problem: > The ColorBuffer is not cleared, the window shows what was there before it > was created. [...] Just a small addition: As was already pointed out, rendering in OpenGL is not synchronous, which is a very good design decision given the capabilities and architectures of today's graphic cards. If you use single-buffering (as in your example), a 'flush' or 'finish' is needed, see: http://www.haskell.org/ghc/docs/latest/html/libraries/OpenGL/Graphics-Rendering-OpenGL-GL-FlushFinish.html If double-buffering is used, GLUT's 'swapBuffers' is your friend: http://www.haskell.org/ghc/docs/latest/html/libraries/GLUT/Graphics-UI-GLUT-Window.html#v%3AswapBuffers Example: -------------------------------------------------------------------------- import Graphics.UI.GLUT main :: IO () main = do ? _ <- getArgsAndInitialize initialDisplayMode $= [ DoubleBuffered ] ? createWindow "Hello World" ? displayCallback $= do clear [ ColorBuffer ]; swapBuffers ? mainLoop -------------------------------------------------------------------------- Other UI toolkits with an OpenGL canvas will have something similar to 'swapBuffers', e.g. 'glDrawableSwapBuffers' in Gtk2Hs, IIRC. Cheers, S. From astroboyqu at gmail.com Tue Feb 20 15:53:00 2007 From: astroboyqu at gmail.com (Chris Perez) Date: Tue Feb 20 15:46:54 2007 Subject: [HOpenGL] HOpenGL install help Message-ID: <301834c20702201253x66cdd430ja899cc6493213a93@mail.gmail.com> Hello, I am writing a graphical program in Haskell as a final project for university to show that it is not a "toy language". Unfortunatly when trying to install HOpenGL I get past the ./configure part but then fail with errors on the make depend and make all or even make install. I can't seem to locate the problem or where the errors are coming from. I get the following error report: module 'Main' is defined in multiple files: Info.hs QBSP.hs QuakeMovement.hs TestGLUT.hs make[2]: *** [depend] Error 1 make[1]: *** [depend] Error 1 make: *** [depend] Error 1 I would really like to use HOpenGL for this project, so If anyone knows how I can solve this I would love to know. -- Without Wax, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/hopengl/attachments/20070220/27638c66/attachment.htm From jamin1001 at yahoo.com Wed Feb 21 06:24:49 2007 From: jamin1001 at yahoo.com (Jamin A. Ohmoto-Frederick) Date: Wed Feb 21 06:18:37 2007 Subject: [HOpenGL] HOpenGL install help In-Reply-To: <301834c20702201253x66cdd430ja899cc6493213a93@mail.gmail.com> Message-ID: <217308.41247.qm@web36208.mail.mud.yahoo.com> Hi Chris, If you use a newer version of GHC (>= v6.4 or so) you shouldn't need to install OpenGL, and should be able to just do: ghc --make test.hs -- test.hs: import Graphics.Rendering.OpenGL import Graphics.UI.GLUT main = do _ <- getArgsAndInitialize createWindow "Hello World" displayCallback $= display mainLoop display = do clear [ColorBuffer] flush Did that work? --- Chris Perez wrote: > Hello, > > I am writing a graphical program in Haskell as a > final project for > university to show that it is not a "toy language". > Unfortunatly when trying > to install HOpenGL I get past the ./configure part > but then fail with errors > on the make depend and make all or even make > install. I can't seem to locate > the problem or where the errors are coming from. > > I get the following error report: > > module 'Main' is defined in multiple files: Info.hs > > QBSP.hs > > QuakeMovement.hs > > TestGLUT.hs > > make[2]: *** [depend] Error 1 > make[1]: *** [depend] Error 1 > make: *** [depend] Error 1 > I would really like to use HOpenGL for this project, > so If anyone knows how > I can solve this I would love to know. > > -- > Without Wax, > Chris > > _______________________________________________ > HOpenGL mailing list > HOpenGL@haskell.org > http://www.haskell.org/mailman/listinfo/hopengl > ____________________________________________________________________________________ Have a burning question? Go to www.Answers.yahoo.com and get answers from real people who know. From jamin1001 at yahoo.com Thu Feb 22 07:02:22 2007 From: jamin1001 at yahoo.com (Jamin A. Ohmoto-Frederick) Date: Thu Feb 22 06:56:08 2007 Subject: [HOpenGL] hopengl links In-Reply-To: <200702191524.49963.sven.panne@aedion.de> Message-ID: <20070222120223.51557.qmail@web36207.mail.mud.yahoo.com> Regarding Chris' post - I ran into a lot of problems too since there are old versions of HOpenGL and corresponding examples floating around out there with differing advice, such as at http://www.haskell.org/HOpenGL/. I'm not sure why it hasn't been updated since it's off of the main haskell.org. There are some sites that include a lot of Red Book examples that should just compile and work with the method I gave (such as ghc --make Planet.hs). Anyone know a reason why some tutorials use the -package GLUT option? Try some of these links: This should have the newer examples (can anyone tell me if there are any better sites than this?) http://cvs.haskell.org/cgi-bin/cvsweb.cgi/~checkout~/fptools/libraries/GLUT/examples/RedBook/ This is a newer tutorial (blog): http://blog.mikael.johanssons.org/archive/2006/09/opengl-programming-in-haskell-a-tutorial-part-2/ This is older: http://www.haskell.org/~pairwise/HOpenGL/HOpenGL.html -Jamin ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news From sven.panne at aedion.de Thu Feb 22 09:06:00 2007 From: sven.panne at aedion.de (Sven Panne) Date: Thu Feb 22 08:59:43 2007 Subject: [HOpenGL] hopengl links In-Reply-To: <20070222120223.51557.qmail@web36207.mail.mud.yahoo.com> References: <20070222120223.51557.qmail@web36207.mail.mud.yahoo.com> Message-ID: <200702221506.00449.sven.panne@aedion.de> On Thursday 22 February 2007 13:02, Jamin A. Ohmoto-Frederick wrote: > Regarding Chris' post - > > I ran into a lot of problems too since there are old > versions of HOpenGL and corresponding examples > floating around out there with differing advice, such > as at http://www.haskell.org/HOpenGL/. I'm not sure > why it hasn't been updated since it's off of the main > haskell.org. I admit being guilty here of not upating that site for a very long time. My amount of time I can work on HOpenGL varies quite a bit depending on my Real Life (tm) ;-), I think it might be a good idea to move the stuff to the Haskell Wiki, so it is easier to keep things up-to-date, integrate more examples/tutorials/etc. I'll think about that... > There are some sites that include a lot of Red Book > examples that should just compile and work with the > method I gave (such as ghc --make Planet.hs). Anyone > know a reason why some tutorials use the -package GLUT > option? The OpenGL/GLUT packages are exposed by default, so there is no need to specify them explicitly, unless you are manually compiling and linking. This is explained in detail at: http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html#using-packages So the easiest way to use all OpenGL/GLUT stuff is importing Graphics.UI.GLUT and using "ghc --make". A single import, no special options... > Try some of these links: > > This should have the newer examples (can anyone tell > me if there are any better sites than this?) > http://cvs.haskell.org/cgi-bin/cvsweb.cgi/~checkout~/fptools/libraries/GLUT >/examples/RedBook/ [...] The OpenGL/GLUT packages are now under darcs control instead of CVS, so the latest and greatest examples are available at: http://darcs.haskell.org/packages/GLUT/examples/ If you use Hugs, it may already ship with all the examples, e.g. at: /usr/lib/hugs/demos/GLUT Cheers, S. From h._h._h._ at hotmail.com Thu Feb 22 10:38:15 2007 From: h._h._h._ at hotmail.com (h.) Date: Thu Feb 22 10:32:27 2007 Subject: [HOpenGL] Re: clear [ColorBuffer] References: <28078.26529.qm@web36201.mail.mud.yahoo.com> Message-ID: Thanks a lot, it does work! I just read a hOpenGL tutorial, and nowhere was used the flush command in connection to clear the ColorBuffer From astroboyqu at gmail.com Thu Feb 22 12:50:45 2007 From: astroboyqu at gmail.com (Chris Perez) Date: Thu Feb 22 12:44:33 2007 Subject: [HOpenGL] hopengl links In-Reply-To: <200702221506.00449.sven.panne@aedion.de> References: <20070222120223.51557.qmail@web36207.mail.mud.yahoo.com> <200702221506.00449.sven.panne@aedion.de> Message-ID: <301834c20702220950s74f323efx75f27738fb15eea2@mail.gmail.com> Thanks Alot! I found the new updated redbook in the source code for GHC 6.6with tons of examples. I have finally gotten the samples to compile and run, looks like clear sailing from here. On 2/22/07, Sven Panne wrote: > > On Thursday 22 February 2007 13:02, Jamin A. Ohmoto-Frederick wrote: > > Regarding Chris' post - > > > > I ran into a lot of problems too since there are old > > versions of HOpenGL and corresponding examples > > floating around out there with differing advice, such > > as at http://www.haskell.org/HOpenGL/. I'm not sure > > why it hasn't been updated since it's off of the main > > haskell.org. > > I admit being guilty here of not upating that site for a very long time. > My > amount of time I can work on HOpenGL varies quite a bit depending on my > Real > Life (tm) ;-), I think it might be a good idea to move the stuff to the > Haskell Wiki, so it is easier to keep things up-to-date, integrate more > examples/tutorials/etc. I'll think about that... > > > There are some sites that include a lot of Red Book > > examples that should just compile and work with the > > method I gave (such as ghc --make Planet.hs). Anyone > > know a reason why some tutorials use the -package GLUT > > option? > > The OpenGL/GLUT packages are exposed by default, so there is no need to > specify them explicitly, unless you are manually compiling and linking. > This > is explained in detail at: > > > http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html#using-packages > > So the easiest way to use all OpenGL/GLUT stuff is importing > Graphics.UI.GLUT > and using "ghc --make". A single import, no special options... > > > Try some of these links: > > > > This should have the newer examples (can anyone tell > > me if there are any better sites than this?) > > > http://cvs.haskell.org/cgi-bin/cvsweb.cgi/~checkout~/fptools/libraries/GLUT > >/examples/RedBook/ [...] > > The OpenGL/GLUT packages are now under darcs control instead of CVS, so > the > latest and greatest examples are available at: > > http://darcs.haskell.org/packages/GLUT/examples/ > > If you use Hugs, it may already ship with all the examples, e.g. at: > > /usr/lib/hugs/demos/GLUT > > Cheers, > S. > _______________________________________________ > HOpenGL mailing list > HOpenGL@haskell.org > http://www.haskell.org/mailman/listinfo/hopengl > -- Without Wax, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/hopengl/attachments/20070222/ee6b953f/attachment.htm From astroboyqu at gmail.com Thu Feb 22 12:54:50 2007 From: astroboyqu at gmail.com (Chris Perez) Date: Thu Feb 22 12:48:38 2007 Subject: [HOpenGL] OpenGL with wxWidgets Message-ID: <301834c20702220954tea6eba2h282692868568c683@mail.gmail.com> Ok, Brand new problem, I have OpenGL working in Haskell and compiling, and I have been working with wxWidgets to make the GUI process easier. Now I am trying to work out a way to combine the two. I haven't been able to do it successfully because they seem to create different kinds of windows, but I would like it if it would be possible to Open a frame with wxWidgets then inside the frame as one of the panels Have some OpenGL running , on which I could apply buttons from the parent frame to. I can't seem to find any easy way to do this and have been reading through the documentation for both. Any suggestions? -- Without Wax, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/hopengl/attachments/20070222/85f0c580/attachment-0001.htm From jamin1001 at yahoo.com Thu Feb 22 13:42:09 2007 From: jamin1001 at yahoo.com (Jamin A. Ohmoto-Frederick) Date: Thu Feb 22 13:35:54 2007 Subject: [HOpenGL] OpenGL with wxWidgets In-Reply-To: <301834c20702220954tea6eba2h282692868568c683@mail.gmail.com> Message-ID: <719740.93240.qm@web36205.mail.mud.yahoo.com> Are you doing wxWidgets in Haskell or some other language? There is wxHaskell, a type-safe wrapper around wxWidgets, which already has at least 2 opengl examples. I tried these briefly but the builds immediately crashed on me (I never looked into it very far). Although, I have used wxHaskell without OpenGL with good success, and it is much cleaner that what I have ever seen before in GUI creation, once you get used to the style. If you there is something wrong with the GUI structure, you usually get a compile error, instead of a run-time error or crash. --- Chris Perez wrote: > Ok, Brand new problem, I have OpenGL working in > Haskell and compiling, and > I have been working with wxWidgets to make the GUI > process easier. Now I am > trying to work out a way to combine the two. I > haven't been able to do it > successfully because they seem to create different > kinds of windows, but I > would like it if it would be possible to Open a > frame with wxWidgets then > inside the frame as one of the panels Have some > OpenGL running , on which I > could apply buttons from the parent frame to. I > can't seem to find any easy > way to do this and have been reading through the > documentation for both. Any > suggestions? > > -- > Without Wax, > Chris > > _______________________________________________ > HOpenGL mailing list > HOpenGL@haskell.org > http://www.haskell.org/mailman/listinfo/hopengl > ____________________________________________________________________________________ Food fight? Enjoy some healthy debate in the Yahoo! Answers Food & Drink Q&A. http://answers.yahoo.com/dir/?link=list&sid=396545367 From astroboyqu at gmail.com Thu Feb 22 13:48:08 2007 From: astroboyqu at gmail.com (Chris Perez) Date: Thu Feb 22 13:41:57 2007 Subject: [HOpenGL] OpenGL with wxWidgets In-Reply-To: <719740.93240.qm@web36205.mail.mud.yahoo.com> References: <301834c20702220954tea6eba2h282692868568c683@mail.gmail.com> <719740.93240.qm@web36205.mail.mud.yahoo.com> Message-ID: <301834c20702221048o55079189wc10b158c45f86175@mail.gmail.com> I am working with wxHaskell, Yes I agree It's GUI constructin is so nice to work with, alot simpler and easier to debug than most other GUI packages I have tried, I looked at the OpenGL examples in wxHaskell but I cannot seem to get them to work with what I want to do. I get the same Kind of crashing when I run them. I will try to look into it deeper and if I find anything I will post it. On 2/22/07, Jamin A. Ohmoto-Frederick wrote: > > Are you doing wxWidgets in Haskell or some other > language? There is wxHaskell, a type-safe wrapper > around wxWidgets, which already has at least 2 opengl > examples. I tried these briefly but the builds > immediately crashed on me (I never looked into it very > far). > > Although, I have used wxHaskell without OpenGL with > good success, and it is much cleaner that what I have > ever seen before in GUI creation, once you get used to > the style. If you there is something wrong with the > GUI structure, you usually get a compile error, > instead of a run-time error or crash. > > > --- Chris Perez wrote: > > > Ok, Brand new problem, I have OpenGL working in > > Haskell and compiling, and > > I have been working with wxWidgets to make the GUI > > process easier. Now I am > > trying to work out a way to combine the two. I > > haven't been able to do it > > successfully because they seem to create different > > kinds of windows, but I > > would like it if it would be possible to Open a > > frame with wxWidgets then > > inside the frame as one of the panels Have some > > OpenGL running , on which I > > could apply buttons from the parent frame to. I > > can't seem to find any easy > > way to do this and have been reading through the > > documentation for both. Any > > suggestions? > > > > -- > > Without Wax, > > Chris > > > _______________________________________________ > > HOpenGL mailing list > > HOpenGL@haskell.org > > http://www.haskell.org/mailman/listinfo/hopengl > > > > > > > > ____________________________________________________________________________________ > Food fight? Enjoy some healthy debate > in the Yahoo! Answers Food & Drink Q&A. > http://answers.yahoo.com/dir/?link=list&sid=396545367 > -- Without Wax, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/hopengl/attachments/20070222/91df47a3/attachment.htm From sven.panne at aedion.de Fri Feb 23 05:38:36 2007 From: sven.panne at aedion.de (Sven Panne) Date: Fri Feb 23 05:32:20 2007 Subject: [HOpenGL] Re: clear [ColorBuffer] In-Reply-To: References: <28078.26529.qm@web36201.mail.mud.yahoo.com> Message-ID: <200702231138.37711.sven.panne@aedion.de> On Thursday 22 February 2007 16:38, h. wrote: > Thanks a lot, it does work! > > I just read a hOpenGL tutorial, and nowhere was used the flush command in > connection to clear the ColorBuffer The reason that leaving out 'flush' seems to work sometimes is that some OpenGL implementations (e.g. Mesa in SW rendering mode) do not have the highly asynchronous behaviour allowed by the OpenGL spec. OTOH, e.g. NVIDIA's driver definitely needs a 'flush'/'swapBuffers'. So as a general rule, use one of these functions at the end of your display callback. Cheers, S. From sven.panne at aedion.de Fri Feb 23 05:42:30 2007 From: sven.panne at aedion.de (Sven Panne) Date: Fri Feb 23 05:36:09 2007 Subject: [HOpenGL] OpenGL with wxWidgets In-Reply-To: <301834c20702221048o55079189wc10b158c45f86175@mail.gmail.com> References: <301834c20702220954tea6eba2h282692868568c683@mail.gmail.com> <719740.93240.qm@web36205.mail.mud.yahoo.com> <301834c20702221048o55079189wc10b158c45f86175@mail.gmail.com> Message-ID: <200702231142.30140.sven.panne@aedion.de> On Thursday 22 February 2007 19:48, Chris Perez wrote: > I am working with wxHaskell, Yes I agree It's GUI constructin is so nice to > work with, alot simpler and easier to debug than most other GUI packages I > have tried, I looked at the OpenGL examples in wxHaskell but I cannot seem > to get them to work with what I want to do. I get the same Kind of crashing > when I run them. I will try to look into it deeper and if I find anything I > will post it. I am not sure about the current status of wxHaskell, I think that the maintainer has changed recently, IIRC, so things may not be completely up-to-date again. As an alternative, you might try Gtk2Hs, which starting with version 0.9.11 finally officially supports an OpenGL widget, see: http://haskell.org/gtk2hs/. Cheers, S.