本文整理汇总了C++中Arm::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Arm::draw方法的具体用法?C++ Arm::draw怎么用?C++ Arm::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arm
的用法示例。
在下文中一共展示了Arm::draw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display
void display() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the color buffer
// set camera parameters
GLdouble centerX = eyeX;
GLdouble centerY = eyeY + 1;
GLdouble centerZ = eyeZ;
GLdouble upX = 0.;
GLdouble upY = 0.;
GLdouble upZ = 1.;
glMatrixMode(GL_MODELVIEW); // indicate we are specifying camera transformations
glLoadIdentity();
gluLookAt(eyeX, eyeY, eyeZ,
centerX, centerY, centerZ,
upX, upY, upZ);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60, 1, 1, 100);
// drawing is done here
mainArm.draw();
// secArm.draw();
float c = 0.2;
Point3f a0 = goal + Vector3f(-c, 0, c);
Point3f a1 = goal + Vector3f(0, 0, -c);
Point3f a2 = goal + Vector3f(c, 0, c);
Vector3f n2(0, -1, 0);
glBegin(GL_TRIANGLES);
glNormal3f(n2[0], n2[1], n2[2]);
glVertex3f(a0[0], a0[1], a0[2]);
glVertex3f(a1[0], a1[1], a1[2]);
glVertex3f(a2[0], a2[1], a2[2]);
glEnd();
/*Point3f secGoal = Point3f(goal[0], goal[1], -goal[2]);
a0 = secGoal + Vector3f(-c, 0, c);
a1 = secGoal + Vector3f(0, 0, -c);
a2 = secGoal + Vector3f(c, 0, c);
glBegin(GL_TRIANGLES);
glNormal3f(n2[0], n2[1], n2[2]);
glVertex3f(a0[0], a0[1], a0[2]);
glVertex3f(a1[0], a1[1], a1[2]);
glVertex3f(a2[0], a2[1], a2[2]);*/
glEnd();
// end drawing
glFlush();
glutSwapBuffers(); // swap buffers (we earlier set double buffer)
}
示例2: Color
void Ex59AdvancedJointsApp::draw() {
gl::clear( Color( 0.666, 0.666, 0.666 ) );
arm->draw();
floor->draw();
}
示例3: My_Display
// GLUT callback. Called to draw the scene.
void My_Display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//GLfloat angleX = ((GLfloat)windowRotateX / ((GLfloat)window_width / 2)) * 180;
//GLfloat angleY = ((GLfloat)windowRotateY / ((GLfloat)window_height / 2)) * 180;
//Arm left_up_arm(1, -1, 1);
//Arm right_up_arm(-1,-1,1);
//initial matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
gluLookAt(0.0, 0.0, nRange, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0);
{
glutSolidCube(0.08f*nRange/10.0f);
}
glMultMatrixf(World_Matrix);
SpotlightPos[0] = 0.0f;
SpotlightPos[1] = -13.5f;
SpotlightPos[2] = 8.0f;
SpotlightPos[3] = 1.0f;
glLightfv(GL_LIGHT1, GL_AMBIENT, ambientLight);
glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuseLight);
glLightfv(GL_LIGHT1, GL_SPECULAR, specular);
glLightfv(GL_LIGHT1, GL_POSITION, SpotlightPos);
glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, Vector3<GLfloat>(0.0f, 13.5f, -0.8f).toArray());
glLighti(GL_LIGHT1, GL_SPOT_CUTOFF, 30);
glLightf(GL_LIGHT1, GL_SPOT_EXPONENT, 1000.0f);
SpotlightPos[0] = 0.0f;
SpotlightPos[1] = -9.5f;
SpotlightPos[2] = 0.0f;
SpotlightPos[3] = 1.0f;
glLightfv(GL_LIGHT2, GL_AMBIENT, ambientLight);
glLightfv(GL_LIGHT2, GL_DIFFUSE, diffuseLight);
glLightfv(GL_LIGHT2, GL_SPECULAR, specular);
glLightfv(GL_LIGHT2, GL_POSITION, SpotlightPos);
glLightfv(GL_LIGHT2, GL_SPOT_DIRECTION, Vector3<GLfloat>(0.0f, -1.0f, 0.0f).toArray());
glLighti(GL_LIGHT2, GL_SPOT_CUTOFF, 60);
glLightf(GL_LIGHT2, GL_SPOT_EXPONENT, 1000.0f);
glPushMatrix();
{
//glRotatef(angleX, 0.0, 1.0, 0.0);
//glRotatef(angleY, 1.0, 0.0, 0.0);
//glRotatef(angle,0.0f,1.0f,0.0f);
glPushMatrix();
{
glPushMatrix();
{
glTranslatef(0.0f,-13.5f,0.0f);
magiccircle.draw();
}
glPopMatrix();
glTranslatef(0.0f, body.torso_pos, 0.0f);
glPushMatrix();
{
glRotateXYZ(body.torso_tilt);
body.draw(); //body
glPushMatrix(); //left wing
{
glTranslatef(1.3f, 3.0f, -1.1f);
glRotatef(25.0f, 0.0f, 1.0f, 0.0f);
glRotatef(-5.0f, 0.0f, 0.0f, 1.0f);
left_wing.draw();
}
glPopMatrix();
glPushMatrix(); //right wing
{
glTranslatef(-1.3f, 3.0f, -1.1f);
glRotatef(-25.0f, 0.0f, 1.0f, 0.0f);
glRotatef(5.0f, 0.0f, 0.0f, 1.0f);
right_wing.draw();
}
glPopMatrix();
glPushMatrix(); //head
{
glTranslatef(0.0f, 4.0f, 0.0f);
head.draw();
//.........这里部分代码省略.........