CM 的个人资料猪猪的BLOG照片日志列表 工具 帮助

日志


2006/6/29

Close to You

Carpenters 
 
Why do birds suddenly appear
Every time you are near?
Just like me, they long to be
Close to you.

Why do stars fall down from the sky
Every time you walk by?
Just like me, they long to be
Close to you.

On the day that you were born
The angels got together
And decided to create a dream come true
So they sprinkled moon dust in your hair of gold
And starlight in your eyes of blue.

That is why all the girls in town
Follow you all around.
Just like me, they long to be
Close to you.

On the day that you were born
The angels got together
And decided to create a dream come true
So they sprinkled moon dust in your hair of gold
And starlight in your eyes of blue.

That is why all the girls in town
Follow you all around.
Just like me, they long to be
Close to you.
Just like me (Just like me)
They long to be
Close to you.

Wahhhhhhhhhhh, close to you.
Wahhhhhhhhhhh, close to you.
Hahhhhhhhhhhh, close to you.
Lahhhhhhhhhhh, close to you.
2006/6/28

学车记(四)

    今天是学车的第六天,教练又教了一个新动作,叫什么来着,我都不记得了,反正不是叫正倒库就是叫反倒库。和前几天的动作完全相反。停在右边,却要从左边开出来,向左拐,然后倒回左边的库里。
    别的到没有什么,就是一上车,我就分不清左右,倒车之前一直再想这次要往哪边打方向盘。很痛苦的一件事。而且今天教练很不高兴,估计是我们做的一塌糊涂,真是上火,还有十天就要考试了。真不知道我这个水平会不会过,早知道还不如报社会上的那种,多交四百多元钱,可确保准过,看来要认真啊。最后倒的三次都不好,教练说我是没有对上回舵点,不过我知道自己三次犯的都是同一个毛病。最后一次明明很注意可还是很偏。
   越来越不好坚持了,今天早上强忍着终于起来了。特别的困,昨天还忘了买牛奶了,所以我的早饭也就泡汤,又困又饿,幸好今天早上天气还比较暖和,要是还下雨,那真的没法活了。
   昨天晚上我们研究生班级的同学聚会了,不过说实话在这里上了两年学了,认识的人真的很少,只和实验室的同学比较熟,其他的接触的都比较少。虽然是一个班级的同学,可有些人,我连名字都叫不上来。走在大马路上我可能都不知道我们是一个班的。陈全福班长提前毕业了,去了南京的中兴,真是好地方,好工作。吃完以后,坐了一会后我和晶晶就先走了,感觉在那里很拘束,没有什么认识的人,大家在说话,唱歌,我却想离开那里。感觉自己也不是不合群的人啊,根本就没有机会相互认识。
    既然自己感觉不好,不舒服,那就不要强迫自己留在那里吧?既然可以改变自己所处的不喜欢的环境,那就不要犹豫。做自己喜欢做的事,和自己喜欢的人在一起吧。
2006/6/25

学车记(三)

      学车第三天,这两天练的我也不知道叫什么,反正就是要从两个杆中间开出来,然后拐弯压到一个固定白线上,然后倒回两个杆中间。
    开始感觉真的好难啊,我总是对不好,每次都差不多要撞到杆上,第一天的时候,师傅跟在我的车子旁边,象唐僧一样唠叨了整整一上午,可我还是没有搞清楚,要什么时候打满舵,什么时候回舵,真是快疯了。
    今天似乎好多了,至少能准确的倒进去,也会偶尔压到白线,好像也快有感觉了。
    现在惟一的感觉是太了,每天都睡不到七个小时,真是破我的记录了。直到现在我的脑子还不是很清楚呢。而且方向盘真的是太沉了,我的胳膊的某一块出现按压性酸痛
    不知道为什么要发明汽车,两个轮子的自行车不也很不错嘛!老爸快来救我吧!
2006/6/23

