本文整理汇总了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 );
}
示例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
}