Ruby + SDL + OpenGL 2
I started playing around with Ruby, rubysdl and ruby-opengl tonight. I’m not really sure where the last 6 hours went…
In six hours I went from knowing almost no OpenGL, a basic understanding of Ruby, and absolutely nothing about SDL to having a full screen OpenGL app written in Ruby that shows the JPGs in the current directory in a coverlow-esque manner that you can flip through with the left and right arrow keys. I’m amazed. The whole thing is only like 200ish lines long, and I’ll attach it so if anyone finds it while looking up how to do OpenGL stuff in Ruby you can maybe benefit from my hours of digging through random documentation and websites. It’s really strange, but the only actual OpenGL/GLU documentation I could find was in PDF form…that’s nuts.
Sometime after I get some sleep I’ll try to write up some tutorials.
Edit: So, I can’t figure out how to attach things right now, I’ll get it up later.
Edit: Here’s a link to download: Source
Edit: Here’s a link to look at it online: Online Source
Trackbacks
Use the following link to trackback from your own site:
http://www.staticmethod.net/trackbacks?article_id=ruby-sdl-opengl&day=31&month=01&year=2008
Hi thank for this good source. To run it corectly i have fixe some bugs.
1) dont write glBindTex… but GL::BindTex… (idem not glublabl but GLU::bla
2) GL::LoadIdentity() but GL::LoadIdentity() 3) idem for GL::End but GL::End() 4) not GL::Translatef(a,b,c) but GL::Translate(a,b,c) 5) idem for Vertex Scale and Rotate
6) lol but think that you need specifique texture dimention ex: 128128 256256 or 512*512 (but the last need lot-of memorie and slow_down your code)
happy-ruby
ranska
here the code with bug fixed and tested in Linux Mandriva-2007/spring
ps: I dont know why but in the prewiew some part of the text are bold? and new line not respercted:(
Ranska, Thanks for the comments, I’ve actually done quite a bit of work since posting this. I’ll be pretty close to posting an update and providing a link to my SVN repository pretty soon hopefully.
I’m not sure why doing the
include GL, etc didn’t work for you. The gl* methods are part of the GL module. I think you might be using an older version of the ruby-opengl gem, their tutorial seems to indicate that what you provided is their old naming structure.