学车记(二)

    今天早上四点半起床,我知道我为期一个月的痛苦生活就此拉开序幕。昨天晚上感觉就是几乎没睡。按理说,我忠实的手机已经陪伴我整整四个年头了,无论它对我,或我对它,都是毫不得怀疑,它的闹表我也很放心。可就是睡不安稳,第一次醒来,感觉天蒙蒙亮,感觉象是差不多了,一看表,天啊,才两点。然后就是平均每隔四十分钟醒来一次。收拾完,叫醒楼下的阿姨,然后就飞奔到驾校了。还提前了五分钟左右,窃喜,我一向很讨厌迟到。
    我的师傅很年轻,但却在整个过程中都很严肃,长的有点象实验室的付哥,只不过要瘦一些,我一直都没有看他笑过,尤其是在一名同门把车撞到树上以后。就更粉碎了我看到他笑脸的希望。哦,对了,师傅姓张,而且和某一师弟的名字只有一字之差。
    本师傅的教学方法是,什么都不说,开车就练,出现错误,譬如,撞杆,碰树,倒偏,操作不正确的时候,他才会板着脸说,你这样不对,如何如何,搞的我每次上车都很紧张。尤其搞不明白倒车的时候,车往左偏,我究竟该往哪个方向转方向盘?想了半天,开车的时候,就更一片混乱了。
    今天一共练了怎么起步,停车,倒车,在固定杆中间前进,后退。
    要领如下:
    1、起车要先踩离合器,然后挂一档(目前如此),然后慢松离合器,车就回往前开了。停车时,离合器和刹车一起踩,然后摘档,松刹车,再松离合器,当然,如果直接倒车,就不用松离合器了。
    2、倒车时,一定要从后窗户的中间往后看,否则看不准是否倒偏。左手握方向盘的一个固定位置,右手轻握。每次转动方向盘后,都要回到初始位置。
    至于倒偏后,怎么转方向盘,我还是没有搞清楚,等晚上请教老爸好了。感觉开车的时候一定不要紧张,还要冷静一些。
    还是挺有成就感的,尤其是,今天教练夸我练的不错,很开心。
2006/6/22

学车记(一)

    下了好久的决心,终于报了驾驶培训班。报名的时间一拖再拖。老爸特别希望我考个驾照,不知道为什么?难道他会的东西就一定要我也会吗?唉,我不是不喜欢开车,也不是胆小,只是没有很大的兴趣,但为了老爸,我,我豁出去了。
    6月1日报的名,从10号开始上了六天的理论课,拖拖拉拉的也没有去上过几天的课。今天才考的试,开始听同学,老师说的到挺恐怖。无奈,把学校发的复习题足足看了三遍呢,不过到是很好背,去了还让翻书,真是太简单了。还给那么多的时间,最后的结果就是,我答完了自己的卷子,打了100分。又帮别人答了一份卷子,最后又帮另一个同学检查了一遍。
    最要命的是,我被分到了上午驾车。明天早上要5:00到驾校那里,我现在一想到明天,就好困啊。我都多少年没有起来这么早了。呼呼z-Z~
2006/6/20

下雨了~

      这个月都在下雨,不过比起老鬼所在的西安,哈尔滨真是个不错的避暑胜地。很凉快,不过似乎少了点夏天的味道。
    上周末的时候,高中的一个同桌(注:偶高中的时候有很多的同桌的)突然给我打电话,告知其要和班长结婚的消息,问我周末的时候能不能参加。遗憾的是我这周就要开始练车了,估计是没有办法回去了,不知道到时候周末会不会休息?很想回去见见以前的同学,感觉高中时期的同学,除了寝室的姐妹还有联系外,其他的人真的是很久都没有见到了,大庆也不是很大的城市,可是要碰到谁还真不是一件容易的事。
    今年一定是一个结婚的好年头,不应该说是我们这一批人适合结婚的年份吧。看着大家都很幸福,不知道说什么好。祝福吧!奇总说羡慕我还在学习,可是我现在就是一种漂的状态,而她呢?稳定的工作,稳定的感情,离家里也近,还要求什么呢?而我的未来处于一种不确定的,茫然的状态。有时候也想安定下来,可又不甘心,人总是认为自己得不到的才是最好的吧?
    哥的考试没有通过,我的大白兔也就泡汤了。不过满分才990,考700多已经很不错了,虽然他极力让我和他一起考8月份的,可我对英语实在没有信心,我就指能在其他地方发光吧。
    寝室苑姐这几天不太开心,而寝室就我们两个人,有时候觉得自己嘴挺笨的,不知道怎么安慰她。总感觉都在外面生活,寝室就象一家人一样,希望姐妹们都能幸福,可事情往往并不象我们想的那样简单。心里面好闷,我这是怎么了。
    换心情,换个环境,太阳快点出来吧~
