Ejemplo n.º 1
0
Floor::Floor(float x, float y, color_t color) {
    this->position = glm::vec3(x, y, 0);
    this->rotation = 0;
    static const GLfloat vertex_buffer_data[] = {
        -4, 0.5, 0, // vertex 1
        4,  0.5, 0, // vertex 2
        -4,  -0.5, 0, // vertex 3

        -4,  -0.5, 0, // vertex 3
        4, 0.5, 0, // vertex 4
        4, -0.5, 0, // vertex 1


    };

    this->object1 = create3DObject(GL_TRIANGLES, 6, vertex_buffer_data, color, GL_FILL);
    static const GLfloat vertex_buffer_data2[] = {
        1.35, 0.5, 0, // vertex 1
        -1.35,  0.5, 0, // vertex 2
        -1.35,  0, 0, // vertex 3

        1.35,  0.5, 0, // vertex 3
        -1.35, 0.0, 0, // vertex 4
        1.35,  0.0, 0, // vertex 1

    };

    this->object2 = create3DObject(GL_TRIANGLES, 6, vertex_buffer_data2,COLOR_BLUE, GL_FILL);

}
Ejemplo n.º 2
0
	void createCircle(){
		if(flag)
			circle = create3DObject(GL_TRIANGLE_FAN,num_vertices,vertex_buffer,color_buffer,GL_FILL);
		else 
			circle = create3DObject(GL_LINES,num_vertices,vertex_buffer,color_buffer,GL_LINE);

	}
Ejemplo n.º 3
0
	void createRectangle (GLfloat xa, GLfloat ya, GLfloat xb, GLfloat yb, GLfloat xc, GLfloat yc, GLfloat xd, GLfloat yd, GLfloat col_R, GLfloat col_G, GLfloat col_B)
	{
  		// GL3 accepts only Triangles. Quads are not supported
  		const GLfloat vertex_buffer_data [] = {
    		xa, ya, 0, // vertex 1
    		xb, yb, 0, // vertex 2
    		xc, yc, 0, // vertex 3

    		xc, yc, 0, // vertex 3
    		xd, yd, 0, // vertex 4
    		xa, ya, 0  // vertex 1
  		};

  		const GLfloat color_buffer_data [] = {
    		col_R, col_G, col_B, // color 1
    		col_R, col_G, col_B, // color 2
    		col_R, col_G, col_B, // color 3

    		col_R, col_G, col_B, // color 3
    		col_R, col_G, col_B, // color 4
    		col_R, col_G, col_B  // color 1
  		};
  		// create3DObject creates and returns a handle to a VAO that can be used later
		rectangle = create3DObject(GL_TRIANGLES, 6, vertex_buffer_data, color_buffer_data, GL_FILL);
	}
Ejemplo n.º 4
0
		void createLine(){
			GLfloat * vertex_buffer_data = new GLfloat[6];
			vertex_buffer_data = vertex_buffer;
			GLfloat * color_buffer_data = new GLfloat[6];
			 color_buffer_data = color_buffer;
			 
			line = create3DObject(GL_LINES,2,vertex_buffer_data,color_buffer_data,GL_FILL);
		}
Ejemplo n.º 5
0
/* Generate VAO, VBOs and return VAO handle - Common Color for all vertices */
struct VAO* create3DObject (GLenum primitive_mode, int numVertices, const GLfloat* vertex_buffer_data, const GLfloat red, const GLfloat green, const GLfloat blue, GLenum fill_mode=GL_FILL)
{
    GLfloat* color_buffer_data = new GLfloat [3*numVertices];
    for (int i=0; i<numVertices; i++) {
        color_buffer_data [3*i] = red;
        color_buffer_data [3*i + 1] = green;
        color_buffer_data [3*i + 2] = blue;
    }

