Beispiel #1
0
bool initialize()    
{
    view = glm::lookAt( glm::vec3(0, 30.0, 0), //Eye Position
                        glm::vec3(0, 0.0, 0.0), //Focus point
                        glm::vec3(0.0, 0.0, 1.0)); //Positive Y is up

    projection = glm::perspective( 45.0f, //the FoV typically 90 degrees is good which is what this is set to
                                   float(w)/float(h), //Aspect Ratio, so Circles stay Circular
                                   0.01f, //Distance to the near plane, normally a small value like this
                                   100.0f); //Distance to the far plane, 


    bool loadedSuccess = true;
    objTriMesh = new btTriangleMesh();
    btCollisionShape *tempShape = NULL;
    btDefaultMotionState *tempMotionState = NULL;
    btScalar tempMass;
    btVector3 tempInertia;
    btRigidBody *tempRigidBody = NULL;
    
    //Collision Masks
    int paddleColidesWith = COL_WALL | COL_PADDLE | COL_PUCK | COL_INVWALL;
    //int goalColidesWith = COL_PUCK;    
    int wallColidesWith = COL_PUCK | COL_PADDLE;
    int invWallColidesWith = COL_PADDLE;
    int puckCollidesWith = COL_PADDLE | COL_GOAL | COL_WALL;


    //TABLE
    globalObjCount++;
    Vertex *geometry;
    loadedSuccess = loadOBJ("LabyrinthBoard.obj", &geometry, 0);
    if ( !loadedSuccess )
    {
        cout << "OBJ file not found or invalid format" << endl;
        return false;
    }
 
    glGenBuffers(1, &vbo_geometry);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_geometry);
    glBufferData(GL_ARRAY_BUFFER, sizeof(geometry)*numberTriangles*4, geometry, GL_STATIC_DRAW);
    
    //Create collision Objects
    //Initalize the Hockey Table.
    tempShape = new btBvhTriangleMeshShape(objTriMesh, true); //Hockey Table
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(0,-15,0)));
    tempMass = 0;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    btRigidBody::btRigidBodyConstructionInfo shapeRigidBodyCI(tempMass, tempMotionState, tempShape, tempInertia);
    tempRigidBody = new btRigidBody(shapeRigidBodyCI);
    objectsDataList.addObject(0, tempShape, tempMotionState, tempMass, tempInertia, vbo_geometry, numberTriangles, 4.0f, tempRigidBody, textureFileName);
    dynamicsWorld->addRigidBody(tempRigidBody, COL_WALL, wallColidesWith);



    tempRigidBody = NULL;
    delete geometry;
    numberTriangles = 0;
    objTriMesh = NULL;
    
    //Paddle 1
    globalObjCount++;
    Vertex *cylinder;
    //btVector3 cylinderVect = btVector3(1.15f, 1.15f, 1.15f);

    objTriMesh = new btTriangleMesh();
    loadedSuccess = loadOBJ("Earth.obj", &cylinder, 1);
    if ( !loadedSuccess )
    {
        cout << "OBJ file not found or invalid format" << endl;
        return false;
    }
 
    // Create a Vertex Buffer object to store this vertex info on the GPU
    glGenBuffers(1, &vbo_cylinder);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_cylinder);
    glBufferData(GL_ARRAY_BUFFER, sizeof(cylinder)*numberTriangles*4, cylinder, GL_STATIC_DRAW);

    //Initalize the Cylinder
    //tempShape = new btCylinderShape(cylinderVect);    
    tempShape = new btConvexTriangleMeshShape(objTriMesh, true); //Paddle One
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(-5.0f,0.0f,0.0f)));
    tempMass = 10;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    tempShape->calculateLocalInertia(tempMass, tempInertia);
    btRigidBody::btRigidBodyConstructionInfo paddleOneRigidBodyCI(tempMass, tempMotionState, tempShape, tempInertia);
    tempRigidBody = new btRigidBody(paddleOneRigidBodyCI);
    tempRigidBody->setRestitution(btScalar(0.01));
    tempRigidBody->setFriction(btScalar(1));
    objectsDataList.addObject(1, tempShape, tempMotionState, tempMass, tempInertia, vbo_cylinder, numberTriangles, .7f, tempRigidBody, textureFileName);
    dynamicsWorld->addRigidBody(tempRigidBody, COL_PADDLE, paddleColidesWith);

    delete cylinder;
    tempRigidBody = NULL;
    numberTriangles = 0;
    objTriMesh = NULL;
    //objTriMesh = new btTriangleMesh();

