示例#1
0
/** This method needs to be called once the GL context has been created by GLFW.
  * It is called only once per execution */
void initGL()
{ 
    // set the background color, i.e., the color used
    // to fill the screen when calling glClear(GL_COLOR_BUFFER_BIT)
    glClearColor(0.3f,0.3f,0.3f,0.);

    glEnable(GL_DEPTH_TEST);

    // load the default shaders 
    mBlinn.loadFromFiles(PGHP_DIR"/shaders/blinn.vert", PGHP_DIR"/shaders/blinn.frag");
    mSimple.loadFromFiles(PGHP_DIR"/shaders/simple.vert", PGHP_DIR"/shaders/simple.frag");
    mHole.loadFromFiles(PGHP_DIR"/shaders/hole.vert", PGHP_DIR"/shaders/hole.frag");
    mMesh.loadFromFiles(PGHP_DIR"/shaders/mesh.vert", PGHP_DIR"/shaders/mesh.frag");

    //PointCloud
    pc = new PointCloud();
    pc->load(PGHP_DIR"/data/decimate.asc");
    pc->makeUnitary();
    pc->init(&mBlinn);

    //Mesh
    mesh = new Mesh();
    //mesh->load(PGHP_DIR"/data/PhantomUgly.obj");
    //mesh->load(PGHP_DIR"/data/PhantomLite.obj");
    //mesh->load(PGHP_DIR"/data/bunny.obj");
    mesh->load(PGHP_DIR"/data/sphere.obj");
    //mesh->load(PGHP_DIR"/data/sphere2.obj");
    mesh->makeUnitary();
    mesh->init(&mBlinn);

    //Octree
    octree = new Octree(pc,15,10);
    wirecube = new WireCube();
    wirecube->init(&mSimple);

    mCamera.setSceneCenter(Vector3f(0.0,0.0,0.0));
    mCamera.setSceneDistance(4);
    mCamera.setMinNear(0.1f);
    mCamera.setNearFarOffsets(-200.f,200.0f);
    mCamera.setScreenViewport(AlignedBox2f(Vector2f(0.0,0.0), Vector2f(WIDTH,HEIGHT)));

    GL_TEST_ERR;
}
示例#2
0
/** This method needs to be called once the GL context has been created by GLFW.
  * It is called only once per execution */
void initGL()
{ 
    // set the background color, i.e., the color used
    // to fill the screen when calling glClear(GL_COLOR_BUFFER_BIT)
    glClearColor(0.3f,0.3f,0.3f,0.);

    glEnable(GL_DEPTH_TEST);

    // load the default shaders 
    mBlinn.loadFromFiles(PGHP_DIR"/shaders/blinn.vert", PGHP_DIR"/shaders/blinn.frag");
    mSimple.loadFromFiles(PGHP_DIR"/shaders/simple.vert", PGHP_DIR"/shaders/simple.frag");

    //PointCloud
    pc = new PointCloud();
    //pc->load(PGHP_DIR"/data/decimate.asc");
    //pc->load(PGHP_DIR"/data/decimateRed.asc");
    pc->load(PGHP_DIR"/data/sunglasses_lens.asc");
    pc->makeUnitary();
    pc->init(&mBlinn);

    //Ball
    ball = new Ball(pc);
    ball->init(&mBlinn);

    surface = new Surface();
    surface->init(&mSimple);

    //Octree
    octree = new Octree(pc,15,10);
    wirecube = new WireCube();
    wirecube->init(&mSimple);

    mCamera.setSceneCenter(Vector3f(0.0,0.0,0.0));
    mCamera.setSceneDistance(4);
    mCamera.setMinNear(0.1f);
    mCamera.setNearFarOffsets(-200.f,200.0f);
    mCamera.setScreenViewport(AlignedBox2f(Vector2f(0.0,0.0), Vector2f(WIDTH,HEIGHT)));

    GL_TEST_ERR;
}
示例#3
0
文件: main.cpp 项目: Patagouin/Mod
/** This method needs to be called once the GL context has been created by GLFW.
  * It is called only once per execution */
