slanning's Journal http://use.perl.org/~slanning/journal/ slanning's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:22:15+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 slanning's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~slanning/journal/ pearls cheaper than Perl? http://use.perl.org/~slanning/journal/40269?from=rss According to <a href="http://news.discovery.com/tech/artificial-mother-of-pearl.html">http://news.discovery.com/tech/artificial-mother-of-pearl.html</a>, the material that makes up pearls can now be made as cheaply as paper. So, the cost of producing Perl is more than producing pearl. (Okay, it probably was even before, but I had to make a pun. I'm sorry...) slanning 2010-03-25T22:09:08+00:00 journal OGRE http://use.perl.org/~slanning/journal/39712?from=rss <p>I've recently worked a bit more on <a href="http://search.cpan.org/dist/Ogre/">Perl bindings</a> for <a href="http://www.ogre3d.org/">OGRE</a>. You might remember that I was <a href="http://use.perl.org/~slanning/journal/35114">working on this a couple years ago</a>. I updated the bindings to minimally work with the Shoggoth (1.6) API (at least on Ubuntu). It still needs <a href="http://www.ogre3d.org/wiki/index.php/ShoggothNotes">a lot of work</a>. </p><p>My motivation is to make a sort of game framework. I think there are similar motivations for the recent revival of the <a href="http://search.cpan.org/dist/SDL_Perl/">SDL bindings</a>. I recently added an example showing how to render Ogre into an SDL OpenGL context, at least on Linux (can be done in Windows too, but I didn't look at it yet). That allows you to write a normal SDL app, with keyboard/mouse input, sounds, and whatever else SDL does, but use Ogre to render 3-D graphics.</p><p>A couple years ago, I went to a talk by Guillaume Cottenceau on "the making of" <a href="http://www.frozen-bubble.org/">Frozen Bubble</a> at a <a href="http://geneve.mongueurs.net/">Geneva.pm</a> meeting. After that, I read <a href="http://arstechnica.com/gaming/news/2006/02/games-perl.ars">a tutorial on "Developing games with Perl and SDL"</a>. I took several detours, but eventually got interested in Ogre instead of using SDL. The problem (or nice thing depending on how you look at it) is that Ogre is focussed on 3-D graphics and leaves you to do all the rest yourself. So I also made <a href="http://search.cpan.org/dist/OIS/">bindings for OIS</a>, to get keyboard/mouse(/joystick/wiimote/etc.) input; a <a href="http://search.cpan.org/dist/Ogre-BetaGUI/">port of a simple GUI library</a>, to let you make simple menus and GUI widgets; and a binding for <a href="http://search.cpan.org/dist/Ogre-AL/">OgreAL</a>, which facilitates integrating OpenAL (sound/music) into 3-D scenes (so you have sound seeming to come from points in space).</p><p>In the back of my mind, I still would like to work on wrapping another GUI library, such as <a href="http://www.ogre3d.org/wiki/index.php/MyGUI">MyGUI</a> or in my crazier moments <a href="http://www.ogre3d.org/wiki/index.php/CEGUI">CEGUI</a>. I would like to automate more of the API-binding to make it easier to update for each release (have <a href="http://search.cpan.org/dist/ExtUtils-XSpp/">ExtUtils::XSpp</a> in mind, for one thing, and also want to improve the use of <a href="http://www.gccxml.org/HTML/Index.html">GCC-XML</a>) and to make the bindings more complete. I'd also like to get things compiling on Windows, especially after seeing how easily <a href="http://wxperl.sourceforge.net/">wxPerl</a> compiled on <a href="http://strawberryperl.com/">Strawberry Perl</a> this weekend.</p> slanning 2009-10-05T07:09:39+00:00 journal concision http://use.perl.org/~slanning/journal/38917?from=rss <p>This would be my comment at <a href="http://use.perl.org/~chromatic">chromatic</a>'s <a href="http://www.modernperlbooks.com/mt/2009/04/attributes-of-elegant-perl-concision.html">book-promotion blog</a> -- in particular in reply to <a href="http://use.perl.org/~Ovid">Ovid</a>'s comment -- if I weren't required to sign in there.</p><p>Perl6 will be out soon, right? Why put <a href="http://search.cpan.org/~flora/MooseX-Declare-0.20/">MooseX::Declare</a> in the Perl5 core?</p><p>Anyway, the module failed to install for me. I'll try to work out why, though at first glance... MooseX::Method::Signatures failed to install, and it required</p><blockquote><div><p> <tt>&nbsp; &nbsp; Context::Preserve [requires]<br>&nbsp; &nbsp; Parse::Method::Signatures [requires]<br>&nbsp; &nbsp; MooseX::Meta::TypeConstraint::ForceCoercion [requires]<br>&nbsp; &nbsp; MooseX::Types::Structured [requires]<br>&nbsp; &nbsp; aliased [requires]<br>&nbsp; &nbsp; B::Hooks::EndOfScope [requires]<br>&nbsp; &nbsp; MooseX::Types [requires]<br>&nbsp; &nbsp; Devel::Declare [requires]</tt></p></div> </blockquote><p>and of course Parse::Method::Signatures requires</p><blockquote><div><p> <tt>&nbsp; &nbsp; PPI [requires]<br>&nbsp; &nbsp; MooseX::Types::Structured [requires]<br>&nbsp; &nbsp; aliased [requires]<br>&nbsp; &nbsp; MooseX::Traits [requires]<br>&nbsp; &nbsp; namespace::clean [requires]<br>&nbsp; &nbsp; MooseX::Types [requires]</tt></p></div> </blockquote><p>and naturally PPI needs</p><blockquote><div><p> <tt>&nbsp; &nbsp; Test::Object [requires]<br>&nbsp; &nbsp; Test::ClassAPI [requires]<br>&nbsp; &nbsp; Test::SubCalls [requires]</tt></p></div> </blockquote><p>and Test::SubCalls wants to have</p><blockquote><div><p> <tt>&nbsp; &nbsp; Hook::LexWrap [requires]</tt></p></div> </blockquote><p>Maybe I'll see where the error is sometime soon. Oh, here we go again, MooseX::Types::Structured needs</p><blockquote><div><p> <tt>&nbsp; &nbsp; Sub::Exporter [requires]<br>&nbsp; &nbsp; Devel::PartialDump [requires]</tt></p></div> </blockquote><p>which I'm quite happy to install, yes, now namespace::clean would like</p><blockquote><div><p> <tt>&nbsp; &nbsp; B::Hooks::EndOfScope [requires]</tt></p></div> </blockquote><p>and why shouldn't it since MooseX::Method::Signatures itself did, but it'll need</p><blockquote><div><p> <tt>&nbsp; &nbsp; Variable::Magic [requires]</tt></p></div> </blockquote><p>which I thought I had installed already, but that must've been another machine. So now we're installing MooseX::Meta::TypeConstraint::ForceCoercion which couldn't live without</p><blockquote><div><p> <tt>&nbsp; &nbsp; namespace::autoclean [requires]</tt></p></div> </blockquote><p>which needs a newer version of</p><blockquote><div><p> <tt>&nbsp; &nbsp; Class::MOP [requires]</tt></p></div> </blockquote><p>which warns me that</p><blockquote><div><p> <tt>***<br>&nbsp; &nbsp; This version of Class::MOP conflicts with the version of<br>&nbsp; &nbsp; Moose (0.69) you have installed.<br> <br>&nbsp; &nbsp; You will need to upgrade Moose after installing<br>&nbsp; &nbsp; this version of Class::MOP.<br>***</tt></p></div> </blockquote><p>Yes, yes, fine fine. But, oh no, finally a test failure in the version 0.01 module MooseX::Meta::TypeConstraint::ForceCoercion. I'll try to get back to you after I analyze the Moose / Class::MOP stacktrace explosion, but in the meantime, yeah sure, put that in the core. Thanks. ^.^</p> slanning 2009-05-03T09:01:30+00:00 journal moving to Amsterdam http://use.perl.org/~slanning/journal/38867?from=rss <p>I've had this for a while in my Bio:</p><blockquote><div><p> <cite> Scott Lanning has been nominally hacking <a href="http://bricolage.cc/">Bricolage</a> at the <a href="http://www.who.int/">WHO</a> in Geneva, Switzerland since 2003. </cite></p></div> </blockquote><p>No more! After more than six years, as of yesterday I'm no longer at the WHO, although I might still nominally hack on Bricolage. I'm moving to Amsterdam to work at <a href="http://www.booking.com/">Booking.com</a>.</p> slanning 2009-04-25T16:06:52+00:00 journal Bricolage 1.10.7 released http://use.perl.org/~slanning/journal/38633?from=rss Bricolage 1.10.7 has been uploaded to the world-wide web. The distribution tarball can be downloaded from <a href="http://sourceforge.net/project/showfiles.php?group_id=34789&amp;package_id=177005">http://sourceforge.net/project/showfiles.php?group_id=34789&amp;package_id=177005</a> or <a href="http://bricolage.cc/downloads/">http://bricolage.cc/downloads/</a> . slanning 2009-03-12T17:59:55+00:00 journal PerlIO spreadsheet2csv http://use.perl.org/~slanning/journal/38348?from=rss <tt>I haven't got it ready for CPAN yet, but I've recently been working on PerlIO::via::Spreadsheet (I don't like the name, but what else could I call it?). It should let you do this:<br><br>open my $fh, '&lt;:via(Spreadsheet)', 'file.xls' or die "Couldn't open file.xls: $!";<br>while (&lt;$fh&gt;) {<br>&nbsp; &nbsp; # spreadsheet emulated as an input stream is translated to CSV<br>&nbsp; &nbsp; # $_ is a line of CSV;&nbsp; &nbsp;(note: for a few minutes this was wrong, updated)<br>&nbsp; &nbsp;<nobr> <wbr></nobr>...<br>}<br><br>The spreadsheet would be whatever Spreadsheet::Read can deal with. Probably more a "neat to hack on" thing than something actually useful. (There are xls2csv utilities already. There are also problems with more complicated spreadsheets that aren't easily handled by a simple IO layer.)<br><br>Another idea I'm playing with is a layer to handle JSON.</tt> slanning 2009-01-27T12:48:30+00:00 journal ok, Perl6:: docs might as well be on CPAN (updated) http://use.perl.org/~slanning/journal/38327?from=rss <p> <b>UPDATE:</b> You're right, I was taking it/things too seriously. <code>$self-&gt;panic--</code> </p><p>----cut-here---8&lt;---------------------------------------------------</p><p>(<i>Note: The following is just my humble opinion, and I don't mean to single out the authors of Perl6::Cookbook or Perl6::Doc. The Subject isn't worded too provocatively, is it?<nobr> <wbr></nobr>:&gt; </i>)</p><p>I don't think it's appropriate for modules like <a href="http://search.cpan.org/dist/Perl6-Cookbook/">Perl6::Cookbook</a> to go on <a href="http://search.cpan.org/">CPAN</a>. First, I don't think it's a good idea mixing Perl5 and Perl6 code on CPAN unless/until there are clear ways to distinguish them. By that, I don't mean that the module begins with Perl6, for example, but that the tools like the `cpan` shell are able to ignore Perl6 code (or compatibility issues are otherwise resolved). On the other hand, Perl6::Cookbook doesn't actually install code.</p><p>And that is my main problem; it is not a useable module. Its content is all under eg/, so it doesn't even install <a href="http://perldoc.perl.org/perlpod.html">POD</a> files. Now, several distributions have their own cookbooks (<a href="http://search.cpan.org/dist/Moose/">Moose</a>, <a href="http://search.cpan.org/dist/Jifty/">Jifty</a>,<nobr> <wbr></nobr>...), but that's different because they are actually documentation of the module, and we certainly don't want to discourage that. Some distributions even separate the docs from the code, like <a href="http://search.cpan.org/dist/YAML-Manual/">YAML::Manual</a>, but again I don't think that's such a big deal (although that one in particular isn't nearly complete<nobr> <wbr></nobr>:) because it's associated to some module; it could be especially useful when those are optional dependencies of the code distribution.</p><p>So I think Perl6::Cookbook is problematic, at least as it's currently implemented, but there is another similar "module" that I'm not so sure about: <a href="http://search.cpan.org/dist/Perl6-Doc/">Perl6::Doc</a>. It contains the <a href="http://dev.perl.org/perl6/doc/apocalypse.html">apocalypses</a>, <a href="http://dev.perl.org/perl6/doc/synopsis.html">synopses</a>, <a href="http://dev.perl.org/perl6/doc/exegesis.html">exigeses</a> for Perl 6. I'm not sure that should be on CPAN, but on the other hand at least it installs POD files. Also, it's sort of like an informal <a href="http://www.ietf.org/rfc.html">RFC</a>. But on the other hand, what use are they being on CPAN since they are already on the pages I linked to?</p><p>(<i>Note: I considered uploading this blog entry to CPAN, but decided not to.</i>)</p> slanning 2009-01-22T11:10:43+00:00 journal $1.5 trillion stolen http://use.perl.org/~slanning/journal/37959?from=rss Am I misunderstanding something, or have the US banks stolen $1.5 trillion in US tax money in the past month or two? It's <a href="http://en.wikipedia.org/wiki/Savings_and_Loan_crisis">not the first time this has happened</a>, either. They kept on deregulating away, and now we get to hear how the bailouts will save the economy. slanning 2008-11-27T14:31:06+00:00 journal Bricolage 1.10.6 released http://use.perl.org/~slanning/journal/37590?from=rss <p> <a href="http://bricolage.cc/downloads/">Bricolage 1.10.6</a> was released. Might be the last one in the 1.10 series. <a href="http://bricolage.cc/about/team/">David</a> will probably release version 1.11.1 soon, which is a "developer release" for 2.0. He's been hacking on the ajaxy stuff recently.</p> slanning 2008-10-02T14:09:17+00:00 journal school text books http://use.perl.org/~slanning/journal/37358?from=rss There's a <a href="http://www.washingtonpost.com/wp-dyn/content/article/2008/09/04/AR2008090403398.html?nav=rss_print/asection">boycott</a> in Chicago by school children from urban schools. In the first paragraph it's mentioned that "they often have to share books<nobr> <wbr></nobr>... meaning they can't take books home to study". At the bottom they talk about spending <b>$120 million</b> over three years to build more schools. Just for Chicago. We have the web now, even in the USA. Why can't money like that be invested in more fundamental improvements that would benefit everybody, like building free, public-domain, online textbooks? At least at the state level. It's like schools are letting textbook publishers steal money from children. slanning 2008-09-05T09:27:18+00:00 journal butterflies dangerous? http://use.perl.org/~slanning/journal/36710?from=rss <p>You hear often about butterflies, but when's the last time you heard about breadflies? Are these apparently harmless insects in fact ruthless genocidal maniacs who have wiped out the breadfly population?</p><p>I may have to retract <a href="http://use.perl.org/~slanning/journal/35917">my opinion about butterflies</a>.</p> slanning 2008-06-18T09:47:19+00:00 journal Bricolage 1.10.5 released http://use.perl.org/~slanning/journal/36271?from=rss After two weeks of furious hacking from <a href="http://use.perl.org/~Theory">David</a>, <a href="http://bricolage.cc/">Bricolage</a> 1.10.5 has been <a href="http://sourceforge.net/project/showfiles.php?group_id=34789&amp;package_id=177005&amp;release_id=595752">uploaded to sourceforge</a>. slanning 2008-04-29T10:22:39+00:00 journal wiimote hacking http://use.perl.org/~slanning/journal/36158?from=rss <a href="http://www.ted.com/index.php/talks/view/id/245">Cool demo</a> (5 mins) hacking a <a href="http://en.wikipedia.org/wiki/Wii_Remote">wiimote</a>, if you like <a href="http://use.perl.org/~pjf/journal/35564">wiimote</a> <a href="http://spazout.com/roomba/">hacks</a>. Note that there is a <a href="http://www.wiili.org/index.php/Perlwiimote">Perlwiimote module on Linux</a> (I haven't used it or a Wii, so couldn't tell you how well it works). slanning 2008-04-15T13:58:27+00:00 journal Continuity and templating http://use.perl.org/~slanning/journal/36011?from=rss <p>I like the idea of <a href="http://search.cpan.org/dist/Continuity/">Continuity</a>. I don't, however, want to go back to using <a href="http://search.cpan.org/dist/CGI.pm/">CGI.pm</a> (or printing strings directly) to generate HTML. That's probably what Brock has in mind with <a href="http://search.cpan.org/dist/Continuity-Widget/">Continuity::Widget</a>. However, sorry, I also don't want to use a widget system hacked up just for Continuity, and that module seems to only be a placeholder right now anyway.</p><p>What I'd really like to do is somehow integrate Continuity with my favorite templating system, <a href="http://search.cpan.org/dist/HTML-Mason/">HTML::Mason</a>. Are these two too different conceptually, though? Mason is based on requests, while Continuity is trying to get rid of them? Not sure yet how Continuity's Mapper and Adapter objects fit with Mason's Request, Resolver, ApacheHandler, Interpret... Anyone have ideas?</p> slanning 2008-03-31T13:12:43+00:00 journal 4-day weekend http://use.perl.org/~slanning/journal/35946?from=rss <p>One happy side-effect of this obsession with <a href="http://en.wikipedia.org/wiki/Eostre">an old German goddess</a> that people have is a 4-day weekend for me. Yay \o/</p><p>So whatever shall I do....? I was thinking of </p><ul> <li>playing with <a href="http://search.cpan.org/dist/Continuity/">Continuity</a> (like <a href="http://www.seaside.st/">Seaside</a> for Perl but not a framework)</li><li>finishing the <a href="http://en.wikipedia.org/wiki/F.E.A.R._Perseus_Mandate">F.E.A.R.</a> series, 3rd game in the pack I bought at home in the USA</li><li>studying <a href="http://www.nthuleen.com/teach.html">German</a> [1]</li><li>reading: <ul> <li> <a href="http://en.wikipedia.org/wiki/Evolution_(Stephen_Baxter)">Evolution</a>, a novel spanning 565 million years of human evolution</li><li> <a href="http://www.livres-online.com/L-Aventure-des-langues-en-Occident.html">L'Aventure des langues en Occident</a>, on the <a href="http://en.wikipedia.org/wiki/Indo-European_languages">Indo-European languages</a> </li><li> <a href="http://books.google.ch/books?id=L0d_Jhz07qsC">From Geometry to Topology</a>, really well written (note: has a chapter on continuity (see above<nobr> <wbr></nobr>:) )</li></ul></li><li>working out (end of 4th week, still at it)</li></ul><p>[1] Also: <code>perl -e'for$i(1..4){for$j("01".."26"){`wget http://mp3.dw-world.de/dwelle/sprachkurse/english/eng-$i$j.mp3`}}'</code> </p> slanning 2008-03-20T15:54:49+00:00 journal idealists versus pragmatists http://use.perl.org/~slanning/journal/35936?from=rss <p>From <a href="http://www.joelonsoftware.com/items/2008/03/17.html">Joel Spolsky</a>:</p><p> <cite>As usual, the idealists are 100% right in principle and, as usual, the pragmatists are right in practice.</cite> </p><p>I wouldn't say 100%...<nobr> <wbr></nobr>:) but it's an interesting article, especially in light of some of the discussion about the <a href="http://use.perl.org/~Alias/journal/35928">Module::Install deprecations</a>.</p> slanning 2008-03-19T11:15:34+00:00 journal I like butterflies http://use.perl.org/~slanning/journal/35917?from=rss Yes, I do. Hello, data miners of 2022. slanning 2008-03-17T09:02:33+00:00 journal ENOIRC http://use.perl.org/~slanning/journal/35750?from=rss <p>If you're on "irc.perl.org" and find there are not very many people on the server, there's apparently a server down somewhere since this morning and you're probably on the wrong side of a <a href="http://en.wikipedia.org/wiki/Netsplit">netsplit</a> . I found that by setting my server explicitly to irc.mangband.org I could make contact with most of the people normally on the servers.</p><p>Hmm, as I say that I notice a desplitting at least from one of the other servers, so this might not be necessary now.</p> slanning 2008-02-25T14:12:51+00:00 journal headless gecko http://use.perl.org/~slanning/journal/35703?from=rss Looks like someone is realizing <a href="http://use.perl.org/~slanning/journal/33566">one of my dreams</a> with <a href="http://simile.mit.edu/wiki/Crowbar">Crowbar</a>:<p><div class="quote"><p> Crowbar is a web scraping environment based on the use of a server-side headless mozilla-based browser.</p></div> slanning 2008-02-20T15:27:09+00:00 journal Geneva sweet Geneva http://use.perl.org/~slanning/journal/35622?from=rss It's the final countdown. Flying back to Europe tomorrow. Not really anxious to get back to work. Haven't done anything for a month, though; need to take off another....year or two. slanning 2008-02-09T14:39:38+00:00 journal Home sweet home http://use.perl.org/~slanning/journal/35503?from=rss <p><cite>Day 11 at home (Ohio, USA)</cite></p><p>Only gained 1 pound so far. Had expected to gain 5 upon entering U.S. airspace, so relatively satisfied.</p><p>3:00pm and haven't even showered yet. Drinking a syrupy "caramel latte" energy drink. Going to go to "the mall" soon, probably watch a movie. $4 compared to the $15 that I pay in Geneva -- yeehaw, Invisible Hand bless America (that joke is for Aristotle, though I doubt he reads this). Whether I see Untraceable or Rambo (has it really come to this?), I'll leave to the mall gods. Neither can be as bad as Meet the Spartans, in any case.</p><p>Have only checked email and my precious <a href="http://use.perl.org/"> <code>use Perl;</code> </a> for the last two weeks -- done nothing programming-related whatsoever. Really burnt out. Hoping to be sufficiently rejuvenated soon and work a bit on <a href="http://bricolage.cc/">Bricolage</a> stuff before going back to work, as have neglected it for a couple months now.</p> slanning 2008-01-28T20:08:17+00:00 journal Dive into Python http://use.perl.org/~slanning/journal/35202?from=rss I'm reading "<a href="http://www.diveintopython.org/">Dive Into Python</a>" over the holidays (Christmas, in case you missed it). I'm getting tired of struggling with porting <a href="http://www.ogre3d.org/">Ogre</a> to Perl, when it seems that <a href="http://python-ogre.org/">Python-Ogre</a> has an easy time with it due to existing libraries like <a href="http://www.language-binding.net/pyplusplus/pyplusplus.html">Py++</a>, <a href="http://www.boost.org/libs/python/doc/index.html">Boost.python</a>, and <a href="http://www.language-binding.net/pygccxml/pygccxml.html">pygccxml</a>. I don't think I can compete with that. And at the least, I could use their gccxml parser. slanning 2007-12-24T22:53:18+00:00 journal Perl Ogre summary and screenshots so far http://use.perl.org/~slanning/journal/35114?from=rss <p>I took screenshots of all the <a href="http://search.cpan.org/dist/Ogre/">Perl Ogre</a> demos. It gives an indication of how the project has progressed over the past few months. Although screenshots are insufficient for animation or sound demos, I give explanations and you can use your imagination. If you want to try them, install the Ogre modules from <a href="http://search.cpan.org/~slanning/">CPAN</a>. Most of these demos are originally from <a href="http://www.ogre3d.org/wiki/index.php/Ogre_Tutorials">OGRE tutorials</a> or the samples that come with <a href="http://www.ogre3d.org/">OGRE</a>, <a href="http://sourceforge.net/projects/ogreal/">OgreAL</a>, and the <a href="http://www.ogre3d.org/wiki/index.php/Main_Page">OGRE wiki</a>, so you could just install those as well.</p><p> <a href="http://aycu37.webshots.com/image/35676/2000018441924575572_rs.jpg">Robot</a> <br> This is the first thing I made work in Perl with OGRE 3D. It loads a robot mesh and attaches it to a scene node, then rotates and scales it. It's a minimal app that doesn't even handle input, so in order to exit you have to close the window then Ctrl-C.</p><p> <a href="http://aycu32.webshots.com/image/37911/2005226460641854814_rs.jpg">Ninja</a> <br> The ninja demo adds lighting, shadows, and a textured plane, and handles input of the Esc key to quit the app. </p><p> <a href="http://aycu32.webshots.com/image/37911/2005226460641854814_rs.jpg">Listening ninja</a> <br> This is the same scene, so the same screenshot, but the demo shows how to use the FrameListener interface to listen for user input events (still only the Esc key). It does this through "unbuffered" input, which means that events are processed by callbacks immediately.</p><p> <a href="http://aycu38.webshots.com/image/35717/2001533052511928311_rs.jpg">Buffered ninja</a> <br> The same ninja but no distracting background, and now we see his back. This demo shows how to do "buffered" input, and was the first one to use the Ogre::ExampleApplication and Ogre::ExampleFrameListener framework (used by the C++ OGRE tutorials). You can move the camera around with the arrow keys (and PgUp/PgDown) and the mouse when you hold the right mouse button. Pressing 1 or 2 toggles the camera position between two locations.</p><p> <a href="http://aycu30.webshots.com/image/36829/2001377752372110167_rs.jpg">Space SkyBox</a> <br> A SkyBox is a texture that's applied to a big box in the background. This demo shows a space scene with planets and stars. In the foreground there's a terrain that has shadows. The camera can move about freely as before.</p><p> <a href="http://aycu14.webshots.com/image/36933/2001341039659681121_rs.jpg">Dark SkyPlane</a> <br> A SkyPlane is the same idea as a SkyBox, but the texture gets applied to a plane instead. If you can never see below a terrain, then you don't need a whole box. This one is really evil looking and reminds me of <a href="http://en.wikipedia.org/wiki/Image:Oblivion.jpg">Oblivion</a>. There is also a dark, exponentially increasing fog.</p><p> <a href="http://aycu03.webshots.com/image/37642/2005154547165753440_rs.jpg">Robot animation</a> <br> This was the first demo where objects in the scene actually moved without moving the camera. The robot has a "Walk" animation which he does on the way to the first waypoint, at which point he gets rotated with a Quaternion to face the last waypoint and continues walking. After reaching the last waypoint, he executes the "Idle" animation, which is what you see in the screenshot. Except it's not moving.</p><p> <a href="http://aycu21.webshots.com/image/36900/2001370054884616174_rs.jpg">Robot dance</a> <br> This is meant to demonstrate adding an Ogre render window to a Gtk2-Perl application. It's a neat idea in principle, but isn't working too well yet. Whenever you click the Gtk2::Button labeled "Dance!", the camera toggles to the opposite side of the robot, giving the impression that the robot flipped around. Sorry to spoil it if you thought the robot really danced. (One step forward and two steps back?)</p><p> <a href="http://aycu02.webshots.com/image/35881/2005127308358656306_rs.jpg">Camera tracking</a> <br> Here the camera zooms around, while always tracking (looking at) the ogre head. The interesting part is setting up the camera movement. To do that, an animation is created with a few "key frames" (waypoints at a certain time), and the animation does a spline interpolation between those points. It therefore <a href="http://aycu13.webshots.com/image/36852/2005191414805834782_rs.jpg">swooshes around like a bird</a> rather than jumping from point to point as in the robot dance demo. (The reason the background gets white is there is a fog applied.)</p><p> <a href="http://aycu12.webshots.com/image/35331/2001353680446959375_rs.jpg">Particle Effects</a> <br> This is the most spectacular demo. There are <a href="http://aycu02.webshots.com/image/37121/2001339143531888149_rs.jpg">two "fountains" rotating around beneath the ogre head</a>, showering particles; flat, smoky rings rotate and rise up around him; rain is falling (easier to see when you <a href="http://aycu18.webshots.com/image/37697/2001302034613889071_rs.jpg">point the camera upward</a>); and bright green blobs of light bubble up from him.</p><p> <a href="http://aycu08.webshots.com/image/37927/2005187732635794215_rs.jpg">Skeletal animation</a> <br> This has ladies, called "jaiquas", sneaking around wearing some kind of futuristic diving suits. They start out around a circle rotated by 60 degrees each one with respect to the next. Each animation is started at a slightly (randomly) different time, and moves at a slightly (randomly) different rate, giving more of a choatic feel as opposed to if they all did the same animation in lockstep. If you press the 'r' button (which you can do with any demo based on ExampleFrameListener), everything is <a href="http://aycu05.webshots.com/image/35044/2005133344282495244_rs.jpg">shown in wireframe</a>, giving a kind of <a href="http://www.fast-rewind.com/tron.htm">Tron-like appearance</a>.</p><p> <a href="http://aycu31.webshots.com/image/38870/2001381949973617167_rs.jpg">Terrain</a> <br> Normally I'd put this after the SkyBox demos, but I want to keep things chronologically ordered here. In the sky demos, you can move the camera freely about, as if it was mounted on a helicopter; you can even pass through the terrain. In this demo, the camera is constrained to always be 10 units above the terrain, so it is more like the camera is mounted on a (very smoothly riding) land vehicle. It reminds me of the 3D battle scenes in the game <a href="http://www.firingsquad.com/media/gallery_image.asp/131/50">Medieval: Total War</a>. The way it works is by using a RaySceneQuery. The ray (long arrow starting from a point) starts at the camera and goes downward, at some point intersecting with the terrain. The scene query part tells you where this intersection is, so you can then update the camera position to always be 10 units above it. It's not as inefficient as it sounds; as you can see in the screenshot, the scene is being updated 330 times per second (with a terrain and fog).</p><p> <a href="http://aycu32.webshots.com/image/36591/2005158388206604344_rs.jpg">Lighting and ribbon trails</a> <br> The ogre head again, now floating in outer space, with shiny lights slowly buzzing around him. The animation of the lights is similar to the camera track demo above, with spline interpolation. The lights are so-called RibbonTrails, which are a stream (trail) of small Billboards. (It's a surprising fact that particle effects are mostly based on billboards: lots of little billboards.) </p><p>At this point I made <a href="http://search.cpan.org/dist/Ogre-BetaGUI/">Ogre::BetaGUI</a> (more accurately, I ported it to Perl from C++), which is used in the following three demos merely to provide a mouse pointer.</p><p> <a href="http://aycu27.webshots.com/image/37266/2005142010519980028_rs.jpg">Robots on a terrain</a> <br> (There's a pun I'll make related to a movie featuring snakes and a "plane" if I can ever figure out how to create a snake mesh in Blender.)<br> This demo builds on the terrain demo. First of all, there is now a mouse cursor that you move around. When you click the left button, a robot appears there. If you hold the button down, you can even drag the robot around. Keep in mind that the mouse is moving in a 2D plane while the robots are being placed in 3D, so we end up using a "getCameraToViewportRay" method to do a RaySceneQuery similar to the one for clamping the camera to the terrain.</p><p> <a href="http://aycu34.webshots.com/image/35953/2005137193610494140_rs.jpg">Robots and ninjas on a terrain</a> <br> Robots versus Ninjas! This demo works the same as the previous one if the mouse is not over a robot; however, if the mouse is over a robot, the robot will be selected and you can drag it around again. It's the same story with RaySceneQueries. A white box shows which one is selected. In addition, you can toggle (with the space bar) whether to place ninjas instead of robots, though the ninjas are scaled wrong so they're like three times the size of the robots.</p><p> <a href="http://aycu12.webshots.com/image/38731/2005110351072528924_rs.jpg">Robot selection by volume query</a> <br> Unknown to the ninjas, the robots are building a <a href="http://ypnblog.com/blog/wpcontent/uploads/star_wars-clone_army.jpg">clone army</a>. This demo shows the PlaneBoundedVolumeQuery and also how to make a good old rubberband box used for selecting multiple objects with a mouse. In the screenshot, I show the scene after I've already made one selection of robots, and I'm now dragging a box around to make another selection (but haven't let up the mouse button yet). (Note: the implementation of the Perl binding is currently a little sucky if you look in performSelection of examples/itute4.pl.) </p><p>At this point I made <a href="http://search.cpan.org/dist/Ogre-AL/">Ogre::AL</a> (binding for OgreAL C++ library). The following three demos are of that, though of course you won't be able to hear the sounds.</p><p> <a href="http://aycu29.webshots.com/image/35388/2005294364416403366_rs.jpg">OgreAL basic demo</a> <br> Background music is playing, something by or for or from "ZeroFactor". The ogre head, floating in mid-air as always, is "roaring". Whereas the music stays at the same volume and appears to come from nowhere, you'll notice the roaring comes from the ogre. If you turn the camera to the left, the roar moves to the right. If you move the camera back, the roar gets quieter like it's moved off in the distance. </p><p> <a href="http://aycu25.webshots.com/image/35424/2005266802323469390_rs.jpg">Directional demo</a> <br> There is a siren, which you can turn on and off. It rotates when it's on, and the sound gets weaker when the horn points away from you. To be honest, it doesn't seem realistic at all. Basically it suddenly decreases in volume when the direction it's pointing in is inside the 180 degrees half circle facing away from the camera, then it suddenly increases again when it's within the 180 degrees facing the camera. I don't know if the demo just isn't finished yet, or if the <a href="http://www.openal.org/">OpenAL</a> library sucks on Linux, or what. <b>UPDATE:</b> the author of OgreAL, Casey Borders, says that <a href="http://www.ogre3d.org/phpBB2addons/viewtopic.php?p=35322#35322">this is a Linux-specific problem</a>. </p><p> <a href="http://aycu20.webshots.com/image/36899/2005283207429383283_rs.jpg">Doppler demo</a> <br> This demo is also disappointing. The car goes around in a circle, but the sound isn't very....dopplery. When I think of a <a href="http://en.wikipedia.org/wiki/Doppler_effect">doppler effect</a>, I think of race cars whizzing by or police sirens as the cop car <a href="http://aycu16.webshots.com/image/36055/2005200162102095554_rs.jpg">speeds past</a>. (Again, I don't know if it's the demo itself or the OpenAL library or my particular system. <b>UPDATE:</b> see update for previous demo.) This demo also has a <a href="http://aycu22.webshots.com/image/38621/2005296656957323860_rs.jpg">more involved example of using Ogre::BetaGUI</a>, which you can see in the upper-right corner. Clicking the arrow buttons adjusts the doppler effect and speed of sound (in principle, at least...). </p><p> <a href="http://aycu20.webshots.com/image/38179/2005123620726207323_rs.jpg">Manually drawing shapes</a> <br> Now back to Ogre, not Ogre::BetaGUI or Ogre::AL. I haven't even uploaded this one to CPAN yet. It shows how you can draw shapes "by hand" rather than creating them in Blender (not that I know how to do that). There is a square, a line, a circle, and an annulus (disk with a hole in it). The first three are pretty basic, you just give the positions of the vertices and that's about it (ok, for the circle you have to give a lot of vertices, but the idea is the same). The annulus, on the other hand, is slightly more involved; you have to draw triangles (in fact, quads made of two triangles each) to create the thickness. If you <a href="http://aycu32.webshots.com/image/37151/2005215094878777960_rs.jpg">look behind the annulus</a>, you'll see that it's only visible from the front. That's because the "normals" to the triangles are pointing toward the front, and the light only reflects that way. (You can easily adjust the "circle_thick" function in examples/manualobject.pl to also add all the triangles in reverse, then it will be visible from both sides.) </p><p>And that's all the demos for now. In the next few months I hope to continue wrapping more of the Ogre API and clean up that module a bit (it's starting to get out of hand, I need to factor out some of the typemapping at least, and figure out how to load each module separately if that's possible). I'm also looking around at physics/collision engines, in particular ones with Ogre bindings such as <a href="http://www.nxogre.org/">nxOgre</a> (PhysX), <a href="http://www.ogre3d.org/wiki/index.php/OgreODE">OgreODE</a>, and <a href="http://www.ogre3d.org/phpBB2addons/viewforum.php?f=12">OgreBullet</a>. The simpler the API the better, and they have to work on Linux.</p><p>There was also a guy on the <a href="http://www.ogre3d.org/index.php?option=com_content&amp;task=view&amp;id=16">#ogre3d IRC channel</a> who mentioned that he was <a href="http://perldoc.perl.org/perlembed.html">embedding perl</a> into his (otherwise C++) game engine and then basically wrapping <b>some</b> useful parts of Ogre in <a href="http://perldoc.perl.org/perlxs.html">XS</a>. It's something I've been thinking about, whether it's worth it to continue wrapping so much in Perl when in fact I'm not sure if I would ever use it myself if I actually made a game. </p> slanning 2007-12-16T20:24:03+00:00 journal Ogre::AL - 3D audio http://use.perl.org/~slanning/journal/35108?from=rss I uploaded a module Ogre::AL to CPAN a little while ago. It allows you to attach sound to scene nodes in OGRE 3D, so you hear the sounds coming from their location within the scene. You can play sounds not attached to nodes, too. slanning 2007-12-15T20:04:16+00:00 journal OGRE3D Perl screencast http://use.perl.org/~slanning/journal/34921?from=rss <p>I made a <a href="http://dl.free.fr/getfile.pl?file=/wibNiURi/ogre-perl-demo-withcode.ogg">screencast/desktop capture</a> ("Telecharger ce fichier", bottom right - link valid 30 days) of the <a href="http://www.ogre3d.org/">OGRE 3d</a> demo I'd planned to present at the <a href="http://conferences.mongueurs.net/fpw2007/">French Perl Workshop</a> (I didn't go <a href="http://flickr.com/photos/20864368@N00/2040686697/">because of a transportation strike in France</a> and bad communication on my part).</p><p> <b>N.B.</b> The resolution sucks and the animation is jerky. That was due to the <a href="http://live.gnome.org/Istanbul">screen capturer</a> (that running at the same time as the demos overloaded my CPU I guess, or maybe the X server), not due to Perl; normally they run smoothly and look much better. If you want to see for yourself, install <a href="http://search.cpan.org/~slanning/Ogre/">the module</a>.<nobr> <wbr></nobr>:)</p> slanning 2007-11-18T21:39:22+00:00 journal Ogre again http://use.perl.org/~slanning/journal/34912?from=rss <p>It took about 2 months to get another release of <a href="http://search.cpan.org/~slanning/Ogre-0.30/">Ogre</a> out, but there it is finally. I was stuck trying to make a script to generate all the XS for the whole API and went down a few dead-ends.</p><p>I've added three examples, all ported from OGRE's sample applications in C++. One zooms the camera around while keeping it tracking on an Ogre head. A second one is a really pretty particle-effects demo, like fireworks or particle "fountains". The third shows "skeletal animation", and is really cool how the ladies creep around.</p><p>The next demo I'm working on is showing how to make the camera (or whatever scene node) maintain a constant height above a varying terrain (the "Terrain" sample application in OGRE). That uses "ray queries" which are just vectors pointing down from the object and you query whether the vector pokes through anything (in this case the terrain). The demo puts me in the mind of "Medieval: Total War", the 3-d battle scenes (except without any units or anything).</p> slanning 2007-11-16T20:03:27+00:00 journal mod_perl2 http://use.perl.org/~slanning/journal/34692?from=rss I've wasted so many hours trying to port <a href="http://svn.bricolage.cc/bricolage/branches/dev_apache2/">Bricolage</a> to <a href="http://perl.apache.org/docs/2.0/user/porting/porting.html">mod_perl2</a>, and it's still not there. Me hates. slanning 2007-10-16T14:21:07+00:00 journal gcc-xml http://use.perl.org/~slanning/journal/34485?from=rss <p>For my current library-wrapping project, I want to automate more of the bindings generation. It's a C++ library, so I'm parsing C++ headers. At first I did that kind of manually, which wasn't pleasant. Then someone pointed me to <a href="http://www.gccxml.org/HTML/Index.html">gcc-xml</a>, which does indeed parse the C++ headers and outputs an XML file. A 25MB XML file, in fact, for the particular headers I used it on. The XML file is fairly easy to figure out, though following (dereferencing) all the ID numbers pointing to other elements is tedious.</p><p>So, two purposes: 1) Let people who've never heard of gcc-xml know about it. 2) Ask if there is anything else people use to (help) parse C++ headers.</p><p>Third purpose: ultimately I'll only have a sloppy, one-off XSUB generator for my specific needs. I'm suggesting, then, that someone, like a university student with too much time and more l33t C++ and XS skillz than me, might find it an interesting project to look into generalizing this to automate generation of Perl bindings for any C++ library.</p> slanning 2007-09-19T12:30:46+00:00 journal Ogre in gtk2-perl and wxPerl (almost) http://use.perl.org/~slanning/journal/34466?from=rss <p>In the release of <a href="http://search.cpan.org/~slanning/Ogre-0.28/">Ogre that I just uploaded</a>, there's new support for embedding Ogre in gtk2-perl and wxPerl. I don't have enough minutes to go into it now, but here's a picture: <a href="http://aycu34.webshots.com/image/27753/2001938626600512939_rs.jpg">robot dancing</a>.</p><p>Basically, Ogre is focused on graphics, so it requires other libraries to do things like user input. I wrapped OIS for that, but for making better GUI apps it's cool to be able to integrate with Gtk or wxWidgets. I want to look at SDL also. Further down the line, maybe OgreODE as a physics engine.</p><p> <b>UPDATE:</b> I meant to add that the wxPerl support isn't quite working, or at least the example isn't. Also, I'm not sure if <a href="http://search.cpan.org/src/SLANNING/Ogre-0.28/perlOGREGUI.cpp"> <code>gtk_widget_get_parent_window(widget)</code> </a>is correct to call; I just copied it from what I found online, but it seems to get the wrong "parent" window. I need to work on the examples more. I'd like to get something like the <a href="http://www.ogre3d.org/wiki/index.php/GtkOgre">GtkOgre widget</a> working for gtk (it's pretty complicated to work out how to convert from C to Perl, though...). The wx example is (intended to be) a direct port of <a href="http://www.ogre3d.org/wiki/index.php/WxOgre_for_OGRE_v1.4">this WxOgre tutorial</a>, but isn't working right yet.</p> slanning 2007-09-16T20:10:41+00:00 journal Perl book sales http://use.perl.org/~slanning/journal/34439?from=rss On the <a href="http://poe.perl.org/?POE_Support_Resources/POE's_mailing_list">POE mailing list</a>, <a href="http://www.mail-archive.com/poe@perl.org/msg03795.html">someone guessed</a> that books like "<a href="http://www.oreilly.com/catalog/perlbp/">Perl Best Practices</a>" and "<a href="http://www.oreilly.com/catalog/perlhks/">Perl Hacks</a>" have probably sold 2000 copies max. Is it true? I wouldn't've guessed they are best-sellers, but that seems really low.... (Are you sure Perl isn't dying?<nobr> <wbr></nobr>:)<nobr> <wbr></nobr>:) slanning 2007-09-13T11:06:53+00:00 journal