/*
    //Paddle 2
    globalObjCount++;
    Vertex *Cube;
    loadedSuccess = loadOBJ("paddleTwo.obj", &Cube, 2);
    if ( !loadedSuccess )
    {
        cout << "OBJ file not found or invalid format" << endl;
        return false;
    }

    // Create a Vertex Buffer object to store this vertex info on the GPU
    glGenBuffers(1, &vbo_cube);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_cube);
    glBufferData(GL_ARRAY_BUFFER, sizeof(Cube)*numberTriangles*3, Cube, GL_STATIC_DRAW);

    //Initalize the Cylinder
    //tempShape = new btCylinderShape(cylinderVect);    
    tempShape = new btConvexTriangleMeshShape(objTriMesh, true); //Paddle Two
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(5.0f,0.0f,0.0f)));
    tempMass = 10;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    tempShape->calculateLocalInertia(tempMass, tempInertia);
    btRigidBody::btRigidBodyConstructionInfo paddleTwoRigidBodyCI(tempMass, tempMotionState, tempShape, tempInertia);
    tempRigidBody = new btRigidBody(paddleTwoRigidBodyCI);
    tempRigidBody->setRestitution(btScalar(0.01));
    tempRigidBody->setFriction(btScalar(1));
    objectsDataList.addObject(2, tempShape, tempMotionState, tempMass, tempInertia, vbo_cylinder, numberTriangles, 1.5f, tempRigidBody, textureFileName);
    dynamicsWorld->addRigidBody(tempRigidBody, COL_PADDLE, paddleColidesWith);

    delete Cube;
    tempRigidBody = NULL;
    numberTriangles = 0;
    objTriMesh = NULL;
    objTriMesh = new btTriangleMesh();

    //PUCK
    globalObjCount++;
    Vertex *sphere;
    objTriMesh = new btTriangleMesh();
    loadedSuccess = loadOBJ("Puck.obj", &sphere, 3);
    if ( !loadedSuccess )
    {
        cout << "OBJ file not found or invalid format" << endl;
        return false;
    }

    // Create a Vertex Buffer object to store this vertex info on the GPU
    glGenBuffers(1, &vbo_sphere);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_sphere);
    glBufferData(GL_ARRAY_BUFFER, sizeof(sphere)*numberTriangles*3, sphere, GL_STATIC_DRAW);

    //Initalize the Sphere
    //tempShape = new btCylinderShape(cylinderVect); 
    tempShape = new btConvexTriangleMeshShape(objTriMesh, true); //Puck
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(0.0f,0.0f,0.0f)));
    tempMass = 1;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    tempShape->calculateLocalInertia(tempMass, tempInertia);
    btRigidBody::btRigidBodyConstructionInfo puckRigidBodyCI(tempMass, tempMotionState, tempShape, tempInertia);
    tempRigidBody = new btRigidBody(puckRigidBodyCI);
    tempRigidBody->setRestitution(btScalar(0.01));
    tempRigidBody->setFriction(btScalar(.01));
    objectsDataList.addObject(3, tempShape, tempMotionState, tempMass, tempInertia, vbo_sphere, numberTriangles, 1.5f, tempRigidBody, textureFileName);
    dynamicsWorld->addRigidBody(tempRigidBody, COL_PUCK, puckCollidesWith);
    

    delete sphere;
    numberTriangles = 0;
    objTriMesh = NULL;

    ///Walls
    globalObjCount++;
    btVector3 middle_wall = btVector3(0.0f, 40.0f, 40.0f);
    tempShape = new btBoxShape(middle_wall);
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(0, 4, 0.0f)));
    tempMass = 0;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    btRigidBody::btRigidBodyConstructionInfo invWallRigidBodyCI(tempMass, tempMotionState, tempShape, tempInertia);
    tempRigidBody = new btRigidBody(invWallRigidBodyCI);
    objectsDataList.addObject(4, tempShape, tempMotionState, tempMass, tempInertia, vbo_sphere, numberTriangles, 4.0f, tempRigidBody, textureFileName);
    dynamicsWorld->addRigidBody(tempRigidBody, COL_INVWALL, invWallColidesWith);


    // right goal
    globalObjCount++;
    btVector3 right_wall = btVector3(0.0f, 20.0f, 10.0f);
    tempShape = new btBoxShape(right_wall);
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(-31.5f,4.0f,0.0f)));
    tempMass = 0;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    btRigidBody::btRigidBodyConstructionInfo rightWallRigidBodyCI(tempMass, tempMotionState, tempShape, tempInertia);
    tempRigidBody = new btRigidBody(rightWallRigidBodyCI);
    objectsDataList.addObject(5, tempShape, tempMotionState, tempMass, tempInertia, vbo_sphere, numberTriangles, 4.0f, tempRigidBody, textureFileName);
    dynamicsWorld->addRigidBody(tempRigidBody, COL_INVWALL, invWallColidesWith );


    // left goal
    globalObjCount++;
    btVector3 left_wall = btVector3(0.0f, 20.0f, 10.0f);
    tempShape = new btBoxShape(left_wall);
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(31.5f,4.0f,0.0f)));
    tempMass = 0;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    btRigidBody::btRigidBodyConstructionInfo leftWallRigidBodyCI(tempMass, tempMotionState, tempShape, tempInertia);
    tempRigidBody = new btRigidBody(leftWallRigidBodyCI);
    objectsDataList.addObject(6, tempShape, tempMotionState, tempMass, tempInertia, vbo_sphere, numberTriangles, 4.0f, tempRigidBody, textureFileName);
    dynamicsWorld->addRigidBody(tempRigidBody, COL_INVWALL, invWallColidesWith );
*/

    // clean
    tempShape = NULL;
    tempMotionState = NULL;

    //--Load vertex shader and fragment shader from 2 text files
    ShaderLoader loader("vertexShader.txt", "fragmentShader.txt");
    program = loader.LoadShader();
    
    //Now we set the locations of the attributes and uniforms
    //this allows us to access them easily while rendering
    loc_position = glGetAttribLocation(program,
                    const_cast<const char*>("v_position"));
    if(loc_position == -1)
    {
        std::cerr << "[F] POSITION NOT FOUND" << std::endl;
        //return false;
    }

    loc_uv = glGetAttribLocation(program,
                    const_cast<const char*>("v_uv"));
    if(loc_uv == -1)
    {
        std::cerr << "[F] V_UV NOT FOUND" << std::endl;
        //return false;
    }

    loc_normal = glGetAttribLocation(program,
                    const_cast<const char*>("v_normal"));
    if(loc_normal == -1)
    {
        std::cerr << "[F] normal NOT FOUND" << std::endl;
        //return false;
    }

    loc_mvpmat = glGetUniformLocation(program,
                    const_cast<const char*>("mvpMatrix"));
    if(loc_mvpmat == -1)
    {
        std::cerr << "[F] MVPMATRIX NOT FOUND" << std::endl;
        //return false;
    }

    loc_lightType = glGetUniformLocation(program, "v_lightType");
    if(loc_lightType == -1)
    {
        std::cerr << "[F] lightType NOT FOUND" << std::endl;
        //return false;
    }

    loc_lightType2 = glGetUniformLocation(program, "v_lightType2");
    if(loc_lightType2 == -1)
    {
        std::cerr << "[F] lightType2 NOT FOUND" << std::endl;
        //return false;
    }

    //lights
    GLfloat white[] = {0.0f, 0.0f, 0.0f, 1.0f};
    GLfloat cyan[] = {.8f, 0.f, 0.f, 1.f};

    glMaterialfv(GL_FRONT, GL_DIFFUSE, cyan);
    glMaterialfv(GL_FRONT, GL_SPECULAR, white);
    //glMaterialfv(GL_FRONT, GL_AMBIENT, white);

    GLfloat shininess[] = {20};
    glMaterialfv(GL_FRONT, GL_SHININESS, shininess);

    GLfloat lightpos[] = {0, 5, 0, 1};
    glLightfv(GL_LIGHT0, GL_POSITION, lightpos);


    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);

    //glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 20.0);
    //GLfloat spot_direction[] = { -1.0, -1.0, 0.0 };
    //glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, spot_direction);

    //and its done
    return true;
}
Beispiel #2
0
bool initialize()    
{
    //cout << "Makes it to initalize!" << endl;
    bool loadedSuccess = true;
    char defualtOBJName[] = "iceRink.obj"; //Change to change the default loaded object.
    btCollisionShape *tempShape = NULL;
    btDefaultMotionState *tempMotionState = NULL;
    btScalar tempMass;
    btVector3 tempInertia;
    btRigidBody *tempRigidBody = NULL;
    
    //Collision Masks
    int shapeColidesWith = COL_WALL | COL_SHAPE;
    int wallColidesWith = COL_SHAPE;    
    

//TABLE
    globalObjCount++;
    Vertex *geometry;
    btVector3 tempVect = btVector3(0.0f, 1.0f, 0.0f);
    btScalar planeScaler = 3;
    objTriMesh = new btTriangleMesh();
    loadedSuccess = loadOBJ(defualtOBJName, &geometry);
    if ( !loadedSuccess )
    {
        cout << "OBJ file not found or invalid format" << endl;
        return false;
    }

    glGenBuffers(1, &vbo_geometry);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_geometry);
    glBufferData(GL_ARRAY_BUFFER, sizeof(geometry)*numberTriangles*3, geometry, GL_STATIC_DRAW);

    //Create collision Objects
    //Initalize the Hockey Table.
    tempShape = new btBvhTriangleMeshShape(objTriMesh, true); //Hockey Table
    //tempShape = new btStaticPlaneShape(tempVect, planeScaler);
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(0,-15,0)));
    tempMass = 0;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    tempShape->calculateLocalInertia(tempMass, tempInertia);
    btRigidBody::btRigidBodyConstructionInfo shapeRigidBodyCI(tempMass, tempMotionState, tempShape, tempInertia);
    tempRigidBody = new btRigidBody(shapeRigidBodyCI);
    objectsDataList.addObject(0, tempShape, tempMotionState, tempMass, tempInertia, vbo_geometry, numberTriangles, 1, tempRigidBody);
    dynamicsWorld->addRigidBody(tempRigidBody, COL_WALL, wallColidesWith);

    tempRigidBody = NULL;
    delete geometry;
    numberTriangles = 0;
    delete objTriMesh;
    objTriMesh = new btTriangleMesh();