void initGL()
{ 
    // set the background color, i.e., the color used
    // to fill the screen when calling glClear(GL_COLOR_BUFFER_BIT)
    glClearColor(0.3f,0.3f,0.3f,0.);

    glEnable(GL_DEPTH_TEST);

    // load the default shaders 
    mBlinn.loadFromFiles(PGHP_DIR"/shaders/blinn.vert", PGHP_DIR"/shaders/blinn.frag");
    mSimple.loadFromFiles(PGHP_DIR"/shaders/simple.vert", PGHP_DIR"/shaders/simple.frag");
    mHole.loadFromFiles(PGHP_DIR"/shaders/hole.vert", PGHP_DIR"/shaders/hole.frag");
//    mMesh.loadFromFiles(PGHP_DIR"/shaders/mesh.vert", PGHP_DIR"/shaders/mesh.frag");

    //PointCloud
    pc = new PointCloud();
    pc->load(PGHP_DIR"/data/decimate.asc");
    pc->makeUnitary();
    pc->init(&mBlinn);

    //Mesh

    Mesh* mesh = new Mesh();
    //mesh->load(PGHP_DIR"/data/PhantomUgly.obj");
    //mesh->load(PGHP_DIR"/data/PhantomLite.obj");
    //mesh->load(PGHP_DIR"/data/cube.obj");
    mesh->load(PGHP_DIR"/data/ObjConnexe.obj");
    mesh->makeUnitary();
    mesh->init(&mBlinn);
    mMeshes.push_back(mesh);
    //kate_leg------------
    Mesh* kate_leg = new Mesh();
    kate_leg->load(PGHP_DIR"/data/Kate_leg.obj");
    kate_leg->makeUnitary();
    kate_leg->init(&mBlinn);
    mMeshes.push_back(kate_leg);
    //kate_fur------------
    Mesh* kate_fur = new Mesh();
    kate_fur->load(PGHP_DIR"/data/Kate_fur.obj");
    kate_fur->makeUnitary();
    kate_fur->init(&mBlinn);
    mMeshes.push_back(kate_fur);
    //bunny------------
    Mesh* bunny = new Mesh();
    bunny->load(PGHP_DIR"/data/bunny_stanford.obj");
    bunny->makeUnitary();
    bunny->init(&mBlinn);
    mMeshes.push_back(bunny);
    //sphere------------
    Mesh* sphere = new Mesh();
    sphere->load(PGHP_DIR"/data/sphere.obj");
    sphere->makeUnitary();
    sphere->init(&mBlinn);
    mMeshes.push_back(sphere);
    //cube------------
    Mesh* cube = new Mesh();
    cube->load(PGHP_DIR"/data/cube.obj");
    cube->makeUnitary();
    cube->init(&mBlinn);
    mMeshes.push_back(cube);
    //2cube------------
    Mesh* twoCubes = new Mesh();
    twoCubes->load(PGHP_DIR"/data/twoCubes.obj");
    twoCubes->makeUnitary();
    twoCubes->init(&mBlinn);
    mMeshes.push_back(twoCubes);
    //3compConnex------------
    Mesh* troisConnex = new Mesh();
    troisConnex->load(PGHP_DIR"/data/troisConnex.obj");
    troisConnex->makeUnitary();
    troisConnex->init(&mBlinn);
    mMeshes.push_back(troisConnex);

    //---------------------

    mCurrentMesh = mMeshes.size()-1;

    //Octree
    octree = new Octree(pc,15,10);
    wirecube = new WireCube();
    wirecube->init(&mSimple);

    mCamera.setSceneCenter(Vector3f(0.0,0.0,0.0));
    mCamera.setSceneDistance(4);
    mCamera.setMinNear(0.1f);
    mCamera.setNearFarOffsets(-200.f,200.0f);
    mCamera.setScreenViewport(AlignedBox2f(Vector2f(0.0,0.0), Vector2f(WIDTH,HEIGHT)));

    GL_TEST_ERR;
}