高手帮小弟我看看这段代码有关问题出在哪?关于OpenGL的

高手帮我看看这段代码问题出在哪?关于OpenGL的
先上代码:

rectangle.h


#ifndef RECTANGLE_H_INCLUDED
#define RECTANGLE_H_INCLUDED

#include <GL/glew.h>
#include <GL/freeglut.h>

class rectangle
{
public:
    rectangle();
    rectangle(GLfloat x, GLfloat y, GLfloat w, GLfloat h);
    rectangle(GLfloat x, GLfloat y, GLfloat w, GLfloat h, GLfloat r, GLfloat g, GLfloat b);
    ~rectangle();

    void setUpperLeft(GLfloat x, GLfloat y);
    void setWidth(GLfloat w);
    void setHeight(GLfloat h);
    void setColor(GLfloat r, GLfloat g, GLfloat b);
    void setAll(GLfloat x, GLfloat y, GLfloat w, GLfloat h, GLfloat r, GLfloat g, GLfloat b);

    GLfloat getUpperLeftX();
    GLfloat getUpperLeftY();
    GLfloat getWidth();
    GLfloat getHeight();

    void load();
    void reloadData();
    void draw();

private:
    GLfloat ulx;         // upper left x
    GLfloat uly;         // upper left y
    GLfloat width;
    GLfloat height;
    GLfloat red;
    GLfloat green;
    GLfloat blue;

    GLuint vboptr;
    GLuint bufptr;

    GLfloat vertices[16];
    GLfloat colors[12];

    void setVertexLocations();
    void setVertexColors();
};

#endif // RECTANGLE_H_INCLUDED



rectangle.cpp:


#include <iostream>
#include "rectangle.h"
#include "LoadShaders.h"

#define BUFFER_OFFSET(x) ((const void*) (x))

GLint vPosition = 0;
GLint vColor = 1;

//  0 ----------- 3
//    | \       |
//    |   \     |
//    |     \   |
//    |       \ |
//  1 ----------- 2

GLushort vertex_indices[] =
{
    0, 1, 2,
    2, 3, 0
};

rectangle::rectangle()
{
    rectangle(0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0);
    load();
}


rectangle::rectangle
(GLfloat x, GLfloat y, GLfloat w, GLfloat h):
ulx(x), uly(y), width(w), height(h),
red(1.0), green(1.0), blue(1.0)
{
    rectangle(x, y, w, h, 1.0, 1.0, 1.0);
    load();
}

rectangle::rectangle
(GLfloat x, GLfloat y, GLfloat w, GLfloat h,
 GLfloat r, GLfloat g, GLfloat b):
ulx(x), uly(y), width(w), height(h),
red(r), green(g), blue(b)
{
    load();
}

rectangle::~rectangle()
{

}

// Sets the x and y positions of the upper left corner of the rectangle.
void rectangle::setUpperLeft(GLfloat x, GLfloat y)
{
    ulx = x;
    uly = y;
}

// Sets the width of the rectangle
void rectangle::setWidth(GLfloat w)
{
    width = w;
}

// Sets the height of the rectangle,
void rectangle::setHeight(GLfloat h)
{
    height = h;
}

// Sets the color of the rectangle
void rectangle::setColor(GLfloat r, GLfloat g, GLfloat b)
{
    red = r;
    green = g;
    blue = b;
}

// Sets all of the rectangle attributes
void rectangle::setAll(GLfloat x, GLfloat y, GLfloat w, GLfloat h, GLfloat r, GLfloat g, GLfloat b)
{
    ulx = x;
    uly = y;
    width = w;
    height = h;
    red = r;
    green = g;