//cout << "Makes it past loading the table!" << endl;

/*
//CUBE
    globalObjCount++;
    Vertex *Cube;
    objTriMesh = new btTriangleMesh();
    btVector3 squareVect = btVector3(0.6f, 0.6f, 0.6f);
    loadedSuccess = loadOBJ("Cube.obj", &Cube);
    if ( !loadedSuccess )
    {
        cout << "OBJ file not found or invalid format" << endl;
        return false;
    }
 
    // Create a Vertex Buffer object to store this vertex info on the GPU
    glGenBuffers(1, &vbo_cube);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_cube);
    glBufferData(GL_ARRAY_BUFFER, sizeof(Cube)*numberTriangles*3, Cube, GL_STATIC_DRAW);

    //Initalize the Cube.
    //tempShape = new btBvhTriangleMeshShape(objTriMesh, true);//Cube

    tempShape = new btBoxShape(squareVect);
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(0.5f,4.0f,0.0f)));
    tempMass = 1;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    objectsDataList.addObject(1, tempShape, tempMotionState, tempMass, tempInertia, vbo_cube, numberTriangles, .5f);
    dynamicsWorld->addRigidBody(objectsDataList.getRigidBody(1), COL_SHAPE, shapeColidesWith);

    delete Cube;
    numberTriangles = 0;
    delete objTriMesh;
    objTriMesh = new btTriangleMesh();
 
*/

