3D is hard, let's go shopping

You know, the thing that sucks most about programming OpenGL is the complete and utter lack of feedback or debugging tools when things go wrong. "Oh look, my textures aren't showing up. I wonder why. Oh look, my objects aren't lit right. I wonder why."

The API for attaching lights and textures is not only obscure, but has essentially no error conditions: the stupidest mistakes are technically "legal", so you can never figure out what went wrong except by staring at the code for days until enlightenment comes. Which is what I'm doing now. That and getting increasingly frustrated, and trying to remember why I thought this would be a "fun" thing to hack on.

After having been hacking OpenGL for years, and even having written Lightlab to help me figure it out, I think I understand the OpenGL lighting model -- but I still feel like I just have no idea how to do lights in GL. I understand how ambient, diffuse, and specular coloration are computed, but when it comes to actually making the dozen glLightfv() and glMaterialfv() calls, everything goes totally nonlinear, and I end up spending days just trying random things until I find something that almost doesn't look totally like ass.


Tags: ,

19 Responses:

  1. malokai says:

    on the other hand, you could be using Direct3d.

  2. altamira16 says:

    I saw another reference to it in LJ today.
    XXXX is hard, let's go shopping

    • jwz says:

      A few years ago, there was a talking Barbie that said, among other things, "Math is hard" and "Let's go shopping." And later, Vengence is mine."

      • baconmonkey says:

        So I did some poking around trying to confirm the origins of the "math is hard" line, because it seems so unbelievable that a toy company would actually produce such a thing. Snopes has no entries on it either way. everything seems to claim barbie said that, but I've found no audio samples. But this is a story claiming to have actually owned one of them, so I guess even I can be accused of giving the human race too much credit.

        I did, however, find that barbie has a blog, and has a few friends who have blogs too.


        but at least G.I. Joe, or rather, a cobra recruit has a blog too http://www.mcsweeneys.net/2002/01/02cobra.html

        • altamira16 says:

          I was in my teens and it was making the news a lot, and I was horrified about Barbie saying that because it seemed that around high school that a lot of people, especially girls just gave up on math and the sciences.

        • I looked this up a couple months ago. It's "Teen Talk Barbie", released in 1992. Each doll knows 4 phrases chosen randomly from 270 possible phrases, one of the possible phrases is "Math class is tough!", so there was a 3.7% chance of getting a Barbie that will say that. After the outcry, Mattel removed that phrase from the list.

    • and that would be about ALL that our posts had in common!

      (assuming you're referring to mine; if there's a third out there that would be freaky.)

      and now, in retrospect i'm thinking that it should have been, "research is hard, let's go clubbing, which is a much more accurate depcition of the truth....think i'll go change it.

  3. tbye says:

    Never hurts to ask... but he's probably not very approachable. You never know.

  4. Would it perhaps be productive to break your lighting code into a seperate mini-library that reads the lighting setup from a file or pipe? Either way, you could modify Lightlab to write lighting configurations; in the latter case, you could use it interactively play with your program's lighting setup.