当前位置: 首页>>代码示例>>C++>>正文


C++ Cube::createVAO方法代码示例

本文整理汇总了C++中Cube::createVAO方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::createVAO方法的具体用法?C++ Cube::createVAO怎么用?C++ Cube::createVAO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cube的用法示例。


在下文中一共展示了Cube::createVAO方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InitShader

// OpenGL initialization
void
init()
{
    program = InitShader( "/home/GONZAGA/yerion/Documents/ACAR/LgsparksCar/vertex.glsl", "/home/GONZAGA/yerion/Documents/ACAR/LgsparksCar/fragment.glsl" );
    glUseProgram( program );

    // Uniform variables: color and viewing parameters
    model_color = glGetUniformLocation( program, "model_color" );
    model_view = glGetUniformLocation( program, "model_view" );
    projection = glGetUniformLocation( program, "projection" );

    // Create multiple vertex array objects using an array of vertex array objects
    GLuint vao[6];
    glGenVertexArrays( 6, vao );

    //********  Create the VAOs ************//

    myCube.createVAO(vao[0],program);
    myWireCube.createVAO(vao[1],program);
    myDisk.createVAO(vao[2],program);
    myWireDisk.createVAO(vao[3],program);
    myCylinder.createVAO(vao[4],program);
    myWireCylinder.createVAO(vao[5],program);

    glUniform4fv( model_color, 1,vec4(1,1,1,1) ); // set color to white initially

    glLineWidth(4);
    glEnable( GL_DEPTH_TEST );
    glClearColor( 0.5, 0.5, 0.5, 1.0 );
}
开发者ID:garrettsparks,项目名称:Classwork,代码行数:31,代码来源:main.cpp

示例2: frameworkSetup

void frameworkSetup()
{
	// todo: move this to a one time call only
	pCamera = new Camera();

	// Initially setup the camera - this might not be needed since ChangeSize is always called at the beginning
	pCamera->setViewport( 0, 0, 800, 600);
	pCamera->setPerspective( 35.0f, float(800)/float(600), 1.0f, 500.0f);
	// pCamera->setOrientAndPosition( Vect(0.0f, 1.0f, 0.0f), Vect(0.0f, 0.0f, -1.0f), Vect(0.0f, 0.0f, 7.0f) );
 
#if ANIMATION
    AnimationManager* animManager = AnimationManager::GetInstance();

    // create animations and add 'em to animList in manager
    // can add them in each anim's ctor
    Anim* bearWalk = new BearWalk();
    animManager->AddAnim(bearWalk); 

    // Anim* bearIdle = new BearIdle();
    // animManager->AddAnim(bearIdle);

    // Anim* twoBone = new AnimTwoBone();
    // animManager->AddAnim(twoBone);

#endif

#if MODEL_VIEWER

    GraphicsObjectManager *goMgr = GraphicsObjectManager::getInstance();
    createFBXModels(goMgr);

    // PieWedge* pPieWedge = new PieWedge();  
    // pPieWedge->loadTexture();
    // pPieWedge->createVAO();   
    // createPieWedgeObjects(pPieWedge, goMgr);
    // 
    // Pyramid* pPyramid = new Pyramid();
    // pPyramid->loadTexture();
    // pPyramid->createVAO();
    // createPyramidObjects(pPyramid, goMgr);   
    // 
    //     // ***Geometry*** - create models - cube here for Collision_Demo
    // Cube* pCube = new Cube();
    // // allocates a texture object with an ID, binds it, and sets up the texture state via call to LoadTGATexture()
    // pCube->loadTexture();
    // pCube->createVAO(); 
    // createCubeObjects(pCube, goMgr);

#endif

#if COLLISION_DEMO

    GraphicsObjectManager *goMgr = GraphicsObjectManager::getInstance();

    //  ***Geometry*** - create models - cube here for Collision_Demo
    Cube* pCube = new Cube();
    // allocates a texture object with an ID, binds it, and sets up the texture state via call to LoadTGATexture()
    pCube->loadTexture();
    pCube->createVAO(); 

    // CubeObject *c = new CubeObject("Cube A");
    collisionCube = new CubeObject("Collision Cube", pCube);
    // collisionCube->setPos( Vect(0.0f, 0.0f, 0.0f) );
    collisionCube->setLightPos( Vect(1.0f, 1.0f, 0.0f) );
    collisionCube->setLightColor( Vect(0.0f, 1.0f, 0.0f, 1.0f) );
    collisionCube->setTexture(TEX1);
    collisionCube->setShader(POINT_LIGHT_DIFF);
    goMgr->addObject(collisionCube);

#endif
}
开发者ID:mdubovoy,项目名称:Animation_System,代码行数:71,代码来源:GlobalState.cpp


注:本文中的Cube::createVAO方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。