//CYLINDER
    //Paddle 1
    globalObjCount++;
    Vertex *cylinder;
    btVector3 cylinderVect = btVector3(0.6f, 0.6f, 0.6f);
    objTriMesh = new btTriangleMesh();
    loadedSuccess = loadOBJ("Paddle.obj", &cylinder);
    if ( !loadedSuccess )
    {
        cout << "OBJ file not found or invalid format" << endl;
        return false;
    }

    // Create a Vertex Buffer object to store this vertex info on the GPU
    glGenBuffers(1, &vbo_cylinder);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_cylinder);
    glBufferData(GL_ARRAY_BUFFER, sizeof(cylinder)*numberTriangles*3, cylinder, GL_STATIC_DRAW);

    //Initalize the Cylinder
    //tempShape = new btBvhTriangleMeshShape(objTriMesh, true); //cylinder
    tempShape = new btCylinderShape(cylinderVect);    
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(-2.0f,1.0f,2.0f)));
    tempMass = 1;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    tempShape->calculateLocalInertia(tempMass, tempInertia);
    btRigidBody::btRigidBodyConstructionInfo paddleOneRigidBodyCI(tempMass, tempMotionState, tempShape, tempInertia);
    tempRigidBody = new btRigidBody(paddleOneRigidBodyCI);
    objectsDataList.addObject(1, tempShape, tempMotionState, tempMass, tempInertia, vbo_cylinder, numberTriangles, .5f, tempRigidBody);
    dynamicsWorld->addRigidBody(tempRigidBody, COL_SHAPE, shapeColidesWith);

    //delete cylinder;
    tempRigidBody = NULL;
    numberTriangles = 0;
    delete objTriMesh;
    objTriMesh = new btTriangleMesh();

    cout << "Loaded Paddle 1" << endl;