2006/6/7

下雨了~

    下了一天的雨,在实验室看书好效率好低,唉~
2006/6/6

6 6 6

    外面的天阴的厉害,天气预报说又要下雨了。还是凉快一点好吧。
    这几天什么都不想干,不知道“懒”到底是怎么界定的,喜欢睡觉,而又不愿意起床算不算懒呢?有时候觉得,喜欢睡觉和喜欢喝酒或抽烟一样,只是个人的一种爱好吧,这么说似乎是太宽容自己了,为自己的坏习惯找借口。今天上网看到一篇文章说,人如果睡眠不到四个小时,那就会使健康大大折扣的,不过睡的很多也不好,比如中午如果超过一个小时,就会由浅睡状态转为深睡状态,很容易使下午感觉到疲劳,所以要改一改了吧。
    哥最近也说精神上很累,我感觉也是。可能都要面临毕业,为不确定的前途担忧,为自己所会的那点仅有的知识。我也说不上了,项目似乎越来越不顺心,最重要的是我不是很感兴趣,爱好就是人最大的动力吧!调节自己的心情真是一件很麻烦的事,而人的心情又是这么的多变。离开乱七八糟的东西,什么都不要想了。人要是没心没肺可能就会开心很多了,就象以前那样,深呼吸,微笑。一切都会好的。
    仅剩的校园生活,加油~
    哦,还有,今天的日期真的很特别,写完总结报告,老板签字说的~
2006年6月6日~
   
2006/6/1

儿童节~

      好想去游乐园,去坐高高的摩天轮~

.C文件

//JET.C
#include<windows.h>
#include<gl/gl.h>
#include<gl/glut.h>// System and OpenGL Stuff
#include"ww.h"
// Rotation amounts
static GLfloat xRot = 0.0f;
static GLfloat yRot = 0.0f;