    return create3DObject(primitive_mode, numVertices, vertex_buffer_data, color_buffer_data, fill_mode);
}
Ejemplo n.º 6
0
	void initialize(GLfloat xa, GLfloat ya, GLfloat za, GLfloat xb, GLfloat yb, GLfloat zb, GLfloat col_Ra, GLfloat col_Ga, GLfloat col_Ba, GLfloat col_Rb, GLfloat col_Gb, GLfloat col_Bb)
	{
		x1 = xa;	y1=ya;	z1=za;	x2=xb;	y2=yb;	z2=zb;
		R1=col_Ra;	G1=col_Ga;	B1=col_Ba;
		R2=col_Rb;	G2=col_Gb;	B2=col_Bb;

	    GLfloat vertex_buffer_data[] = { x1, y1, z1,	x2, y2, z2 };

	    GLfloat color_buffer_data[] = {R1, G1, B1,		R2, G2, B2};

	    line = create3DObject(GL_LINES, 2, vertex_buffer_data, color_buffer_data, GL_FILL);
	}
Ejemplo n.º 7
0
	void createRectangle ()
	{
			// GL3 accepts only Triangles. Quads are not supported
			
			GLfloat *vertex_buffer_data = new GLfloat[100];
			vertex_buffer_data= vertex_buffer;

			GLfloat *color_buffer_data = new GLfloat[100];
			color_buffer_data  = color_buffer;
			//if(fill)
				rectangle = create3DObject(GL_TRIANGLES, 6, vertex_buffer_data, color_buffer_data, GL_FILL);
			//else
			//	rectangle = create3DObject(GL_TRIANGLES, 6, vertex_buffer_data, color_buffer_data, GL_LINE);
	}
Ejemplo n.º 8
0
VAO* create_bubble(float x,float y,float a,float b,float angle,float red,float green , float blue,float vx,float vy)
{
    GLfloat vertex_buffer_data[650];
    int i=0,j=0;
    for (i=1; i<=72; i++)
    {
        int angle = i*5;
        vertex_buffer_data[j++]=a*cos((angle*(3.14159265))/180);
        vertex_buffer_data[j++]=b*sin((angle*(3.14159265))/180);
        vertex_buffer_data[j++]=0;
        vertex_buffer_data[j++]=0;
        vertex_buffer_data[j++]=0;
        vertex_buffer_data[j++]=0;
        vertex_buffer_data[j++]=a*cos(((angle-5)*(3.14159265))/180);
        vertex_buffer_data[j++]=b*sin(((angle-5)*(3.14159265))/180);
        vertex_buffer_data[j++]=0;
    }
    GLfloat color_buffer_data [650];
    j=0;
    for (int r=1; r<=72; r++)
    {
        color_buffer_data[j++]=red;
        color_buffer_data[j++]=green;
        color_buffer_data[j++]=blue;
        color_buffer_data[j++]=red-0.65;
        color_buffer_data[j++]=green-0.65;
        color_buffer_data[j++]=blue-0.65;
        color_buffer_data[j++]=red;
        color_buffer_data[j++]=green;
        color_buffer_data[j++]=blue;
    }
    struct VAO* vao = new struct VAO;
    vao = create3DObject(GL_TRIANGLES, 216 , vertex_buffer_data, color_buffer_data, GL_FILL);
    vao->trans[0]=x;
    vao->trans[1]=y;
    vao->trans[2]=0;
    vao->sizex=a;
    vao->sizey=b;
    vao->rotate_angle=angle;
    vao->starttime=glfwGetTime();
    vao->vx=vx;
    vao->vy=vy;
    return vao;
}
Ejemplo n.º 9
0
	void createTriangle (GLfloat xa, GLfloat ya, GLfloat xb, GLfloat yb, GLfloat xc, GLfloat yc)
	{
  		// ONLY vertices between the bounds specified in glm::ortho will be visible on screen 

  		// Define vertex array as used in glBegin (GL_TRIANGLES)
  		const GLfloat vertex_buffer_data [] = {
    		xa, ya,0, // vertex 0
		    xb, yb,0, // vertex 1
		    xc, yc,0, // vertex 2
  		};

  		const GLfloat color_buffer_data [] = {
    		1,0,0, // color 0
		    0,1,0, // color 1
    		0,0,1, // color 2
  		};

  		// create3DObject creates and returns a handle to a VAO that can be used later
  		triangle = create3DObject(GL_TRIANGLES, 3, vertex_buffer_data, color_buffer_data, GL_FILL);
	}