/*
    //Paddle 2
    globalObjCount++;
    Vertex *cylinder;
    objTriMesh = new btTriangleMesh();
    loadedSuccess = loadOBJ("Paddle.obj", &cylinder);
    if ( !loadedSuccess )
    {
        cout << "OBJ file not found or invalid format" << endl;
        return false;
    }

     Create a Vertex Buffer object to store this vertex info on the GPU
    glGenBuffers(1, &vbo_cylinder);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_cylinder);
    glBufferData(GL_ARRAY_BUFFER, sizeof(cylinder)*numberTriangles*3, cylinder, GL_STATIC_DRAW);

    Initalize the Cylinder
    tempShape = new btBvhTriangleMeshShape(objTriMesh, true); //cylinder
    tempShape = new btCylinderShape(cylinderVect);    
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(2.0f,1.0f,2.0f)));
    tempMass = 1;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    objectsDataList.addObject(2, tempShape, tempMotionState, tempMass, tempInertia, vbo_cylinder, numberTriangles, .5f);
    dynamicsWorld->addRigidBody(objectsDataList.getRigidBody(2), COL_SHAPE, shapeColidesWith);

    delete cylinder;
    numberTriangles = 0;
    delete objTriMesh;
    objTriMesh = new btTriangleMesh();

//SPHERE
    globalObjCount++;
    Vertex *sphere;
    objTriMesh = new btTriangleMesh();
    btScalar sphereScaler = 1;
    loadedSuccess = loadOBJ("Earth.obj", &sphere);
    if ( !loadedSuccess )
    {
        cout << "OBJ file not found or invalid format" << endl;
        return false;
    }

    // Create a Vertex Buffer object to store this vertex info on the GPU
    glGenBuffers(1, &vbo_sphere);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_sphere);
    glBufferData(GL_ARRAY_BUFFER, sizeof(sphere)*numberTriangles*3, sphere, GL_STATIC_DRAW);

    //Initalize the Sphere
    //tempShape = new btBvhTriangleMeshShape(objTriMesh, true); //Sphere
    tempShape = new btSphereShape(sphereScaler); 
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(4.0f,1.0f,1.0f)));
    tempMass = 1;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    objectsDataList.addObject(1, tempShape, tempMotionState, tempMass, tempInertia, vbo_sphere, numberTriangles, .5f);
    dynamicsWorld->addRigidBody(objectsDataList.getRigidBody(1), COL_SHAPE, shapeColidesWith);
 
    delete sphere;
    numberTriangles = 0;
*/

