Filed Under: Journal - Development - Game Development
I spent a whole bunch of time thinking about things and working through some design problems and was all ready to make some serious progress tonight. Instead I seem to have run into a brick wall. My sense of spatial acuity seems to be about as finely tuned and a blind, drunk and high gopher.
I'm writing some testing code to make sure I have a decent grasp on GL before moving forward - and I don't mean any real skill, I mean a grasp - and it would seem that I have none. I was under the distinct opinion that OpenGL took care of the layering of geometry when it was sent to it. In fact in checking every working example I can get my hands on, it does indeed seem to work properly regardless of the order in which geometry is passed to it. To be more specific: if I draw a quad and point a camera at it, then draw a second quad behind it (with respect to the camera) it should be obscured. Specifically, it shouldn't be drawn at all. That doesn't seem to be the case for the test I'm working with right now. If I draw a red quad and then a green quad behind it, I see both. To add to the problem the green quad is smaller as it should be, so I know that my vertices are right.
I have no idea where to go from here. This is such a stupid question that I'm not sure where to look for an answer. The examples I've been looking at don't seem to do any special ordering to make sure the geometry is pushed in reverse order with respect to the camera and they all seem to work fine. Perhaps it's "built in" to the system they are using, but some of the examples are pretty darn simple, and the camera may be positioned both in front of and behind the geometry drawn and things are obscured as they should be. Of course this flies right in the face of what I'm doing now.
Anyway, this is frustrating. I had a bunch of things I wanted to move forward on tonight and suddenly I feel like a stark novice. Again. This is getting tiring.
... As I've said before - time has passed, but you don't know that ...
I feel slightly less idiotic now. It would seem that depth checks to hide obscured geometry has to be enabled. I now seem to recall reading something about that long ago, but it must not have stuck. That and by sheer luck my landscape test worked without this enabled, so I never thought to look before. That's right, glEnable( GL_DEPTH_TEST ) has to be called before it behaves as I had expected. Yay for me. I'm not losing my mind.