Metaballs and Gravity game;
Refactoring code structure

As of right now, you have:


A struct named Object.
A global std::vector&lt;Object&gt; of Objects.
A function named attraction, which (I assume) calculates the attraction between two separate Objects.
A function named render which (I assume) renders all of the objects in bodies.


While this structure works fine, it's somewhat rigid and will probably cause you issues in the future if you ever try to expand this project by any significant amount. Instead of having this structure, I'd recommend that you design something more akin to the following:


A struct (or class) named Object which represents a gravitational body, with the following member functions:


CalculateAttraction(), for calculating object attractions.
Update(), for updating anything related to the object, like position, etc.
Render(), for rendering the object.

A struct (or class) named ObjectManager which is used to store and manage objects, with the following member functions:


AddBody(), for adding a new gravitational body.
Update(), for updating the object manager and its stored Objects.
Render(), for rendering the object manager and its stored Objects.

A top-level Update() function for GLUT to use.
A top-level Render() function for GLUT to use.


While you don't have to follow this exact structure (you may also need additional behaviors included with the ones I provided), it will make managing and expanding this project much easier.

Using const instead of #define

In C++ (and even later versions of C), it's always better to use const (or constexpr in some special cases) for defining constant values rather than a macro. Using macros can often lead to obscure and confusing issues popping up, especially if you're overzealous in your use of them. The macros in your code (excluding GLEW_STATIC) should be declared as:

const int WIDTH = 800;
const int HEIGHT = 800;
const float AU = 149.6e6 * 1000;
const float SCALE = 250 / AU;
const float G = 6.67428e-11;


Instead of:


#define WIDTH   800
#define HEIGHT  640
#define AU      (149.6e6 * 1000)
#define SCALE   (250 / AU)
#define G       6.67428e-11



Nitpicks


You have a small bug in your code where you #define GLEW_STATIC. In order to use GLEW properly as a static library, GLEW_STATIC must be declared before you include glew.h. You'll also likely have to change "glew32.lib" to "glew32s.lib". Example:

#pragma comment(lib, "glew32s.lib")

...

#define GLEW_STATIC
#include "glew.h"

Please don't ever use using namespace std; in your C++ code. It's a very bad idea. See this Stack Overflow post for the reason why.
The variable bodyIndex is poorly named and unnecessary. std::vector&lt;T&gt; already has a size() function which returns the number of elements in the vector.
While you mentioned that you know you used the fixed function pipeline, I'm going to recommend against it anyways. It's deprecated in a lot of graphics hardware and sometimes requires some special workarounds to get working. It's also much less flexible than the programmable function pipeline.
The various #includes and #defines at the beginning of your code are are grouped together in one big cluster, which isn't very visually appealing. I'd highly recommend separating them into distinct groups, like so:

#pragma comment(lib, "glew32.lib")
...

#include &lt;stdlib.h&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;iostream&gt;
#include &lt;fstream&gt;
...

#define GLEW_STATIC
#include "GL/glew.h"
#include &lt;glut.h&gt;
...

#define WIDTH   800
#define HEIGHT  640
#define AU      (149.6e6 * 1000)
#define SCALE   (250 / AU)
#define G       6.67428e-11
...


As you can see, there are four distinct groups here, #pragmas, standard #includes, 3rd-party #includes and #defines.