///Walls
/*
    globalObjCount++;
    btVector3 left_wall = btVector3(4.f, 4.f, 4.f);
    tempShape = new btBoxShape( left_wall);
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(11, 0, 0.0f)));
    tempMass = 100;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    objectsDataList.addObject(4, tempShape, tempMotionState, tempMass, tempInertia, 0, 1, .5f);
    dynamicsWorld->addRigidBody(objectsDataList.getRigidBody(4), COL_SHAPE, shapeColidesWith);

    globalObjCount++;
    btVector3 top_wall = btVector3(6.f, 6.f, 6.f);
    tempShape = new btBoxShape( top_wall);
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(0, 0, 9.5f)));
    tempMass = 100;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    objectsDataList.addObject(5, tempShape, tempMotionState, tempMass, tempInertia, 0, 1, .5f);
    dynamicsWorld->addRigidBody(objectsDataList.getRigidBody(5), COL_SHAPE, shapeColidesWith);

    globalObjCount++;
    btVector3 bottom_wall = btVector3(6.f, 6.f, 6.f);
    tempShape = new btBoxShape( bottom_wall);
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(0, 0, -9.f)));
    tempMass = 100;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    objectsDataList.addObject(6, tempShape, tempMotionState, tempMass, tempInertia, 0, 1, .5f);
    dynamicsWorld->addRigidBody(objectsDataList.getRigidBody(6), COL_SHAPE, shapeColidesWith);

    globalObjCount++;
    btVector3 right_wall = btVector3(4.f, 4.f, 4.f);
    tempShape = new btBoxShape( right_wall);
    tempMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(-7, 0, 0.0f)));
    tempMass = 100;
    tempInertia = btVector3(0.0f, 0.0f, 0.0f);
    objectsDataList.addObject(7, tempShape, tempMotionState, tempMass, tempInertia, 0, 1, .5f);
    dynamicsWorld->addRigidBody(objectsDataList.getRigidBody(7), COL_SHAPE, shapeColidesWith);
*/

 


    //Clean Up
    //tempShape = NULL;
    //delete objTriMesh;
    //objTriMesh = NULL;
    tempShape = NULL;
    tempMotionState = NULL;

    //--Load vertex shader and fragment shader from 2 text files
    ShaderLoader loader("vertexShader.txt", "fragmentShader.txt");
    program = loader.LoadShader();
    
    //Now we set the locations of the attributes and uniforms
    //this allows us to access them easily while rendering
    loc_position = glGetAttribLocation(program,
                    const_cast<const char*>("v_position"));
    if(loc_position == -1)
    {
        std::cerr << "[F] POSITION NOT FOUND" << std::endl;
        return false;
    }

    loc_uv = glGetAttribLocation(program,
                    const_cast<const char*>("v_uv"));
    if(loc_uv == -1)
    {
        std::cerr << "[F] V_UV NOT FOUND" << std::endl;
        return false;
    }

    loc_mvpmat = glGetUniformLocation(program,
                    const_cast<const char*>("mvpMatrix"));
    if(loc_mvpmat == -1)
    {
        std::cerr << "[F] MVPMATRIX NOT FOUND" << std::endl;
        return false;
    }
    
    //--Init the view and projection matrices
    //  if you will be having a moving camera the view matrix will need to more dynamic
    //  ...Like you should update it before you render more dynamic 
    //  for this project having them static will be fine
    view = glm::lookAt( glm::vec3(.5, 7.0, 0), //Eye Position
                        glm::vec3(.5, 0.0, 0.0), //Focus point
                        glm::vec3(0.0, 0.0, 1.0)); //Positive Y is up

    projection = glm::perspective( 45.0f, //the FoV typically 90 degrees is good which is what this is set to
                                   float(w)/float(h), //Aspect Ratio, so Circles stay Circular
                                   0.01f, //Distance to the near plane, normally a small value like this
                                   100.0f); //Distance to the far plane, 


    // load texture image
    Magick::InitializeMagick("");
    Magick::Image image;
    Magick::Blob m_blob;
    try
        { 
         // Read a file into image object 
         if ( textureFileName != "")
            {
             image.read( textureFileName );
             image.flip();
             image.write(&m_blob, "RGBA");
            }
         else
            {
             throw std::invalid_argument("No texture file found");
            }

        } 
    catch(exception& tmp) 
        { 
         cout << "Error while reading in texture image, texture file not found"  << endl; 
        } 

    int imageWidth = image.columns();
    int imageHeight = image.rows();


    // setup texture
    glGenTextures(1, &aTexture); 
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, aTexture);

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, imageWidth, imageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_blob.data());

    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    //enable depth testing
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);

    //and its done
    return true;
}