Not logged inGosu Forums
Forum Gosu Homepage Help Search Register Login
Up Topic Gosu / Extending Gosu / TexPlay: now working in 1.9.3
- - By chrismdp Date 2011-11-07 23:49
Hi all,

Couldn't bear not to have the neat smoother GC in 1.9.3, which starts to deal with the final outstanding issue raised by this post: http://gafferongames.com/2009/01/11/ruby-is-not-at-all-suitable-for-game-development/

Unfortunately TexPlay wasn't 1.9.3 compatible. No longer! I've taken the liberty of patching it to support 1.9.3. I've put up a pull request, but in the meantime use my fork in your Gemfile:

gem "texplay", :git => "git://github.com/chrismdp/texplay.git"

Note: you can no longer refer to instance variables in the image blocks - I needed to head back to using instance_eval, rather than a custom extension, as 1.9.3 removed the API it relied upon.

Enjoy! Feedback on the patch welcome, especially on platforms that aren't OSX Lion.

Chris
http://pa.rsons.org
http://twitter.com/chrismdp
Parent - - By Spooner Date 2011-11-08 12:13
I have to admit that I never used the gen_eval in Texplay since it was never very clear where the variables were coming from and going to (I actually use a pure-ruby "partial eval" in Fidgit for cases like this, but it isn't appropriate for Texplay since it is very slow - I use it for creating nested GUI elements which is only done once).

I've been able to use the existing TexPlay release for my own games in 1.9.3 because I don't use that particular feature. So, erm, no point me testing the patch then :)

Regarding the GC, I actually notice it working more in 1.9.3, but only because the performance is so much higher and my current game project has a relatively static display (so I can see the FPS dip every few seconds when I'm drawing exactly the same things - this won't be apparent when I have more going on in the background and my FPS isn't quite as artificially high). I have never seen the effect of the GC in my Gosu games (with 1.9.2), but I did in the game I made with Mon_Ouie's Ray library (I should try that with 1.9.3!).
Parent - - By chrismdp Date 2011-11-08 12:21
Interesting: I didn't use the gen_eval stuff either, but couldn't even install the gem under 1.9.3-p0 as it failed to compile. I got errors similar to this when including texplay in my Gemfile. How did you manage to compile against 1.9.3 ruby?
Parent - By Spooner Date 2011-11-08 12:23
Sorry, I didn't compile it. I was just using the binary gem compiled for 1.9.2 and it worked fine (I think I might have needed 'Config = RbConfig' before the require; I did for most older gems). Using win7x64 and 1.9.3p0.
Parent - By jlnr (dev) Date 2011-11-08 12:32
Yay for Texplay progress. :)

If you want to fix Texplay completely, you could make it use Image#to_blob for retrieving image data, and Image#insert to update it back- that would give Texplay support for images >1022x1022. But I think Texplay works with floats and both methods use byte quartets. :(
- - By Omegas7 Date 2012-05-13 15:31
So right now (months after this topic was posted), I am using the latest gosu version and ruby 1.9.3. Should I do what this topic says or is everything already fixed right now?
Parent - - By pete_mw Date 2012-05-13 17:45
As far as I'm aware, the OP's patches have been merged into the original version of the gem already, but there's no up-to-date binary version of the gem available.

If you're on Windows and you have the devkit installed, you can build Texplay yourself. You need to get FreeGLUT (precompiled for Windows here) and extract it to /your/path/of/choice (so that there are folders named bin, lib, and include immediately under /your/path/of/choice).

Then, anything equivalent to this command should build and install texplay for you (won't work in Powershell):

ruby -S gem install texplay -- --with-opt-dir=/your/path/of/choice

I'm not sure how to get this to work with Bundler, unfortunately.
Parent - - By RavensKrag Date 2012-06-04 06:56
How would one do this in windows? Is the the path format the same? Do I use backslashes instead, as per Windows convention?
Parent - By pete_mw Date 2012-06-04 10:28
These are the Windows instructions -- you can run the command using Cmd or by typing it straight into the Start menu search box (on Vista and 7).

/your/path/of/choice is a placeholder. It doesn't matter what path you use as long as it doesn't contain spaces.

For reference, Windows works just fine if you use forward slashes as a directory separator.
Parent - - By RunnerPack Date 2012-07-14 23:35
For the record, I just did this with the latest RubyInstaller and Devkit and it worked, unlike a charm. I extracted the FreeGlut stuff straight into the devkit root (C:\RubyDK on my system), since there were already bin, lib, and include dirs there, and ran the above command in an MSys terminal window with "/usr" as "/your/path/of/choice" like so:
ruby -S gem install texplay -- --with-opt-dir=/usr
BTW, XP Pro SP3.
Parent - - By Spooner Date 2012-07-15 09:51
Thanks!

Can you compile it in both 1.8 and 1.9 and merge it, so that both .so files are in it please, and attach it here? Then banister can gem push it and we can all go on with our lives :)

Alternatively, can you give me a link to the _correct_ freeglut binaries/headers and I can compile it myself. I've tried a few times before with no success, but I found several freeglut versions which failed to different degrees. This option would help me, because then I could consider working on Texplay in the future; pointless if I can't compile it myself.
Parent - - By pete_mw Date 2012-07-15 15:07
I've only tried this for 1.9.3, since the 1.8 series is basically deprecated.

Assuming you tried the MinGW version of FreeGLUT from the link I posted above, do you recall what problem you had?
Parent - - By Spooner Date 2012-07-15 15:29
Sadly, a lot of people (not me) disagree about 1.8. The fact that 1.8 is still the system Ruby on OSX is a major factor in this, since it allows apps to be distributed to any Mac easily. Still, 1.9 is enough for me personally (e.g. my gems are mainly 1.9+); we can see how happy banister is with that!

I've added,

    $CFLAGS << " -I#{File.expand_path "../vendor/freeglut/include", __FILE__}"

to the extconf.rb file in Texplay and placed the MinGW stuff to match that location. I still get:

    checking for main() in -lfreeglut_static... no

It is presumably not finding: lib/libfreeglut_static.a ? I wish it was more clear!

log says that it is passing
     -IC:/Users/Owner/RubymineProjects/texplay/ext/texplay/vendor/freeglut/include
which is correct. What am I missing?
Parent - - By pete_mw Date 2012-07-15 19:05
Yes, I'm pretty sure that is the problem.

Specifically, it looks like line 17 of extconf.rb: exit unless have_library("freeglut_static"), is the one that checks for the library and aborts if it's not there.

It might work if you change it to exit unless find_library("freeglut_static", "main", freeglut_lib) where freeglut_lib is the path to the folder containing libfreeglut_static.a
Parent - By Spooner Date 2012-07-15 21:31 Edited 2012-07-15 22:00
I've got it working, sorted out quite a few things (e.g. included freeglut so we never have to worry about where it is when building) and made it easy to create a fat Windows gem on Windows :) Just need to poke Banister about a few things and then I can get him to push it :)

Thanks for your help!
Parent - By Spooner Date 2012-07-23 15:19
Banister has pushed 0.4.3 with both ruby and Windows binary versions. Poke me if there are any problems, since I built them!
Up Topic Gosu / Extending Gosu / TexPlay: now working in 1.9.3

Powered by mwForum 2.29.1 © 1999-2013 Markus Wichitill