// Called to draw scene
void RenderScene(void)
 {
 GLTVector3 vNormal; // Storeage for calculated surface normal
 // Clear the window with current clearing color
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 // Save the matrix state and do the rotations
 glPushMatrix();
 glRotatef(xRot, 1.0f, 0.0f, 0.0f);
 glRotatef(yRot, 0.0f, 1.0f, 0.0f);

 // Nose Cone - Points straight down
        // Set material color
 glColor3ub(128, 128, 128);
 glBegin(GL_TRIANGLES);
                glNormal3f(0.0f, -1.0f, 0.0f);
  glNormal3f(0.0f, -1.0f, 0.0f);
  glVertex3f(0.0f, 0.0f, 60.0f);
  glVertex3f(-15.0f, 0.0f, 30.0f);
  glVertex3f(15.0f,0.0f,30.0f);
               
 
                // Verticies for this panel
                {
                GLTVector3 vPoints[3] = {{ 15.0f, 0.0f,  30.0f},
                                        { 0.0f,  15.0f, 30.0f},
                                        { 0.0f,  0.0f,  60.0f}};
                // Calculate the normal for the plane
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
  glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                } 

                {
                GLTVector3 vPoints[3] = {{ 0.0f, 0.0f, 60.0f },
                                        { 0.0f, 15.0f, 30.0f },
                                        { -15.0f, 0.0f, 30.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }

                // Body of the Plane ////////////////////////
                {
                GLTVector3 vPoints[3] = {{ -15.0f, 0.0f, 30.0f },
                                        { 0.0f, 15.0f, 30.0f },
            { 0.0f, 0.0f, -56.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
                 
                {
                GLTVector3 vPoints[3] = {{ 0.0f, 0.0f, -56.0f },
                                        { 0.0f, 15.0f, 30.0f },
                                        { 15.0f,0.0f,30.0f }};
 
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
                  
   
  glNormal3f(0.0f, -1.0f, 0.0f);
  glVertex3f(15.0f,0.0f,30.0f);
  glVertex3f(-15.0f, 0.0f, 30.0f);
  glVertex3f(0.0f, 0.0f, -56.0f);
   
                ///////////////////////////////////////////////
                // Left wing
                // Large triangle for bottom of wing
                {
                GLTVector3 vPoints[3] = {{ 0.0f,2.0f,27.0f },
                                        { -60.0f, 2.0f, -8.0f },
                                        { 60.0f, 2.0f, -8.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                         
                {
                GLTVector3 vPoints[3] = {{ 60.0f, 2.0f, -8.0f},
     {0.0f, 7.0f, -8.0f},
     {0.0f,2.0f,27.0f }};
               
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                {
                GLTVector3 vPoints[3] = {{60.0f, 2.0f, -8.0f},
     {-60.0f, 2.0f, -8.0f},
     {0.0f,7.0f,-8.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                {
                GLTVector3 vPoints[3] = {{0.0f,2.0f,27.0f},
                                        {0.0f, 7.0f, -8.0f},
                                        {-60.0f, 2.0f, -8.0f}};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                       
                // Tail section///////////////////////////////
                // Bottom of back fin
  glNormal3f(0.0f, -1.0f, 0.0f);
  glVertex3f(-30.0f, -0.50f, -57.0f);
  glVertex3f(30.0f, -0.50f, -57.0f);
  glVertex3f(0.0f,-0.50f,-40.0f);
                {
                GLTVector3 vPoints[3] = {{ 0.0f,-0.5f,-40.0f },
     {30.0f, -0.5f, -57.0f},
     {0.0f, 4.0f, -57.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                       
                {
                GLTVector3 vPoints[3] = {{ 0.0f, 4.0f, -57.0f },
     { -30.0f, -0.5f, -57.0f },
     { 0.0f,-0.5f,-40.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }

                {
                GLTVector3 vPoints[3] = {{ 30.0f,-0.5f,-57.0f },
     { -30.0f, -0.5f, -57.0f },
     { 0.0f, 4.0f, -57.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                {
                GLTVector3 vPoints[3] = {{ 0.0f,0.5f,-40.0f },
     { 3.0f, 0.5f, -57.0f },
     { 0.0f, 25.0f, -65.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                       
                {
                GLTVector3 vPoints[3] = {{ 0.0f, 25.0f, -65.0f },
     { -3.0f, 0.5f, -57.0f},
     { 0.0f,0.5f,-40.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                {
                GLTVector3 vPoints[3] = {{ 3.0f,0.5f,-57.0f },
     { -3.0f, 0.5f, -57.0f },
     { 0.0f, 25.0f, -65.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
               
        glEnd();
               
     // Restore the matrix state
 glPopMatrix();
 // Display the results
 glutSwapBuffers();
 }
// This function does any needed initialization on the rendering
// context.
void SetupRC()
    {
    // Light values and coordinates
    GLfloat  ambientLight[] = { 0.3f, 0.3f, 0.3f, 1.0f };
    GLfloat  diffuseLight[] = { 0.7f, 0.7f, 0.7f, 1.0f };
    glEnable(GL_DEPTH_TEST); // Hidden surface removal
    glFrontFace(GL_CCW);  // Counter clock-wise polygons face out
    glEnable(GL_CULL_FACE);  // Do not calculate inside of jet
    // Enable lighting
    glEnable(GL_LIGHTING);
    // Setup and enable light 0
    glLightfv(GL_LIGHT0,GL_AMBIENT,ambientLight);
    glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuseLight);
    glEnable(GL_LIGHT0);
    // Enable color tracking
    glEnable(GL_COLOR_MATERIAL);
 
    // Set Material properties to follow glColor values
    glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
    // Light blue background
    glClearColor(0.0f, 0.0f, 1.0f, 1.0f );
    }
/////////////////////////////////////////////////////
// Handle arrow keys
void SpecialKeys(int key, int x, int y)
    {
    if(key == GLUT_KEY_UP)
        xRot-= 5.0f;
    if(key == GLUT_KEY_DOWN)
        xRot += 5.0f;
    if(key == GLUT_KEY_LEFT)
        yRot -= 5.0f;
    if(key == GLUT_KEY_RIGHT)
        yRot += 5.0f;
    if(key > 356.0f)
        xRot = 0.0f;
    if(key < -1.0f)
        xRot = 355.0f;
    if(key > 356.0f)
        yRot = 0.0f;
    if(key < -1.0f)
        yRot = 355.0f;
    // Refresh the Window
    glutPostRedisplay();
    }

//////////////////////////////////////////////////////////
// Reset projection and light position
void ChangeSize(int w, int h)
    {
    GLfloat fAspect;
    GLfloat lightPos[] = { -50.f, 50.0f, 100.0f, 1.0f };
    // Prevent a divide by zero
    if(h == 0)
        h = 1;
    // Set Viewport to window dimensions
    glViewport(0, 0, w, h);
    // Reset coordinate system
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    fAspect = (GLfloat) w / (GLfloat) h;
    gluPerspective(45.0f, fAspect, 1.0f, 225.0f);
   
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
   
    glLightfv(GL_LIGHT0,GL_POSITION,lightPos);
    glTranslatef(0.0f, 0.0f, -150.0f);
    }
int main(int argc, char* argv[])
    {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(800,600);
    glutCreateWindow("Lighted Jet");
    glutReshapeFunc(ChangeSize);
    glutSpecialFunc(SpecialKeys);
    glutDisplayFunc(RenderScene);
    SetupRC();
    glutMainLoop();
    return 0;
    }
#include<windows.h>
#include<gl/gl.h>
#include<gl/glut.h>// System and OpenGL Stuff
#include"ww.h"
// Rotation amounts
static GLfloat xRot = 0.0f;
static GLfloat yRot = 0.0f;

// Called to draw scene
void RenderScene(void)
 {
 GLTVector3 vNormal; // Storeage for calculated surface normal
 // Clear the window with current clearing color
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 // Save the matrix state and do the rotations
 glPushMatrix();
 glRotatef(xRot, 1.0f, 0.0f, 0.0f);
 glRotatef(yRot, 0.0f, 1.0f, 0.0f);

 // Nose Cone - Points straight down
        // Set material color
 glColor3ub(128, 128, 128);
 glBegin(GL_TRIANGLES);
                glNormal3f(0.0f, -1.0f, 0.0f);
  glNormal3f(0.0f, -1.0f, 0.0f);
  glVertex3f(0.0f, 0.0f, 60.0f);
  glVertex3f(-15.0f, 0.0f, 30.0f);
  glVertex3f(15.0f,0.0f,30.0f);
               
 
                // Verticies for this panel
                {
                GLTVector3 vPoints[3] = {{ 15.0f, 0.0f,  30.0f},
                                        { 0.0f,  15.0f, 30.0f},
                                        { 0.0f,  0.0f,  60.0f}};
                // Calculate the normal for the plane
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
  glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                } 

                {
                GLTVector3 vPoints[3] = {{ 0.0f, 0.0f, 60.0f },
                                        { 0.0f, 15.0f, 30.0f },
                                        { -15.0f, 0.0f, 30.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }

                // Body of the Plane ////////////////////////
                {
                GLTVector3 vPoints[3] = {{ -15.0f, 0.0f, 30.0f },
                                        { 0.0f, 15.0f, 30.0f },
            { 0.0f, 0.0f, -56.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
                 
                {
                GLTVector3 vPoints[3] = {{ 0.0f, 0.0f, -56.0f },
                                        { 0.0f, 15.0f, 30.0f },
                                        { 15.0f,0.0f,30.0f }};
 
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
                  
   
  glNormal3f(0.0f, -1.0f, 0.0f);
  glVertex3f(15.0f,0.0f,30.0f);
  glVertex3f(-15.0f, 0.0f, 30.0f);
  glVertex3f(0.0f, 0.0f, -56.0f);
   
                ///////////////////////////////////////////////
                // Left wing
                // Large triangle for bottom of wing
                {
                GLTVector3 vPoints[3] = {{ 0.0f,2.0f,27.0f },
                                        { -60.0f, 2.0f, -8.0f },
                                        { 60.0f, 2.0f, -8.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                         
                {
                GLTVector3 vPoints[3] = {{ 60.0f, 2.0f, -8.0f},
     {0.0f, 7.0f, -8.0f},
     {0.0f,2.0f,27.0f }};
               
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                {
                GLTVector3 vPoints[3] = {{60.0f, 2.0f, -8.0f},
     {-60.0f, 2.0f, -8.0f},
     {0.0f,7.0f,-8.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                {
                GLTVector3 vPoints[3] = {{0.0f,2.0f,27.0f},
                                        {0.0f, 7.0f, -8.0f},
                                        {-60.0f, 2.0f, -8.0f}};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                       
                // Tail section///////////////////////////////
                // Bottom of back fin
  glNormal3f(0.0f, -1.0f, 0.0f);
  glVertex3f(-30.0f, -0.50f, -57.0f);
  glVertex3f(30.0f, -0.50f, -57.0f);
  glVertex3f(0.0f,-0.50f,-40.0f);
                {
                GLTVector3 vPoints[3] = {{ 0.0f,-0.5f,-40.0f },
     {30.0f, -0.5f, -57.0f},
     {0.0f, 4.0f, -57.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                       
                {
                GLTVector3 vPoints[3] = {{ 0.0f, 4.0f, -57.0f },
     { -30.0f, -0.5f, -57.0f },
     { 0.0f,-0.5f,-40.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }

                {
                GLTVector3 vPoints[3] = {{ 30.0f,-0.5f,-57.0f },
     { -30.0f, -0.5f, -57.0f },
     { 0.0f, 4.0f, -57.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                {
                GLTVector3 vPoints[3] = {{ 0.0f,0.5f,-40.0f },
     { 3.0f, 0.5f, -57.0f },
     { 0.0f, 25.0f, -65.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                       
                {
                GLTVector3 vPoints[3] = {{ 0.0f, 25.0f, -65.0f },
     { -3.0f, 0.5f, -57.0f},
     { 0.0f,0.5f,-40.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
                {
                GLTVector3 vPoints[3] = {{ 3.0f,0.5f,-57.0f },
     { -3.0f, 0.5f, -57.0f },
     { 0.0f, 25.0f, -65.0f }};
                gltGetNormalVector(vPoints[0], vPoints[1], vPoints[2], vNormal);
                glNormal3fv(vNormal);
  glVertex3fv(vPoints[0]);
  glVertex3fv(vPoints[1]);
  glVertex3fv(vPoints[2]);
                }
               
               
        glEnd();
               
     // Restore the matrix state
 glPopMatrix();
 // Display the results
 glutSwapBuffers();
 }
// This function does any needed initialization on the rendering
// context.
void SetupRC()
    {
    // Light values and coordinates
    GLfloat  ambientLight[] = { 0.3f, 0.3f, 0.3f, 1.0f };
    GLfloat  diffuseLight[] = { 0.7f, 0.7f, 0.7f, 1.0f };
    glEnable(GL_DEPTH_TEST); // Hidden surface removal
    glFrontFace(GL_CCW);  // Counter clock-wise polygons face out
    glEnable(GL_CULL_FACE);  // Do not calculate inside of jet
    // Enable lighting
    glEnable(GL_LIGHTING);
    // Setup and enable light 0
    glLightfv(GL_LIGHT0,GL_AMBIENT,ambientLight);
    glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuseLight);
    glEnable(GL_LIGHT0);
    // Enable color tracking
    glEnable(GL_COLOR_MATERIAL);
 
    // Set Material properties to follow glColor values
    glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
    // Light blue background
    glClearColor(0.0f, 0.0f, 1.0f, 1.0f );
    }
/////////////////////////////////////////////////////
// Handle arrow keys
void SpecialKeys(int key, int x, int y)
    {
    if(key == GLUT_KEY_UP)
        xRot-= 5.0f;
    if(key == GLUT_KEY_DOWN)
        xRot += 5.0f;
    if(key == GLUT_KEY_LEFT)
        yRot -= 5.0f;
    if(key == GLUT_KEY_RIGHT)
        yRot += 5.0f;
    if(key > 356.0f)
        xRot = 0.0f;
    if(key < -1.0f)
        xRot = 355.0f;
    if(key > 356.0f)
        yRot = 0.0f;
    if(key < -1.0f)
        yRot = 355.0f;
    // Refresh the Window
    glutPostRedisplay();
    }

//////////////////////////////////////////////////////////
// Reset projection and light position
void ChangeSize(int w, int h)
    {
    GLfloat fAspect;
    GLfloat lightPos[] = { -50.f, 50.0f, 100.0f, 1.0f };
    // Prevent a divide by zero
    if(h == 0)
        h = 1;
    // Set Viewport to window dimensions
    glViewport(0, 0, w, h);
    // Reset coordinate system
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    fAspect = (GLfloat) w / (GLfloat) h;
    gluPerspective(45.0f, fAspect, 1.0f, 225.0f);
   
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
   
    glLightfv(GL_LIGHT0,GL_POSITION,lightPos);
    glTranslatef(0.0f, 0.0f, -150.0f);
    }
int main(int argc, char* argv[])
    {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(800,600);
    glutCreateWindow("Lighted Jet");
    glutReshapeFunc(ChangeSize);
    glutSpecialFunc(SpecialKeys);
    glutDisplayFunc(RenderScene);
    SetupRC();
    glutMainLoop();
    return 0;
    }
//ww.c
#include "ww.h"
#include <math.h>
void gltGetNormalVector(const GLTVector3 vP1, const GLTVector3 vP2, const GLTVector3 vP3, GLTVector3 vNormal)
    {
    GLTVector3 vV1, vV2;
   
    gltSubtractVectors(vP2, vP1, vV1);
    gltSubtractVectors(vP3, vP1, vV2);
   
    gltVectorCrossProduct(vV1, vV2, vNormal);
    gltNormalizeVector(vNormal);
    }
// Subtract one vector from another
void gltSubtractVectors(const GLTVector3 vFirst, const GLTVector3 vSecond, GLTVector3 vResult)
    {
    vResult[0] = vFirst[0] - vSecond[0];
    vResult[1] = vFirst[1] - vSecond[1];
    vResult[2] = vFirst[2] - vSecond[2];
    }
void gltVectorCrossProduct(const GLTVector3 vU, const GLTVector3 vV, GLTVector3 vResult)
 {
 vResult[0] = vU[1]*vV[2] - vV[1]*vU[2];
 vResult[1] = -vU[0]*vV[2] + vV[0]*vU[2];
 vResult[2] = vU[0]*vV[1] - vV[0]*vU[1];
 }

void gltNormalizeVector(GLTVector3 vNormal)
    {
    GLfloat fLength = 1.0f / gltGetVectorLength(vNormal);
    gltScaleVector(vNormal, fLength);
    }
// Gets the length of a vector
GLfloat gltGetVectorLength(const GLTVector3 vVector)
    {
    return (GLfloat)sqrt(gltGetVectorLengthSqrd(vVector));
    }
   
void gltScaleVector(GLTVector3 vVector, const GLfloat fScale)
    {
    vVector[0] *= fScale; vVector[1] *= fScale; vVector[2] *= fScale;
    }
GLfloat gltGetVectorLengthSqrd(const GLTVector3 vVector)
    {
    return (vVector[0]*vVector[0]) + (vVector[1]*vVector[1]) + (vVector[2]*vVector[2]);
    }
   

改程序

        从昨天开始就一直在改这个程序,原因是书上的例子总是要调用一个他们编译好的头文件,感觉每次都必须包含,无形中多了很多的代码。于是想精简一下,可是直都有错误,错误如下:
       error LNK2001: unresolved external symbol __gltGetNormalVector
       fatal error LNK1120: 1 unresolved externals
      上网查了一些人的帖子,看来有很多人和我有同样的困惑,大多数人都是说是连接阶段的问题。报错的意思是找不到那个函数。或者未提供那个函数的源代码,或者未提供连接的静态库(.lib文件)。还有的说是在程序中采用了多线程,需要在工程-设置-C/C++中把分类改为Code generation,然后把Use run-time library改为Multithreaded。都试过了,还是有这个错误。
      最后看到一个帖子,说“一般是C调用了cpp导出的函数,要加extern C”。虽然还不太明白要怎么使用,但把后缀为.cpp的文件改为.c后,程序就好用了。有关extern C的用法还要具体考证。
       程序如下:
(头文件)
#include <windows.h>
#include <winnt.h>
#include <gl\gl.h>
#include <gl\glu.h>
// Universal includes
#include <math.h>
//////////////////////////////////////////////////////
// Some data types
typedef GLfloat GLTVector3[3];      // Three component floating point vector
void gltNormalizeVector(GLTVector3 vNormal);
void gltGetNormalVector(const GLTVector3 vP1, const GLTVector3 vP2, const GLTVector3 vP3, GLTVector3 vNormal);
void gltVectorCrossProduct(const GLTVector3 vU, const GLTVector3 vV, GLTVector3 vResult);
void gltSubtractVectors(const GLTVector3 vFirst, const GLTVector3 vSecond, GLTVector3 vResult);
GLfloat gltGetVectorLength(const GLTVector3 vVector);
void gltScaleVector(GLTVector3 vVector, const GLfloat fScale);
GLfloat gltGetVectorLengthSqrd(const GLTVector3 vVector);