LWJGL Orthographic projection render order based on Z

My problem is that everything renders in order: newest vertices appear on top of older ones. I want vertices with that are pointing out of the screen (Z negative?) to be rendered on top of vertices that are into the screen (Z positive?)

Atm I’m using glOrtho from GL11 class.


		glMatrixMode(GL_PROJECTION);
		glOrtho(0, Display.getWidth(), Display.getHeight(), 0, -1, 1);

Here is my vertex shader.


#version 120

attribute vec3 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord;

varying vec4 v_color;
varying vec2 v_texCoords;


void main() {
	vec4 pos = vec4(a_position, 1);
	
	v_color = a_color;
	v_texCoords = a_texCoord;
	
	mat4 proj = gl_ProjectionMatrix;
	gl_Position = proj*pos;
}

Here is the image i’m getting.

Here is how I want it to look after changing Z values (I changed render order)

I think this is a problem with projection matrix.
Here is my spritebatcher, I hope I didn’t make silly mistake when implementing Z axis…
http://www.java-gaming.org/?action=pastebin&id=892

It has few bugs, but they don’t bother me. (Not flushing when spritesheet is different and some others maybe) and also it is not very efficient, but I don’t really need efficiency here.
For now I just want to resolve the Z axis.