Only last set of vertices render

Alright here goes, I am in the middle of porting our rendering from fixed-function to fully programmable with a 3.2 core context and glsl 1.5. Whenever we wish to render to the screen (image, text, shapes) we call a function that fills an array with our vertices and writes that to the VBO (Only have 1 VAO and 1 VBO). After that I bind the shaders and the VAO and then glDrawArrays.

This results in only the last set of vertices being rendered on screen. In the particular test I have, there is a box near the lower left corner that renders and when you click the mouse another box appears at the cursor (like a gunshot). When the shot comes on screen for a second the lower left box disappears and reappears.

I can't seem for the life of me to render multiple 2d objects onto the screen at once. I have gone so far as changed the fillArray function to create a new VAO and VBO each time it is called to no avail.

Does this problem standout to anyone? I can provide code samples if needed.

If your clear the screen in drawVertexArray, then each call you make to it will clear the screen of previous contents.

Thanks Dan I completely overlooked that! Without clearing the screen though the graphics stay on the screen when moving the mouse around and such and I have intense flashing right now. Should there be a clearScreen call somewhere?

Second issue revealed is my matrix doesn't seem to be correct... It should be a ortho projection against a viewport size of 800x600. Here is the code:

You typically clear the screen at the start of the frame, render all the objects that need rendering, then swap the back and front buffers using SwapBuffers() / SDL_GL_SwapBuffers() or equivalent. Some common reasons for flashing/flickering are:
1) When using single buffering you can sometimes see each new object being drawn which causes flashing as objects appear + are drawn over quickly
2) Using double-buffering without clearing the screen (or without drawing to every pixel) each frame, which can result in contents of previous frames re-appearing when you swap buffers
3) Drawing objects with very similar depth values can give z-fighting that causes flickering as the camera moves (when depth testing is enabled)

I can't see anything immediately wrong with the matrix code, although it's a little unusual to have up=(0,-1,0). What do you mean by "doesn't seem to be correct"? If you have resized the window after the context was created, you will probably want to call glViewport afterwards.

The initial size of the viewport is set to the size of the window used for rendering so not strictly needed then (but won't hurt), but when resizing you'll want to adjust it.

You may also want to adjust the viewport for drawing things like mini-maps, multiple views etc. but remember to set the scissor rectangle too if you do this since it's possible to draw on pixels outside the viewport. A simple example of when this can happen is when drawing large points near the edge of the viewport; it will produce pixels drawn outside the viewport. Once the centre of the point leaves the viewport the entire point will be clipped by the clip volume, in which case you might want a viewport larger than the window (extended by half the max point size in each direction) so that it gradually disappears off screen rather than suddenly vanishing when half visible.

In the most recent versions of OpenGL there are also multiple viewports/scissor rects available, so if for example you wanted to view something from multiple angles (eg. for stereo or design work) could set multiple different viewports/scissor rects and in the geometry shader emit a copy of the primitives to each viewport resulting in multiple copies in a single pass.