Ejemplo n.º 10
0
	void initialize (GLfloat cx, GLfloat cy, GLfloat cz, GLfloat len, GLfloat br, GLfloat ht)
	{
		// centre_x and centre_y are bottom corner coordinates
		// l is associated with x, b with y, and h with z
		centre_x = cx;	centre_y = cy;	centre_z = cz;	l = ht;		b = len;		h = br;

		GLfloat vertex_buffer_data[]={
			// Face IV
			0,0,0,
		    b,0,0,
		    b,0,l,

		    0,0,0,
		    b,0,l,
		    0,0,l,

		    // Face II
		    0,h,0,
		    b,h,0,
		    b,h,l,

		    0,h,0,
		    b,h,l,
		    0,h,l,

		    // Face I

		    0,0,0,
		    0,h,0,
		    0,h,l,

		    0,h,l,
		    0,0,0,
		    0,0,l,

		    //Face III

		    b,0,0,
		    b,h,0,
		    b,h,l,

		    b,h,l,
		    b,0,0,
		    b,0,l,

		    //Face VI

		    0,0,0,
		    b,0,0,
		    b,h,0,

		    0,0,0,
		    b,h,0,
		    0,h,0,

		    //Face V

		    0,0,l,
		    b,0,l,
		    b,h,l,

		    0,0,l,
		    b,h,l,
		    0,h,l
		};

    GLfloat color_buffer_data[] = {

	//Face IV
     base_bottom_R, base_bottom_G, base_bottom_B,
     base_bottom_R, base_bottom_G, base_bottom_B,
     base_top_R, base_top_G, base_top_B,

     base_bottom_R, base_bottom_G, base_bottom_B,
     base_top_R, base_top_G, base_top_B,
     base_top_R, base_top_G, base_top_B,
	
	//Face II
     base_bottom_R, base_bottom_G, base_bottom_B,
     base_bottom_R, base_bottom_G, base_bottom_B,
     base_top_R, base_top_G, base_top_B,

     base_bottom_R, base_bottom_G, base_bottom_B,
     base_top_R, base_top_G, base_top_B,
     base_top_R, base_top_G, base_top_B,
	
	//Face I
     base_bottom_R, base_bottom_G, base_bottom_B,
     base_bottom_R, base_bottom_G, base_bottom_B,
     base_top_R, base_top_G, base_top_B,

     base_top_R, base_top_G, base_top_B,
     base_bottom_R, base_bottom_G, base_bottom_B,
     base_top_R, base_top_G, base_top_B,

     //Face III

     base_bottom_R, base_bottom_G, base_bottom_B,
     base_bottom_R, base_bottom_G, base_bottom_B,
     base_top_R, base_top_G, base_top_B,

     base_top_R, base_top_G, base_top_B,
     base_bottom_R, base_bottom_G, base_bottom_B,
     base_top_R, base_top_G, base_top_B,

     //Face VI

     base_bottom_R, base_bottom_G, base_bottom_B,
     base_bottom_R, base_bottom_G, base_bottom_B,
     base_bottom_R, base_bottom_G, base_bottom_B,

     base_bottom_R, base_bottom_G, base_bottom_B,
	 base_bottom_R, base_bottom_G, base_bottom_B,
     base_bottom_R, base_bottom_G, base_bottom_B,

     //Face V

     base_top_R, base_top_G, base_top_B,
     base_top_R, base_top_G, base_top_B,
     base_top_R, base_top_G, base_top_B,

     base_top_R, base_top_G, base_top_B,
     base_top_R, base_top_G, base_top_B,
     base_top_R, base_top_G, base_top_B

 };
     
 	cuboid = create3DObject(GL_TRIANGLES, 36, vertex_buffer_data, color_buffer_data, GL_FILL);
	}
