當前位置: 首頁>>代碼示例>>C++>>正文


C++ Technique::usePipeline方法代碼示例

本文整理匯總了C++中Technique::usePipeline方法的典型用法代碼示例。如果您正苦於以下問題:C++ Technique::usePipeline方法的具體用法?C++ Technique::usePipeline怎麽用?C++ Technique::usePipeline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Technique的用法示例。


在下文中一共展示了Technique::usePipeline方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: main

int main(int argc, char **argv)
{
    //Initialize glut
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_RGBA | GLUT_DOUBLE);
    glutInitWindowPosition(50, 25);
    glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    glutCreateWindow("GL Test");

    glutDisplayFunc(Render);
    glutIdleFunc(Render);
    glutSpecialFunc(keyHandler);
    glutKeyboardFunc(specialHandler);
    glutPassiveMotionFunc(mouseHandler);

    //Initialize glew
    GLenum res = glewInit();
    if(res != GLEW_OK)
        return 1;

    //Set up GL state
    glFrontFace(GL_CCW);
    glCullFace(GL_BACK);
    glEnable(GL_CULL_FACE);
    glDepthFunc(GL_LEQUAL);
    glEnable(GL_DEPTH_TEST);

    //Set up renderer
    eye = new Camera(WINDOW_WIDTH, WINDOW_HEIGHT);
    eye->mPos = glm::vec3(0.0f, 0.0f, 3.0f);
    pipeline.setCamera(eye);

    //Set up the technique
    tech.usePipeline(&pipeline);
    solid.usePipeline(&pipeline);

    //Load scene
    Light::PntLight light;
    light.mPos = glm::vec3(1.0f, 0.0f, 0.0f);
    light.mCol = glm::vec3(1.0f, 0.0f, 0.0f);

    LoadedMesh dragonMesh = LoadedMesh("Assets/Dragon/Dargon posing.obj");
    Entity dragon = Entity(&dragonMesh);

    LoadedMesh potMesh = LoadedMesh("Assets/teapot.obj");
    Entity pot = Entity(&potMesh);
    pot.updateScale(glm::vec3(0.1f, 0.1f, 0.1f));

    scene.addEntity(dragon);
    scene.addEntity(pot);
    scene.addLight(light);

    //Start loop
    glutMainLoop();

    return 0;
}
開發者ID:KyleFung,項目名稱:wasteEngine,代碼行數:57,代碼來源:main.cpp


注:本文中的Technique::usePipeline方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。