• 大小: 230KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-16
  • 语言: 其他
  • 标签: opengl  3D  

资源简介

OpenGL绘制3D机器人,可以通过键盘控制手脚、头旋转移动

资源截图

代码片段和文件信息

/*
 * Copyright (c) 1993-2003 Silicon Graphics Inc.
 * All Rights Reserved
 *
 * Permission to use copy modify and distribute this software for any
 * purpose and without fee is hereby granted provided that the above
 * copyright notice appear in all copies and that both the copyright
 * notice and this permission notice appear in supporting documentation
 * and that the name of Silicon Graphics Inc. not be used in
 * advertising or publicity pertaining to distribution of the software
 * without specific written prior permission.
 *
 * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU “AS-IS“ AND
 * WITHOUT WARRANTY OF ANY KIND EXPRESS IMPLIED OR OTHERWISE
 * INCLUDING WITHOUT LIMITATION ANY WARRANTY OF MERCHANTABILITY OR
 * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
 * GRAPHICS INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT
 * SPECIAL INCIDENTAL INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND
 * OR ANY DAMAGES WHATSOEVER INCLUDING WITHOUT LIMITATION LOSS OF
 * PROFIT LOSS OF USE SAVINGS OR REVENUE OR THE CLAIMS OF THIRD
 * PARTIES WHETHER OR NOT SILICON GRAPHICS INC.  HAS BEEN ADVISED OF
 * THE POSSIBILITY OF SUCH LOSS HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION USE
 * OR PERFORMANCE OF THIS SOFTWARE.
 *
 * US Government Users Restricted Rights 
 * Use duplication or disclosure by the Government is subject to
 * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
 * (c)(1)(ii) of the Rights in Technical Data and Computer Software
 * clause at DFARS 252.227-7013 and/or in similar or successor clauses
 * in the FAR or the DOD or NASA FAR Supplement.  Unpublished - rights
 * reserved under the copyright laws of the United States.
 *
 * Contractor/manufacturer is:
 * Silicon Graphics Inc.
 * 1500 Crittenden Lane
 * Mountain View CA  94043
 * United State of America
 *
 * OpenGL(R) is a registered trademark of Silicon Graphics Inc.
 */

/*
 * robot.c
 * This program shows how to composite modeling transformations
 * to draw translated and rotated hierarchical models.
 * Interaction:  pressing the s and e keys (shoulder and elbow)
 * alters the rotation of the robot arm.
 */
#include 
#include “glut.h“


static int shoulder = 0 elbow = 0 head = 0 leg = 0 foot = 0;

void init(void) 
{
   glClearColor (0.0 0.0 0.0 0.0);
   glShadeModel (GL_FLAT);
}

void display(void)
{
   glClear (GL_COLOR_BUFFER_BIT);

   glPushMatrix();

     glPushMatrix(); //It‘s body
       glScalef (1.6 2.0 1.0);
       glutWireCube (1.0);
     glPopMatrix();

     glPushMatrix();
       glTranslatef (0.0 1.4 0.0);   //It‘s head
       glRotatef ((GLfloat) head 0.0 1.0 0.0);
       glScalef (0.50.60.5);
       glutWireCube (1.0);
     glPopMatrix();
     
     glPushMatrix();
       glTranslatef (0.8 0.9 0.0);  //It‘s the right shoulder
       g

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     196686  2010-11-01 19:17  robot\Debug\robot.exe

     文件      13214  2010-11-01 19:17  robot\Debug\robot.obj

     文件     451584  2010-11-01 19:17  robot\Debug\robot.pdb

     文件      33792  2010-11-01 20:29  robot\Debug\vc60.idb

     文件      45056  2010-11-01 19:17  robot\Debug\vc60.pdb

     文件     288648  2010-11-01 19:17  robot\Debug\robot.ilk

     文件     300520  2010-11-01 17:20  robot\Debug\robot.pch

     文件       3387  2009-10-26 09:36  robot\robot.dsp

     文件        535  2009-10-26 09:37  robot\robot.dsw

     文件      50176  2010-11-01 20:33  robot\robot.ncb

     文件       1167  2010-11-01 19:17  robot\robot.plg

     文件      27670  2009-09-30 16:17  robot\glut.h

     文件      28728  2009-09-30 16:17  robot\glut32.lib

     文件       7041  2010-11-01 19:08  robot\robot.c

     文件      48640  2010-11-01 20:33  robot\robot.opt

     目录          0  2010-02-23 00:35  robot\Debug

     目录          0  2010-10-17 21:54  robot

----------- ---------  ---------- -----  ----

              1496844                    17


评论

共有 条评论