Ejemplo n.º 11
0
  // Cube face will be identified using their face center
  void createCube() {
    //const int color_scheme[] = {11, 12, 13, 1, 3, 14};
    GLfloat cube_color_buffer[108];
    int start = 0;
    for (int i=0; i<6; i++) {
      if (color_scheme[i] == 1) {
        start = copy_color(start, BLACK_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 2) {
        start = copy_color(start, RED_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 3) {
        start = copy_color(start, GREEN_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 4) {
        start = copy_color(start, YELLOW_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 5) {
        start = copy_color(start, BLUE_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 6) {
        start = copy_color(start, MAGENTA_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 7) {
        start = copy_color(start, CYAN_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 8) {
        start = copy_color(start, DARK_GRAY_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 9) {
        start = copy_color(start, LIGHT_GRAY_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 10) {
        start = copy_color(start, BROWN_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 11) {
        start = copy_color(start, ORANGE_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 12) {
        start = copy_color(start, PINK_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 13) {
        start = copy_color(start, PURPLE_COLOR, cube_color_buffer);
      } else if (color_scheme[i] == 14) {
        start = copy_color(start, WHITE_COLOR, cube_color_buffer);
      }
    }

    const GLfloat cube_vertex_buffer[] = {
      // X = l/2, Y = h/2, Z = 0
      0, 0, 0,
      length, 0, 0,
      length, height, 0,
      0, 0, 0,
      0, height, 0,
      length, height, 0,

      // X = l/2, Y = h/2, Z = b
      0, 0, breadth,
      length, 0, breadth,
      length, height, breadth,
      0, 0, breadth,
      0, height, breadth,
      length, height, breadth,


      0, 0, 0,
      0, 0, breadth,
      0, height, breadth,
      0, 0, 0,
      0, height, 0,
      0, height, breadth,

      length, 0, 0,
      length, 0, breadth,
      length, height, breadth,

      length, 0, 0,
      length, height, 0,
      length, height, breadth,

      0, height, 0,
      length, height, 0,
      length, height, breadth,

      0, height, 0,
      0, height, breadth,
      length, height, breadth,

      0, 0, 0,
      length, 0, 0,
      length, 0, breadth,

      0, 0, 0,
      0, 0, breadth,
      length, 0, breadth,
    };
    cube = create3DObject(GL_TRIANGLES, 36, cube_vertex_buffer, cube_color_buffer, GL_FILL);
  }
Ejemplo n.º 12
0
Rock::Rock(float x, float y, float z,float eflg) {
    this->position = glm::vec3(x, y, z);
    this->rotation = 0;
    this->hitflag = 0;
    this->eflag=eflg;
    colour[0]={0,255,0};
    colour[1]={129,75,0};
    // Our vertices. Three consecutive floats give a 3D vertex; Three consecutive vertices give a triangle.
    // A cube has 6 faces with 2 triangles each, so this makes 6*2=12 triangles, and 12*3 vertices
    static const GLfloat vertex_buffer_data[] = {
//        -0.4f,-0.4f,-0.4f, // triangle 1 : begin
//        -0.4f,-0.4f, 0.4f,
//        -0.4f, 0.4f, 0.4f, // triangle 1 : end
//        0.4f, 0.4f,-0.4f, // triangle 2 : begin
//        -0.4f,-0.4f,-0.4f,
//        -0.4f, 0.4f,-0.4f, // triangle 2 : end
//        0.4f,-0.4f, 0.4f,
//        -0.4f,-0.4f,-0.4f,
//        0.4f,-0.4f,-0.4f,
//        0.4f, 0.4f,-0.4f,
//        0.4f,-0.4f,-0.4f,
//        -0.4f,-0.4f,-0.4f,
//        -0.4f,-0.4f,-0.4f,
//        -0.4f, 0.4f, 0.4f,
//        -0.4f, 0.4f,-0.4f,
//        0.4f,-0.4f, 0.4f,
//        -0.4f,-0.4f, 0.4f,
//        -0.4f,-0.4f,-0.4f,
//        -0.4f, 0.4f, 0.4f,
//        -0.4f,-0.4f, 0.4f,
//        0.4f,-0.4f, 0.4f,
//        0.4f, 0.4f, 0.4f,
//        0.4f,-0.4f,-0.4f,
//        0.4f, 0.4f,-0.4f,
//        0.4f,-0.4f,-0.4f,
//        0.4f, 0.4f, 0.4f,
//        0.4f,-0.4f, 0.4f,
//        0.4f, 0.4f, 0.4f,
//        0.4f, 0.4f,-0.4f,
//        -0.4f, 0.4f,-0.4f,
//        0.4f, 0.4f, 0.4f,
//        -0.4f, 0.4f,-0.4f,
//        -0.4f, 0.4f, 0.4f,
//        0.4f, 0.4f, 0.4f,
//        -0.4f, 0.4f, 0.4f,

        0.75f,-0.75f, 0.0f,
        0.75f, 0.75f, 0.0f,
        0.0f, 0.0f, 2.0f,

        0.75f, 0.75f, 0.0f,
       -0.75f, 0.75f, 0.0f,
        0.0f, 0.0f, 2.0f,

       -0.75f, 0.75f, 0.0f,
       -0.75f,-0.75f, 0.0f,
        0.0f, 0.0f, 2.0f,

       -0.75f,-0.75f, 0.0f,
        0.75f,-0.75f, 0.0f,
        0.0f, 0.0f, 2.0f,
    };

    this->object = create3DObject(GL_TRIANGLES, 4*3, vertex_buffer_data, colour[this->eflag], GL_FILL);
}
Ejemplo n.º 13
0
int main(int argc, char** argv) {

    std::cout << "**************************************************\n"
            << "*** Introduction to Visual Computing, SS 2015  ***\n"
            << "*** Exercise 03: OpenCV Stub                   ***\n"
            << "**************************************************\n"
            << "*** Author: Dipl.-Inf. Sven Sickert            ***\n"
            << "**************************************************\n\n";

    // create a new window
    cv::namedWindow("My Image Window", CV_WINDOW_AUTOSIZE || CV_WINDOW_KEEPRATIO);
    //cv::Mat img(480, 640, CV_8UC3);
    cv::Mat * img = genMatrix();

    Object3DListType objects3D;
    create3DObject(objects3D);

    //Lade Ausgangs-Parameter
    std::vector<double> position;
    position.push_back(posZ);
    position.push_back(posY);
    position.push_back(posX);
    std::vector<double> direction;
    direction.push_back(vZ);
    direction.push_back(vY);
    direction.push_back(vX);
    double focalDistance = FOCAL_DISTANCE;
    char key;
    bool quit;


    //Verschiebe Objekte in einen sichtbaren Bereich
    for (Object3DListType::iterator objIt = objects3D.begin(); objIt != objects3D.end(); objIt++) {
        for (Point3DListType::iterator pointIt = (*objIt).first.begin(); pointIt != (*objIt).first.end(); pointIt++) {
            (*pointIt)[0] += 30;
            (*pointIt)[1] += 30;
            (*pointIt)[2] += 30;
        }
    }

    do {
        key = (char) cv::waitKey();
        delete img;
        //std::cout << key << " " << std::endl;
        std::cout << "--------Position--------" << std::endl;
        std::cout << "posX = " << position[0] << std::endl;
        std::cout << "posY = " << position[1] << std::endl;
        std::cout << "posZ = " << position[2] << std::endl;
        std::cout << "vX = " << direction[0] << std::endl;
        std::cout << "vY = " << direction[1] << std::endl;
        std::cout << "vZ = " << direction[2] << std::endl;

        switch (key) {
            case 'q':
                quit = true;
                break;

                //--------Position    
            case 'w':
                position[1]++;
                break;
            case 's':
                position[1]--;
                break;
            case 'a':
                position[0]--;
                break;
            case 'd':
                position[0]++;
                break;
            case 'x':
                position[2]++;
                break;
            case 'y':
                position[2]--;
                break;
                //--------Blickvector
            case 'R':
                direction[0]++;
                break;
            case 'Q':
                direction[1]--;
                break;
            case 'T':
                direction[0]--;
                break;
            case 'S':
                direction[1]++;
                break;
            case ',':
                direction[2]--;
                break;
            case '.':
                direction[2]++;
                break;


        }
        img = genMatrix();
        Object2DListType objects2D = project2D(objects3D, position, direction, focalDistance);
        draw2DObjects(*img, objects2D);
        cv::imshow("My Image Window", *img);

    } while (!quit);






    return 0;
}
Ejemplo n.º 14
0
Monster :: Monster(float x, float y, color_t color) {
    this->position = glm::vec3(x, y, 1);
    this->rotation = 0;
    hitflag=0;
    fireflag=0;
    speed=0.05;
    // Our vertices. Three consecutive floats give a 3D vertex; Three consecutive vertices give a triangle.
    // A cube has 6 faces with 2 triangles each, so this makes 6*2=12 triangles, and 12*3 vertices
    static const GLfloat vertex_buffer_data[] = {
        -1.0f,-1.0f,-1.0f, // triangle 1 : begin
        -1.0f,-1.0f, 1.0f,
        -1.0f, 1.0f, 1.0f, // triangle 1 : end
        1.0f, 1.0f,-1.0f, // triangle 2 : begin
        -1.0f,-1.0f,-1.0f,
        -1.0f, 1.0f,-1.0f, // triangle 2 : end
        1.0f,-1.0f, 1.0f,
        -1.0f,-1.0f,-1.0f,
        1.0f,-1.0f,-1.0f,
        1.0f, 1.0f,-1.0f,
        1.0f,-1.0f,-1.0f,
        -1.0f,-1.0f,-1.0f,
        -1.0f,-1.0f,-1.0f,
        -1.0f, 1.0f, 1.0f,
        -1.0f, 1.0f,-1.0f,
        1.0f,-1.0f, 1.0f,
        -1.0f,-1.0f, 1.0f,
        -1.0f,-1.0f,-1.0f,
        -1.0f, 1.0f, 1.0f,
        -1.0f,-1.0f, 1.0f,
        1.0f,-1.0f, 1.0f,
        1.0f, 1.0f, 1.0f,
        1.0f,-1.0f,-1.0f,
        1.0f, 1.0f,-1.0f,
        1.0f,-1.0f,-1.0f,
        1.0f, 1.0f, 1.0f,
        1.0f,-1.0f, 1.0f,
        1.0f, 1.0f, 1.0f,
        1.0f, 1.0f,-1.0f,
        -1.0f, 1.0f,-1.0f,
        1.0f, 1.0f, 1.0f,
        -1.0f, 1.0f,-1.0f,
        -1.0f, 1.0f, 1.0f,
        1.0f, 1.0f, 1.0f,
        -1.0f, 1.0f, 1.0f,
        1.0f,-1.0f, 1.0f,

        -0.25f,-0.25f, 1.0f, // triangle 1 : begin
        -0.25f,-0.25f, 0.25f+1.25f,
        -0.25f, 0.25f, 0.25f+1.25f, // triangle 1 : end
        0.25f, 0.25f,-0.25f+1.25f, // triangle 2 : begin
        -0.25f,-0.25f,-0.25f+1.25f,
        -0.25f, 0.25f,-0.25f+1.25f, // triangle 2 : end
        0.25f,-0.25f, 0.25f+1.25f,
        -0.25f,-0.25f,-0.25f+1.25f,
        0.25f,-0.25f,-0.25f+1.25f,
        0.25f, 0.25f,-0.25f+1.25f,
        0.25f,-0.25f,-0.25f+1.25f,
        -0.25f,-0.25f,-0.25f+1.25f,
        -0.25f,-0.25f,-0.25f+1.25f,
        -0.25f, 0.25f, 0.25f+1.25f,
        -0.25f, 0.25f,-0.25f+1.25f,
        0.25f,-0.25f, 0.25f+1.25f,
        -0.25f,-0.25f, 0.25f+1.25f,
        -0.25f,-0.25f,-0.25f+1.25f,
        -0.25f, 0.25f, 0.25f+1.25f,
        -0.25f,-0.25f, 0.25f+1.25f,
        0.25f,-0.25f, 0.25f+1.25f,
        0.25f, 0.25f, 0.25f+1.25f,
        0.25f,-0.25f,-0.25f+1.25f,
        0.25f, 0.25f,-0.25f+1.25f,
        0.25f,-0.25f,-0.25f+1.25f,
        0.25f, 0.25f, 0.25f+1.25f,
        0.25f,-0.25f, 0.25f+1.25f,
        0.25f, 0.25f, 0.25f+1.25f,
        0.25f, 0.25f,-0.25f+1.25f,
        -0.25f, 0.25f,-0.25f+1.25f,
        0.25f, 0.25f, 0.25f+1.25f,
        -0.25f, 0.25f,-0.25f+1.25f,
        -0.25f, 0.25f, 0.25f+1.25f,
        0.25f, 0.25f, 0.25f+1.25f,
        -0.25f, 0.25f, 0.25f+1.25f,
        0.25f,-0.25f, 0.25f+1.25f,


        -0.5f,-0.5f,-0.5f+2.0f, // triangle 1 : begin
        -0.5f,-0.5f, 0.5f+2.0f,
        -0.5f, 0.5f, 0.5+2.0f, // triangle 1 : end
        0.5f, 0.5f,-0.5f+2.0f, // triangle 2 : begin
        -0.5f,-0.5f,-0.5f+2.0f,
        -0.5f, 0.5f,-0.5f+2.0f, // triangle 2 : end
        0.5f,-0.5f, 0.5f+2.0f,
        -0.5f,-0.5f,-0.5f+2.0f,
        0.5f,-0.5f,-0.5f+2.0f,
        0.5f, 0.5f,-0.5f+2.0f,
        0.5f,-0.5f,-0.5f+2.0f,
        -0.5f,-0.5f,-0.5f+2.0f,
        -0.5f,-0.5f,-0.5f+2.0f,
        -0.5f, 0.5f, 0.5f+2.0f,
        -0.5f, 0.5f,-0.5f+2.0f,
        0.5f,-0.5f, 0.5f+2.0f,
        -0.5f,-0.5f, 0.5f+2.0f,
        -0.5f,-0.5f,-0.5f+2.0f,
        -0.5f, 0.5f, 0.5f+2.0f,
        -0.5f,-0.5f, 0.5f+2.0f,
        0.5f,-0.5f, 0.5f+2.0f,
        0.5f, 0.5f, 0.5f+2.0f,
        0.5f,-0.5f,-0.5f+2.0f,
        0.5f, 0.5f,-0.5f+2.0f,
        0.5f,-0.5f,-0.5f+2.0f,
        0.5f, 0.5f, 0.5f+2.0f,
        0.5f,-0.5f, 0.5f+2.0f,
        0.5f, 0.5f, 0.5f+2.0f,
        0.5f, 0.5f,-0.5f+2.0f,
        -0.5f, 0.5f,-0.5f+2.0f,
        0.5f, 0.5f, 0.5f+2.0f,
        -0.5f, 0.5f,-0.5f+2.0f,
        -0.5f, 0.5f, 0.5f+2.0f,
        0.5f, 0.5f, 0.5f+2.0f,
        -0.5f, 0.5f, 0.5f+2.0f,
        0.5f,-0.5f, 0.5f+2.0f,
    };

    static const GLfloat vertex_buffer_data2[] = {
        0.375f, -0.5f, 2.125f,
        0.375f, -0.5f, 2.375f,
        0.125f, -0.5f, 2.125f,
        0.125f, -0.5f, 2.375f,
        0.375f, -0.5f, 2.125f,
        0.125f, -0.5f, 2.125f,

       -0.375f, -0.5f, 2.125f,
       -0.375f, -0.5f, 2.375f,
       -0.125f, -0.5f, 2.125f,
       -0.125f, -0.5f, 2.375f,
       -0.375f, -0.5f, 2.125f,
       -0.125f, -0.5f, 2.125f,
    };

    this->object = create3DObject(GL_TRIANGLES, 12*3*3, vertex_buffer_data, color, GL_FILL);
    this->object2 = create3DObject(GL_TRIANGLES, 4*3, vertex_buffer_data2, COLOR_BACKGROUND, GL_FILL);

}