Loaded symbols for 'C:\Documents and Settings\shen\桌面\资料 翻译相关\改进pulsar\Debug\改进pulsar.exe'
Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\opengl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\glu32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ddraw.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\dciman32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\glut32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\winmm.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\usp10.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\uxtheme.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\nview.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shell32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\psapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ntmarta.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wldap32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\samlib.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTF.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTFIME.IME', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\nvwddi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\nvoglnt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
The thread 0x480 has exited with code 0 (0x0).
The thread 0x280 has exited with code -1073741819 (0xC0000005).
The thread 0xE1C has exited with code -1073741819 (0xC0000005).
The program 'C:\Documents and Settings\shen\桌面\资料 翻译相关\改进pulsar\Debug\改进pulsar.exe' has exited with code -1073741819 (0xC0000005).
程序运行没有错误,但是.exe出不来 看不到运行结果,求助高手

解决方案 »

  1.   

    程序如下:
    #include <windows.h>
    #include <GL/gl.h>
    #include <GL/glu.h>
    #include <gl/glaux.h>
    #include <stdio.h>
    #include <io.h>
    #include <math.h>
    #include <gl\glut.h>
    #include <string.h>
    #include <stdlib.h>
    HWND hWnd;
    HDC hDC;
    HGLRC hRC=NULL;
    HINSTANCE hInstance;RECT rect;int sw=640;
    int sh=480;
    bool fullscreen=1;
    GLfloat aspect;
    #pragma comment(lib,"opengl32.lib")
    #pragma comment(lib,"glu32.lib")
    #pragma comment(lib,"glaux.lib")void SceneInit(int w,int h)
    {
    glShadeModel(GL_SMOOTH);
    glClearColor(0.0,0.0,0.0,0.5);
    glClearDepth(1.0f);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
    }void SceneResizeViewport(GLsizei w,GLsizei h)
    {
    if (h==0)
    {
    h=1;
    }
    aspect=(GLfloat)w/(GLfloat)h; glViewport(0,0,w,h);
    glMatrixMode(GL_PROJECTION);
        glLoadIdentity(); gluPerspective(45.0f,aspect,0.1f,100.0f);
        glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    }typedef struct {
       double x,y,z;
    } XYZ;
    typedef struct {
       double r,g,b;
    } COLOUR;
    typedef struct {
       XYZ vp;              /* View position           */
       XYZ vd;              /* View direction vector   */
       XYZ vu;              /* View up direction       */
       XYZ pr;              /* Point to rotate about   */
       double focallength;  /* Focal Length along vd   */
       double aperture;     /* Camera aperture         */
       double eyesep;       /* Eye separation          */
       int screenwidth,screenheight;
    } CAMERA;#define ABS(x) (x < 0 ? -(x) : (x))
    #define MIN(x,y) (x < y ? x : y)
    #define MAX(x,y) (x > y ? x : y)
    #define TRUE  1
    #define FALSE 0
    #define ESC 27
    #define PI 3.141592653589793238462643
    #define CROSSPROD(p1,p2,p3) \
       p3.x = p1.y*p2.z - p1.z*p2.y; \
       p3.y = p1.z*p2.x - p1.x*p2.z; \
       p3.z = p1.x*p2.y - p1.y*p2.x#define DTOR            0.0174532925
    #define RTOD            57.2957795CAMERA camera;
    XYZ origin = {0.0,0.0,0.0};
    double rotateangle = 0.0;    /* Pulsar Rotation angle */void Normalise(XYZ *p)
    {
       double length;   length = sqrt(p->x * p->x + p->y * p->y + p->z * p->z);
       if (length != 0)
       {
          p->x /= length;
          p->y /= length;
          p->z /= length;
       } else 
       {
          p->x = 0;
          p->y = 0;
          p->z = 0;
       }
    }/* Flags */
    int stereo = FALSE;
    int showconstruct = FALSE;
    int windowdump = FALSE;
    int record = FALSE;
    int debug = FALSE;int currentbutton = -1;
    double rotatespeed = 1;
    double dtheta = 1;/*
       Rotate (ix,iy) or roll (iz) the camera about the focal point
       ix,iy,iz are flags, 0 do nothing, +- 1 rotates in opposite directions
       Correctly updating all camera attributes
    */
    void RotateCamera(int ix,int iy,int iz)
    {
       XYZ vp,vu,vd;
       XYZ right;
       XYZ newvp,newr;
       double radius,dd,radians;
       double dx,dy,dz;   vu = camera.vu;
       Normalise(&vu);
       vp = camera.vp;
       vd = camera.vd;
       Normalise(&vd);
       CROSSPROD(vd,vu,right);
       Normalise(&right);
       radians = dtheta * PI / 180.0;   /* Handle the roll */
       if (iz != 0) {
          camera.vu.x += iz * right.x * radians;
          camera.vu.y += iz * right.y * radians;
          camera.vu.z += iz * right.z * radians;
          Normalise(&camera.vu);
          return;
       }   /* Distance from the rotate point */
       dx = camera.vp.x - camera.pr.x;
       dy = camera.vp.y - camera.pr.y;
       dz = camera.vp.z - camera.pr.z;
       radius = sqrt(dx*dx + dy*dy + dz*dz);   /* Determine the new view point */
       dd = radius * radians;
       newvp.x = vp.x + dd * ix * right.x + dd * iy * vu.x - camera.pr.x;
       newvp.y = vp.y + dd * ix * right.y + dd * iy * vu.y - camera.pr.y;
       newvp.z = vp.z + dd * ix * right.z + dd * iy * vu.z - camera.pr.z;
       Normalise(&newvp);
       camera.vp.x = camera.pr.x + radius * newvp.x;
       camera.vp.y = camera.pr.y + radius * newvp.y;
       camera.vp.z = camera.pr.z + radius * newvp.z;   /* Determine the new right vector */
       newr.x = camera.vp.x + right.x - camera.pr.x;
       newr.y = camera.vp.y + right.y - camera.pr.y;
       newr.z = camera.vp.z + right.z - camera.pr.z;
       Normalise(&newr);
       newr.x = camera.pr.x + radius * newr.x - camera.vp.x;
       newr.y = camera.pr.y + radius * newr.y - camera.vp.y;
       newr.z = camera.pr.z + radius * newr.z - camera.vp.z;   camera.vd.x = camera.pr.x - camera.vp.x;
       camera.vd.y = camera.pr.y - camera.vp.y;
       camera.vd.z = camera.pr.z - camera.vp.z;
       Normalise(&camera.vd);   /* Determine the new up vector */
       CROSSPROD(newr,camera.vd,camera.vu);
       Normalise(&camera.vu);   if (debug)
          fprintf(stderr,"Camera position: (%g,%g,%g)\n",
             camera.vp.x,camera.vp.y,camera.vp.z);
    }
    void CameraHome(int mode)
    {
       camera.aperture = 50;
       camera.focallength = 70;
       camera.eyesep = camera.focallength / 20;
       camera.pr = origin;/*
       camera.vp.x = camera.focallength; 
       camera.vp.y = 0; 
       camera.vp.z = 0;
       camera.vd.x = -1;
       camera.vd.y = 0;
       camera.vd.z = 0;
    */
       /* Special camera position so the beam crosses the view */
       camera.vp.x = 39;
       camera.vp.y = 53;
       camera.vp.z = 22;
       camera.vd.x = -camera.vp.x; 
       camera.vd.y = -camera.vp.y; 
       camera.vd.z = -camera.vp.z;   camera.vu.x = 0;  
       camera.vu.y = 1; 
       camera.vu.z = 0;
    }
    /*
       Handle mouse motion
    */
    void HandleMouseMotion(int x,int y)
    {
       static int xlast=-1,ylast=-1;
       int dx,dy;   dx = x - xlast;
       dy = y - ylast;
       if (dx < 0)      dx = -1;
       else if (dx > 0) dx =  1;
       if (dy < 0)      dy = -1;
       else if (dy > 0) dy =  1;   if (currentbutton == GLUT_LEFT_BUTTON)
          RotateCamera(-dx,dy,0);
       else if (currentbutton == GLUT_MIDDLE_BUTTON)
          RotateCamera(0,0,dx);   xlast = x;
       ylast = y;
    }
    /*
       Handle mouse events
       Right button events are passed to menu handlers
    */
    void HandleMouse(int button,int state,int x,int y)
    {
       if (state == GLUT_DOWN) {
          if (button == GLUT_LEFT_BUTTON) {
             currentbutton = GLUT_LEFT_BUTTON;
          } else if (button == GLUT_MIDDLE_BUTTON) {
             currentbutton = GLUT_MIDDLE_BUTTON;
          } 
       }
    }
    /*
       Handle the speed menu
       The rotate speed is in degrees
    */
    void HandleSpeedMenu(int whichone)
    {
       switch (whichone) {
       case 1: rotatespeed = 0.0; break;
       case 2: rotatespeed = 0.3; break;
       case 3: rotatespeed = 1;   break;
       case 4: rotatespeed = 3;   break;
       case 5: rotatespeed = 10;  break;
       }
    }
      

  2.   

    void TranslateCamera(int ix,int iy)
    {
       XYZ vp,vu,vd;
       XYZ right;
       XYZ newvp,newr;
       double radians,delta;   vu = camera.vu;
       Normalise(&vu);
       vp = camera.vp;
       vd = camera.vd;
       Normalise(&vd);
       CROSSPROD(vd,vu,right);
       Normalise(&right);
       radians = dtheta * PI / 180.0;
       delta = dtheta * camera.focallength / 90.0;   camera.vp.x += iy * vu.x * delta;
       camera.vp.y += iy * vu.y * delta;
       camera.vp.z += iy * vu.z * delta;
       camera.pr.x += iy * vu.x * delta;
       camera.pr.y += iy * vu.y * delta;
       camera.pr.z += iy * vu.z * delta;   camera.vp.x += ix * right.x * delta;
       camera.vp.y += ix * right.y * delta;
       camera.vp.z += ix * right.z * delta;
       camera.pr.x += ix * right.x * delta;
       camera.pr.y += ix * right.y * delta;
       camera.pr.z += ix * right.z * delta;
    }
    /*
       Handle the camera spin menu
    */
    void HandleSpinMenu(int whichone)
    {
       switch (whichone) {
       case 1: dtheta = 1; break;
       case 2: dtheta = 2; break;
       case 3: dtheta = 3; break;
       case 4: dtheta = 5; break;
       }
    }
    /*
       Handle the main menu
    */
    void HandleMainMenu(int whichone)
    {
       switch (whichone) {
       case 1:
          showconstruct = !showconstruct;
          break;
       case 9: 
          exit(0); 
          break;
       }
    }
    /*
       Set up the lighing environment
    */
    void MakeLighting(void)
    {
       GLfloat fullambient[4] = {1.0,1.0,1.0,1.0};
       GLfloat position[4] = {0.0,0.0,0.0,0.0};
       GLfloat ambient[4]  = {0.2,0.2,0.2,1.0};
       GLfloat diffuse[4]  = {1.0,1.0,1.0,1.0};
       GLfloat specular[4] = {0.0,0.0,0.0,1.0};   /* Turn off all the lights */
       glDisable(GL_LIGHT0);
       glDisable(GL_LIGHT1);
       glDisable(GL_LIGHT2);
       glDisable(GL_LIGHT3);
       glDisable(GL_LIGHT4);
       glDisable(GL_LIGHT5);
       glDisable(GL_LIGHT6);
       glDisable(GL_LIGHT7);
       glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,GL_TRUE);
       glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_FALSE);   /* Turn on the appropriate lights */
       glLightModelfv(GL_LIGHT_MODEL_AMBIENT,fullambient);
       glLightfv(GL_LIGHT0,GL_POSITION,position);
       glLightfv(GL_LIGHT0,GL_AMBIENT,ambient);
       glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuse);
       glLightfv(GL_LIGHT0,GL_SPECULAR,specular);
       glEnable(GL_LIGHT0);   /* Sort out the shading algorithm */
       glShadeModel(GL_SMOOTH);   /* Turn lighting on */
       glEnable(GL_LIGHTING);
    }
    /*
       Create the geometry for the pulsar
    */
    void MakeGeometry(void)
    {
       int i,j,k;
       double cradius = 5.3;         /* Final radius of the cone */
       double clength = 30;            /* Cone length */
       double sradius = 10;            /* Final radius of sphere */
       double r1,r2;                  /* Min and Max radius of field lines */
       double x,y,z;
       XYZ p[4],n[4];
       COLOUR grey = {0.7,0.7,0.7};
       COLOUR white = {1.0,1.0,1.0};
       GLfloat specular[4] = {1.0,1.0,1.0,1.0};
       GLfloat shiny[1] = {5.0};
       char cmd[64];
       
       glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,specular);
       glMaterialfv(GL_FRONT_AND_BACK,GL_SHININESS,shiny);
    /* 
       /* Top level rotation  - spin */
       glPushMatrix();
       glRotatef(rotateangle,0.0,1.0,0.0);   /* Axis of rotation */
       if (showconstruct) {
          glColor3f(white.r,white.g,white.b);
          glBegin(GL_LINES);
          glVertex3f(0.0,-60.0,0.0);
          glVertex3f(0.0,60.0,0.0);
          glEnd();
       }   /* Rotation about spin axis */
       glPushMatrix();
       glRotatef(45.0,0.0,0.0,1.0);   /* Magnetic axis */
       if (showconstruct) {
          glColor3f(white.r,white.g,white.b);
          glBegin(GL_LINES);
          glVertex3f(0.0,-60.0,0.0);
          glVertex3f(0.0,60.0,0.0);
          glEnd();
       }   /* Light in center */
       glColor3f(white.r,white.g,white.b);
       glutSolidSphere(5.0,16,8);   /* Spherical center */
       for (i=0;i<360;i+=5) {
          for (j=-80;j<80;j+=5) {
      p[0].x = sradius * cos(j*DTOR) * cos(i*DTOR);
             p[0].y = sradius * sin(j*DTOR);
             p[0].z = sradius * cos(j*DTOR) * sin(i*DTOR);
             n[0] = p[0];         p[1].x = sradius * cos((j+5)*DTOR) * cos(i*DTOR);
             p[1].y = sradius * sin((j+5)*DTOR);
             p[1].z = sradius * cos((j+5)*DTOR) * sin(i*DTOR);
             n[1] = p[1];         p[2].x = sradius * cos((j+5)*DTOR) * cos((i+5)*DTOR);
             p[2].y = sradius * sin((j+5)*DTOR);
             p[2].z = sradius * cos((j+5)*DTOR) * sin((i+5)*DTOR);
             n[2] = p[2];         p[3].x = sradius * cos(j*DTOR) * cos((i+5)*DTOR);
             p[3].y = sradius * sin(j*DTOR);
             p[3].z = sradius * cos(j*DTOR) * sin((i+5)*DTOR);
             n[3] = p[3];         glBegin(GL_POLYGON);
             if (i % 20 == 0)
                glColor3f(1.0,0.0,0.0);
             else
                glColor3f(0.5,0.0,0.0);
             for (k=0;k<4;k++) {
                glNormal3f(n[k].x,n[k].y,n[k].z);
                glVertex3f(p[k].x,p[k].y,p[k].z);
             }
             glEnd();
          }
       }   /* Draw the cones */
       for (j=-1;j<=1;j+=2) {
          for (i=0;i<360;i+=10) {
             
             p[0]   = origin;
             n[0]   = p[0];
             n[0].y = -1;         p[1].x = cradius * cos(i*DTOR);
             p[1].y = j*clength;
             p[1].z = cradius * sin(i*DTOR);
             n[1]   = p[1];
      n[1].y = 0;         p[2].x = cradius * cos((i+10)*DTOR);
             p[2].y = j*clength;
             p[2].z = cradius * sin((i+10)*DTOR);
             n[2]   = p[2];
             n[2].y = 0;         glBegin(GL_POLYGON);
             if (i % 30 == 0)
                glColor3f(0.0,0.2,0.0);
             else
                glColor3f(0.0,0.5,0.0);
             for (k=0;k<3;k++) {
                glNormal3f(n[k].x,n[k].y,n[k].z);
                glVertex3f(p[k].x,p[k].y,p[k].z);
             }
             glEnd();
          }
     }   /* Draw the field lines */
       r1 = 12;
       r2 = 16;
       for (j=0;j<360;j+=20) {
          glPushMatrix();
          glRotatef((double)j,0.0,1.0,0.0);
          glBegin(GL_LINE_STRIP);
          glColor3f(grey.r,grey.g,grey.b);
          for (i=-140;i<140;i++) {
             x = r1 + r1 * cos(i*DTOR);
             y = r2 * sin(i*DTOR);
             z = 0;
             glVertex3f(x,y,z);   
          }   
          glEnd();
          glPopMatrix();      
       }   glPopMatrix(); /* Pulsar axis rotation */
       glPopMatrix(); /* Pulsar spin */
    }