Home | Rules and Guide | Sign In/Create Account | Write a Post | Reddit | #LD48 | #ludumdare on irc.afternet.org (Info)

Ludum Dare 31 — Coming December 5th-8th 2014! — Join the Mailing List!
  • Ludum Dare 31 begins: in 80 days, 1 hour, 30 minutes, 26 seconds
  • (Time might be off, we’ll have it right soon)


    Dynamic OpenGL for LuaJIT

    Posted by (twitter: @kamjau)
    April 20th, 2012 2:37 pm

    I’ve been toying around with LuaJIT lately. If you’re not familiar with LuaJIT, it’s a just-in-time compiler that not only makes your Lua code run super fast, but it also makes it possible to call native code from Lua without any native glue code at all. Pretty cool tech.

    OpenGL requires some special handling though, so I made an OpenGL loader for it that handles all the dynamic loading, version differences and extensions and such for you (based on the official spec files), and added some extra code to make shaders easier to work with. I didn’t really plan on using this for LD, but hey, might as well post it now so that I have the option: ld23base.zip (zlib license)

    That zip includes some example code using SDL + OpenGL to draw a spinning rectangle in pure Lua =).  I doubt anyone else will use this, but you’re of course welcome to if you want =). Please let me know if you do! It’s a bit WIP-y still, but fully usable and should be pretty straightforward if you’re familiar with SDL and OpenGL. It probably requires LuaJIT 2.0 (beta) to run, and it’s only been tested on 64-bit Linux, but it should hopefully run on anything supported by LuaJIT as long as SDL and OpenGL libs are available.

    Tags: , , , ,

    Leave a Reply

    You must be logged in to post a comment.


    All posts, images, and comments are owned by their creators.

    [cache: storing page]