It's alive

Today I implemented about two-thirds of the OpenGL 1.3 API in terms of the OpenGLES 1.0 API.

Gibbering commences now.

Though it's actually been a lot easier than that time when I implemented four-fifths of Xlib in terms of Cocoa.

Here's a gem: look upon my works and despair.

#define WRAP(NAME,SIG) \
void jwzgles_##NAME (ARGS_##SIG) \
{ \
if (state->compiling) { \
void_int vv[4]; \
list_push (STRINGIFY(NAME), (list_fn_cb) &jwzgles_##NAME, \
PROTO_##SIG, vv); \
} else { \
} \

WRAP (glTranslatef, FFF)


Tags: , , ,

18 Responses:

  1. You truly are the King of Kings.

  2. AutoJack says:

    It took me a couple of minutes of saying, "WTF, that's not Ruby," before I realized that you meant gem in the more (though perhaps not most) traditional sense.

  3. Dan Mosedale says:

    And the motivation for doing this was....

    • Roger says:

      If only there was a Previously link at the bottom of the post that explained it and gave more context.

  4. Display list emulation . . . that's a circle of hell right?

  5. anonymouse says:

    Of course real OpenGL implementations don't have preprocessor hacks like that... they have perl scripts to auto-generate all the terrible boilerplate and then do something terrible involving function pointers and dispatch tables to pick the right implementation (execute immediately or compile into a display list or throw an error because you haven't called glBegin).

    • jwz says:

      I considered going down that path, but then I thought, hey, instead I could dick around with non-Turning-equivalent textual-subsitution-based half- or even quarter-assed preprocessors and spend all my time thinking about how you can't cast a double to a void* because blah blah blah registers blah blah it's still 1972.

      All I wanted was #'defadvice. Is that too much to ask? Yes. Yes it is.

  6. Since you no longer work in software, is this just a masochism thing for you nowadays?

  7. LionsPhil says:

    Xlib in terms of Cocoa

    Yers...I remember rummaging through the Xscreensaver source code to see how you'd ported all the hacks to Mac, and being horrified by jwxyz.c.

    Amusing comments, though.

  8. ank says:

    Curious... why did you do that? Thanks!