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


C++ Arm::draw方法代码示例

本文整理汇总了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)
}
开发者ID:wdchoi,项目名称:IKProject,代码行数:53,代码来源:IkPro.cpp

示例2: Color

void Ex59AdvancedJointsApp::draw() {
    gl::clear( Color( 0.666, 0.666, 0.666 ) );
    arm->draw();
    floor->draw();
}
开发者ID:ilzxc,项目名称:The-Nature-of-Cinder,代码行数:5,代码来源:Ex59AdvancedJointsApp.cpp

示例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();
//.........这里部分代码省略.........
开发者ID:Ending2015a,项目名称:OpenGL-Assignment1-GLRobot,代码行数:101,代码来源:main.cpp


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