本文整理匯總了C++中ObjectManager::Draw方法的典型用法代碼示例。如果您正苦於以下問題:C++ ObjectManager::Draw方法的具體用法?C++ ObjectManager::Draw怎麽用?C++ ObjectManager::Draw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ObjectManager
的用法示例。
在下文中一共展示了ObjectManager::Draw方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: main_loop_function
void main_loop_function()
{
ObjectManager * objManager = ObjectManager::Inst(); //create object manager
Cube CubeTest = Cube(1.0f,Vertex(0,0,0)); //create cube and push to object manager
objManager->GameObjects.push_back(CubeTest);
/*
GLfloat ambient[] = { .5f, .5f, .5f, 1.f };
GLfloat diffuse[] = { .5f, .5f, .5f, .6f };
GLfloat litepos[] = { 0, 2, 3, 1 };
GLfloat litepos2[] = { 0, -2, 5, 1 };
glPushMatrix();
glLoadIdentity();
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, litepos);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT1, GL_POSITION, litepos2);
glEnable(GL_LIGHT1);
glPopMatrix();
*/
signed int buttonPause, wireframe, CurrentObj;
float RotationX, RotationY, RotationZ, Zoom, Size;
RotationX = RotationY = RotationZ = buttonPause = wireframe = CurrentObj = 0;
Zoom = -3;
Size = 5;
while( events() )
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0,0, Zoom);
glRotatef(RotationX,RotationY, 45,45);
glPointSize(Size);
objManager->Draw();
glEnd();
SDL_GL_SwapBuffers();
// Check keypresses
buttonPause = buttonPause > 0 ? --buttonPause : buttonPause; //buffer to stop method being spammed cheap but it works...
if( key[SDLK_RIGHT] ){ RotationX-=0.5; }
if( key[SDLK_LEFT ] ){ RotationX+=0.5; }
if( key[SDLK_UP] ){ RotationY-=0.5; }
if( key[SDLK_DOWN ] ){ RotationY+=0.5; }
//if( key[SDLK_l] ) { glRotatef(45,4,0,0); } //>
if( key[SDLK_k] ) { RotationZ +=0.5; }
if( key[SDLK_i]) { Zoom += 0.1;}
if( key[SDLK_o]) { Zoom -= 0.1;}
if( key[SDLK_0]){RotationX = RotationY = RotationZ == 0;} //reset to center
if( key[SDLK_w])
{
if( buttonPause == 0)
{
switch(wireframe)
{
case 0:
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
++wireframe;
break;
case 1:
glPolygonMode( GL_FRONT_AND_BACK, GL_POINT );
++wireframe;
break;
default:
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
wireframe = 0;
break;
}
buttonPause = 30;
}
}
if( key[SDLK_c])
{
if(buttonPause == 0)
{
#ifdef PrintToConsole
cout << "Catnell clark called";
#endif
objManager->GameObjects[CurrentObj].visible = false;
GameObject _ngobj = CatmullClarkSubDivision().Subdivide(objManager->GameObjects[CurrentObj]);
GameObject* ngobj = new GameObject(_ngobj);
ngobj->init();
objManager->GameObjects.push_back(*ngobj);
++CurrentObj;
buttonPause = 30;
}
}
if( key[SDLK_a])
//.........這裏部分代碼省略.........