Two questions: z axis in ortho2d mode? memory problem on win98, properly cleaning up

Hey i just starting learning openGL a few days ago, and one of the main reasons I wanted to use it I’m discovering isn’t possible. I wanted to be able to use the Z axis to layer sprites in a 2d game, as it would be a much easier way of coding than to handle it via my trademark slop code. I’ve been able to get ortho2d mode to work but it renders the z axis useless for this purpose and puts me in the same situation I was in with other 2d graphics libraries. Is there either a) a way to enable the z buffer in ortho2d mode, or b) an ‘easy’ work around.

second question. I’ve having a REALLY bad time developing on my windows98 box. Everytime i run my app a few times, the computer starts complaining about insufficient memory, my computer is rendered useless, and I have to reset my tower. I’m using SDL to open up my window, and I’m calling atexit(SDL_Quit); is there any other clean up commands I need to be calling? I can’t imagine this behavior being normal. All i’m doing is calling up an 800x600 window with one quad… I have plenty of ram and video ram on this computer. So … it’s really frustrating.

Thank you sooooooo much for your help.

Well, you enable the depth test with glEnable(GL_DEPTH_TEST). If you can’t get depth testing to work properly with orthographic projection, using standard OpenGL calls, you’re likely doing something wrong.

Excellent! Thank you so much. The z axis works just like I hoped it would now

Can you offer any help with my memory/crashing problem? It just happened again and it’s very frustrating. Ever 2 or 3 runs of my app and I end up having to restart windows… I can post the source if need be.

I was once like you so I feel the pain…
First off if you can render from back to front i mean drawing your background first then the next thing and the thing in front of that… got me? Then you may not even need the z axis or a depth buffer at all.

The insufficiant memory problem generally happens from memory leaks in the code… (would help to know the actual message but ohwell)
It can be nasty and sometimes gives you the blue screen and you have to reboot correct? Switching to XP can help that since it’s much more stable. otherwise you’ll have to find and fix the memory leaks and it should stop crashing…

unfortunately, I can’t think of anything in my code that would cause a memory link. I barely even added any code. The majority of what i have so far is just some framework I patched together from copy+pasting a number of different tutorials + code of my own from an older sdl project. Then i just drew two quads in 2d space.

here’s the source, it’s more comments than code because it came from tutorials http://patrickavella.com/problem.htm

but… i can’t think of anything that would be causing a memory leak. I suppose it’d be a good time for me to learn to use the debugger… but, still

and thanks everyone for your help.

Apparently stripping out some unneeded code to enable culling completely fixed the problem. Thanks again. imaginary locks topic