Draw Order and Scene Graphs

So i did an experiment with my custom game engine and came to a realization … and now i need some advice.

Realization : render order matters.

What i saw: objects that are farther away from the camera are being rendered “in front” of closer objects for no other reason than they were “drawn” after the closer one. this results in a pretty trippy effect when you navigate the world…

So … i may need some way of ordering the meshes before rendering them on each draw pass… what is an effective way of doing this since what is “close” is relative to the camera position and thus will change.

What im really hoping is that the video card was just going to do this for me. So perhaps i missed a switch that i need to enable in my openGL code?

thanks in advance for any advice.

j.