本文整理汇总了C++中sphere::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ sphere::draw方法的具体用法?C++ sphere::draw怎么用?C++ sphere::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sphere
的用法示例。
在下文中一共展示了sphere::draw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouse_event
void mouse_event(int button, int state, int x, int y)
{
glClear(GL_COLOR_BUFFER_BIT);
light.draw();
r.clearZbuffer();
switch(button)
{
case GLUT_LEFT_BUTTON:
{
for(unsigned int i=0;i<o.face_size;i++)
{
o.vertices[i] =SCH*o.vertices[i];
}
o.draw(Color(0.3,0.2,0.3));
break;
}
case GLUT_RIGHT_BUTTON:
{
for(unsigned int i=0;i<o.face_size;i++)
{
o.vertices[i] =SCL*o.vertices[i];
}
o.draw(Color(0.3,0.2,0.3));
break;
}
}
glFlush();
glutSwapBuffers();
}
示例2: special_keyboard
void special_keyboard(int key,int ,int)
{
glClear(GL_COLOR_BUFFER_BIT);
r.clearZbuffer();
DrawTriangle(x_y_zCoordinate(-450,0,3000),Color(1,1,0),x_y_zCoordinate(-600,-350,-1000),
Color(0,1,0),x_y_zCoordinate(600,-350,-1000),Color(0,1,1));
DrawTriangle(x_y_zCoordinate(-450,0,3000),Color(1,1,0),x_y_zCoordinate(600,0,-1000),
Color(0,1,0),x_y_zCoordinate(600,-350,-1000),Color(0,1,1));
light.draw();
switch (key)
{
case GLUT_KEY_DOWN:
{
for(unsigned int i=0;i<o.face_size;i++)
{
o.vertices[i] =DOWN*o.vertices[i];
}
for(unsigned int i=0;i<rem.face_size;i++)
{
rem.vertices[i] =DOWN*rem.vertices[i];
}
for(unsigned int i=0;i<boom.face_size;i++)
{
boom.vertices[i] =DOWN*boom.vertices[i];
}
for(unsigned int i=0;i<hook.face_size;i++)
{
hook.vertices[i] =DOWN*hook.vertices[i];
}
o.draw(Color(0.3,0.2,0.3));
rem.draw(Color(1.0,1.2,0.1));
boom.draw(Color(0.8,0.9,1));
hook.draw(Color(0.1,0,1));
break;
}
case GLUT_KEY_UP:
{
for(unsigned int i=0;i<o.face_size;i++)
{
o.vertices[i] =UP*o.vertices[i];
}
for(unsigned int i=0;i<rem.face_size;i++)
{
rem.vertices[i] =UP*rem.vertices[i];
}
for(unsigned int i=0;i<boom.face_size;i++)
{
boom.vertices[i] =UP*boom.vertices[i];
}
for(unsigned int i=0;i<hook.face_size;i++)
{
hook.vertices[i] =UP*hook.vertices[i];
}
o.draw(Color(0.3,0.2,0.3));
rem.draw(Color(1.0,1.2,0.1));
boom.draw(Color(0.8,0.9,1));
hook.draw(Color(0.1,0,1));
break;
}
case GLUT_KEY_RIGHT:
{
for(unsigned int i=0;i<o.face_size;i++)
{
o.vertices[i] =T*o.vertices[i];
}
for(unsigned int i=0;i<rem.face_size;i++)
{
rem.vertices[i] =T*rem.vertices[i];
}
for(unsigned int i=0;i<boom.face_size;i++)
{
boom.vertices[i] =T*boom.vertices[i];
}
for(unsigned int i=0;i<hook.face_size;i++)
{
hook.vertices[i] =T*hook.vertices[i];
}
cout<<"rotation\n";
RR.display();
cout<<"NNpaxadi\n";
NN.display();
cout<<"agadi\n";
MM.display();
RR = RR*T;
MM = MM*T;
NN = NN*T;
o.draw(Color(0.3,0.2,0.3));
rem.draw(Color(1.0,1.2,0.1));
boom.draw(Color(0.8,0.9,1));
hook.draw(Color(0.1,0,1));
break;
}
case GLUT_KEY_LEFT:
{
for(unsigned int i=0;i<o.face_size;i++)
{
o.vertices[i] =T2*o.vertices[i];
//.........这里部分代码省略.........
示例3: keyboard_event
void keyboard_event(unsigned char key,int x,int y)
{
glClear(GL_COLOR_BUFFER_BIT);
r.clearZbuffer();
x+=0;y+=0;
DrawTriangle(x_y_zCoordinate(-450,0,3000),Color(1,1,0),x_y_zCoordinate(-600,-350,-1000),
Color(0,1,0),x_y_zCoordinate(600,-350,-1000),Color(0,1,1));
DrawTriangle(x_y_zCoordinate(-450,0,3000),Color(1,1,0),x_y_zCoordinate(600,0,-1000),
Color(0,1,0),x_y_zCoordinate(600,-350,-1000),Color(0,1,1));
light.draw();
for(unsigned int i=0;i<hook.face_size;i++){
if ((hook.vertices[i].x > ligh.x -10 && hook.vertices[i].x < ligh.x +10) && (hook.vertices[i].y > ligh.y -10
&& hook.vertices[i].y < ligh.y +10)&& (hook.vertices[i].z > ligh.z -10 && hook.vertices[i].z < ligh.z +10))
{
set = true;
}}
//c1.create();
switch(key)
{
case 'o':
{
for(unsigned int i=0;i<hook.face_size;i++)
{
hook.vertices[i] =TTTT*hook.vertices[i];
}
o.draw(Color(0.3,0.2,0.3));
rem.draw(Color(1.0,1.2,0.1));
boom.draw(Color(0.8,0.9,1));
hook.draw(Color(0.1,0,1));
break;
}
case'i':
{
if(set==true){
for(unsigned int i=0;i<light.Total_Points;i++)
{
light.Vertices[i]=LLLL*light.Vertices[i];
}}
for(unsigned int i=0;i<hook.face_size;i++)
{
hook.vertices[i] =LLLL*hook.vertices[i];
}
o.draw(Color(0.3,0.2,0.3));
rem.draw(Color(1.0,1.2,0.1));
boom.draw(Color(0.8,0.9,1));
hook.draw(Color(0.1,0,1));
break;
}
case 'q':
{
/* for(unsigned int i=0;i<sph.Total_Points;i++)
{
sph.Vertices[i] = IN*sph.Vertices[i];
}
//drawLine(-600,0,600,0);
//drawLine(0,350,0,-350);
sph.draw();*/
for(unsigned int i=0;i<o.face_size;i++)
{
o.vertices[i] =IN*o.vertices[i];
}
o.draw(Color(0.3,0.2,0.3));
rem.draw(Color(1.0,1.2,0.1));
boom.draw(Color(0.8,0.9,1));
hook.draw(Color(0.1,0,1));
break;
}
case 'e':
{
/*for(unsigned int i=0;i<sph.Total_Points;i++)
{
sph.Vertices[i] = OUT*sph.Vertices[i];
}
//drawLine(-600,0,600,0);
//drawLine(0,350,0,-350);
sph.draw();*/
for(unsigned int i=0;i<o.face_size;i++)
{
o.vertices[i] =OUT*o.vertices[i];
}
break;
}
case 'x':
{
/*for(int i=0;i<sph.Total_Points;i++)
{
sph.Vertices[i] = XR*sph.Vertices[i];
}
sph.draw();*/
//.........这里部分代码省略.........