热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

计算机图形学的课程设计作业

显示一个Cu

显示一个Cube立方体,然后可以用鼠标拖动它旋转.

用OpenGL实现再简单不过了.我直接在Nehe的lesson7的程序总修改几下,就可以实现了.95%都是它已经写好了的代码.唯一修改的就是把6个面改成分别使用了六个不同的纹理图片.还增加了鼠标的拖动控制.

下面就是整个OpenGL程序.

/*
 *   a Cube for OpenGL Sample
 */

#include   // Header File For Windows
#include    // Header File For Standard Input/Output
#include    // Header File For The OpenGL32 Library
#include    // Header File For The GLu32 Library
#include   // Header File For The Glaux Library

HDC   hDC=NULL;  // Private GDI Device Context
HGLRC  hRC=NULL;  // Permanent Rendering Context
HWND  hWnd=NULL;  // Holds Our Window Handle
HINSTANCE hInstance;  // Holds The Instance Of The Application

bool keys[256];   // Array Used For The Keyboard Routine
bool active=TRUE;  // Window Active Flag Set To TRUE By Default
bool fullscreen=TRUE; // Fullscreen Flag Set To Fullscreen Mode By Default

GLfloat xrot;    // X Rotation
GLfloat yrot;    // Y Rotation

GLfloat LightAmbient[]=  { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightDiffuse[]=  { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightPosition[]= { 0.0f, 0.0f, 2.0f, 1.0f };

GLuint texture[6];   // Storage For 6 face Textures

int     LastXPos,LastYPos;
BOOL    IsLBDown = FALSE;

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration For WndProc

AUX_RGBImageRec *LoadBMP(char *Filename)    // Loads A Bitmap Image
{
 FILE *File=NULL;         // File Handle

 if (!Filename)          // Make Sure A Filename Was Given
 {
  return NULL;         // If Not Return NULL
 }

 File=fopen(Filename,"r");       // Check To See If The File Exists

 if (File)           // Does The File Exist?
 {
  fclose(File);         // Close The Handle
  return auxDIBImageLoad(Filename);    // Load The Bitmap And Return A Pointer
 }

 return NULL;          // If Load Failed Return NULL
}

int LoadGLTextures()         // Load Bitmaps And Convert To Textures
{
 int   i;
 char filename[128];
 AUX_RGBImageRec *TextureImage[6];     // Create Storage Space For The Texture

 memset(TextureImage,0,sizeof(void *)*6);            // Set The Pointer To NULL

 // Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
 
 for(i=0;i<6;i++)
 {
  sprintf(filename,"Data/%d.bmp",i+1);
  TextureImage[i] = LoadBMP(filename);
  if(!TextureImage[i])
  {
   char msg[256];
   sprintf(msg,"Cannot read the file : %s",filename);
   MessageBox(NULL,msg,"Error",MB_OK);
   return FALSE;
  }
 }

 glGenTextures(6,texture);
 
 for(i=0;i<6;i++)
 {
  glBindTexture(GL_TEXTURE_2D,texture[i]);
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
  glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[i]->sizeX, TextureImage[i]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[i]->data);

  if(TextureImage[i]->data)
   free(TextureImage[i]->data);
  free(TextureImage[i]);
 }

 return TRUE;          // Return The Status
}

GLvoid ReSizeGLScene(GLsizei width, GLsizei height)  // Resize And Initialize The GL Window
{
 if (t Load Return FALSE
 }

 glEnable(GL_TEXTURE_2D);       // Enable Texture Mapping
 glShadeModel(GL_SMOOTH);       // Enable Smooth Shading
 glClearColor(0.0f, 0.0f, 0.0f, 0.5f);    // Black Background
 glClearDepth(1.0f);         // Depth Buffer Setup
 glEnable(GL_DEPTH_TEST);       // Enables Depth Testing
 glDepthFunc(GL_LEQUAL);        // The Type Of Depth Testing To Do
 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
 glEnable(GL_LIGHTING);

 glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);  // Setup The Ambient Light
 glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);  // Setup The Diffuse Light
 glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light
 glEnable(GL_LIGHT1);        // Enable Light One
 return TRUE;          // Initialization Went OK
}

int DrawGLScene(GLvoid)         // Here's Where We Do All The Drawing
{
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
 glLoadIdentity();         // Reset The View
 glTranslatef(0.0f,0.0f,-5.0f);

 glRotatef(xrot,1.0f,0.0f,0.0f);
 glRotatef(yrot,0.0f,1.0f,0.0f);

 // Front Face
 glBindTexture(GL_TEXTURE_2D, texture[0]);
 glBegin(GL_QUADS);
  glNormal3f( 0.0f, 0.0f, 1.0f);
  glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
  glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
  glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
  glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f,  1.0f);
 glEnd();
 
 // Back Face
 glBindTexture(GL_TEXTURE_2D, texture[1]);
 glBegin(GL_QUADS);
  glNormal3f( 0.0f, 0.0f,-1.0f);
  glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
  glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
  glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
  glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
 glEnd();

 
 // Top Face
 glBindTexture(GL_TEXTURE_2D, texture[2]);
 glBegin(GL_QUADS);
  glNormal3f( 0.0f, 1.0f, 0.0f);
  glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
  glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,  1.0f,  1.0f);
  glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
  glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
 glEnd();


 // Bottom Face
 glBindTexture(GL_TEXTURE_2D, texture[3]);
 glBegin(GL_QUADS);
  glNormal3f( 0.0f,-1.0f, 0.0f);
  glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
  glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
  glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
  glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
 glEnd();

 // Right face
 glBindTexture(GL_TEXTURE_2D, texture[4]);
 glBegin(GL_QUADS);
  glNormal3f( 1.0f, 0.0f, 0.0f);
  glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
  glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
  glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
  glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
 glEnd();


 // Left Face
 glBindTexture(GL_TEXTURE_2D, texture[5]);
 glBegin(GL_QUADS);
  glNormal3f(-1.0f, 0.0f, 0.0f);
  glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
  glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
  glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f,  1.0f);
  glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
 glEnd();

 //xrot+=xspeed;
 //yrot+=yspeed;
 return TRUE;          // Keep Going
}

GLvoid KillGLWindow(GLvoid)        // Properly Kill The Window
{
 if (fullscreen)          // Are We In Fullscreen Mode?
 {
  ChangeDisplaySettings(NULL,0);     // If So Switch Back To The Desktop
  ShowCursor(TRUE);        // Show Mouse Pointer
 }

 if (hRC)           // Do We Have A Rendering Context?
 {
  if (!wglMakeCurrent(NULL,NULL))     // Are We Able To Release The DC And RC Contexts?
  {
   MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
  }

  if (!wglDeleteContext(hRC))      // Are We Able To Delete The RC?
  {
   MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
  }
  hRC=NULL;          // Set RC To NULL
 }

 if (hDC && !ReleaseDC(hWnd,hDC))     // Are We Able To Release The DC
 {
  MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
  hDC=NULL;          // Set DC To NULL
 }

 if (hWnd && !DestroyWindow(hWnd))     // Are We Able To Destroy The Window?
 {
  MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
  hWnd=NULL;          // Set hWnd To NULL
 }

 if (!UnregisterClass("OpenGL",hInstance))   // Are We Able To Unregister Class
 {
  MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
  hInstance=NULL;         // Set hInstance To NULL
 }
}

/* This Code Creates Our OpenGL Window.  Parameters Are:     *
 * title   - Title To Appear At The Top Of The Window    *
 * width   - Width Of The GL Window Or Fullscreen Mode    *
 * height   - Height Of The GL Window Or Fullscreen Mode   *
 * bits   - Number Of Bits To Use For Color (8/16/24/32)   *
 * fullscreenflag - Use Fullscreen Mode (TRUE) Or Windowed Mode (FALSE) */
 
BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag)
{
 GLuint  PixelFormat;   // Holds The Results After Searching For A Match
 WNDCLASS wc;      // Windows Class Structure
 DWORD  dwExStyle;    // Window Extended Style
 DWORD  dwStyle;    // Window Style
 RECT  WindowRect;    // Grabs Rectangle Upper Left / Lower Right Values
 WindowRect.left=(long)0;   // Set Left Value To 0
 WindowRect.right=(long)width;  // Set Right Value To Requested Width
 WindowRect.top=(long)0;    // Set Top Value To 0
 WindowRect.bottom=(long)height;  // Set Bottom Value To Requested Height

 fullscreen=fullscreenflag;   // Set The Global Fullscreen Flag

 hInstance   = GetModuleHandle(NULL);    // Grab An Instance For Our Window
 wc.style   = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw On Size, And Own DC For Window.
 wc.lpfnWndProc  = (WNDPROC) WndProc;     // WndProc Handles Messages
 wc.cbClsExtra  = 0;         // No Extra Window Data
 wc.cbWndExtra  = 0;         // No Extra Window Data
 wc.hInstance  = hInstance;       // Set The Instance
 wc.hIcon   = LoadIcon(NULL, IDI_WINLOGO);   // Load The Default Icon
 wc.hCursor   = LoadCursor(NULL, IDC_ARROW);   // Load The Arrow Pointer
 wc.hbrBackground = NULL;         // No Background Required For GL
 wc.lpszMenuName  = NULL;         // We Don't Want A Menu
 wc.lpszClassName = "OpenGL";        // Set The Class Name

 if (!RegisterClass(&wc))         // Attempt To Register The Window Class
 {
  MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
  return FALSE;           // Return FALSE
 }
 
 if (fullscreen)            // Attempt Fullscreen Mode?
 {
  DEVMODE dmScreenSettings;        // Device Mode
  memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared
  dmScreenSettings.dmSize=sizeof(dmScreenSettings);  // Size Of The Devmode Structure
  dmScreenSettings.dmPelsWidth = width;    // Selected Screen Width
  dmScreenSettings.dmPelsHeight = height;    // Selected Screen Height
  dmScreenSettings.dmBitsPerPel = bits;     // Selected Bits Per Pixel
  dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;

  // Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
  if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
  {
   // If The Mode Fails, Offer Two Options.  Quit Or Use Windowed Mode.
   if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By/nYour Video Card. Use Windowed Mode Instead?","OpenGL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
   {
    fullscreen=FALSE;  // Windowed Mode Selected.  Fullscreen = FALSE
   }
   else
   {
    // Pop Up A Message Box Letting User Know The Program Is Closing.
    MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP);
    return FALSE;         // Return FALSE
   }
  }
 }

 if (fullscreen)            // Are We Still In Fullscreen Mode?
 {
  dwEx WS_EX_WINDOWEDGE;   // Window Extended Style
  dwOpenGL",       // Class Name
        title,        // Window Title
        dwStyle |       // Defined Window Style
        WS_CLIPSIBLINGS |     // Required Window Style
        WS_CLIPCHILDREN,     // Required Window Style
        0, 0,        // Window Position
        WindowRect.right-WindowRect.left, // Calculate Window Width
        WindowRect.bottom-WindowRect.top, // Calculate Window Height
        NULL,        // No Parent Window
        NULL,        // No Menu
        hInstance,       // Instance
        NULL)))        // Dont Pass Anything To WM_CREATE
 {
  KillGLWindow();        // Reset The Display
  MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);
  return FALSE;        // Return FALSE
 }

 static PIXELFORMATDESCRIPTOR pfd=    // pfd Tells Windows How We Want Things To Be
 {
  sizeof(PIXELFORMATDESCRIPTOR),    // Size Of This Pixel Format Descriptor
  1,           // Version Number
  PFD_DRAW_TO_WINDOW |      // Format Must Support Window
  PFD_SUPPORT_OPENGL |      // Format Must Support OpenGL
  PFD_DOUBLEBUFFER,       // Must Support Double Buffering
  PFD_TYPE_RGBA,        // Request An RGBA Format
  bits,          // Select Our Color Depth
  0, 0, 0, 0, 0, 0,       // Color Bits Ignored
  0,           // No Alpha Buffer
  0,           // Shift Bit Ignored
  0,           // No Accumulation Buffer
  0, 0, 0, 0,         // Accumulation Bits Ignored
  16,           // 16Bit Z-Buffer (Depth Buffer) 
  0,           // No Stencil Buffer
  0,           // No Auxiliary Buffer
  PFD_MAIN_PLANE,        // Main Drawing Layer
  0,           // Reserved
  0, 0, 0          // Layer Masks Ignored
 };
 
 if (!(hDC=GetDC(hWnd)))       // Did We Get A Device Context?
 {
  KillGLWindow();        // Reset The Display
  MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
  return FALSE;        // Return FALSE
 }

 if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) // Did Windows Find A Matching Pixel Format?
 {
  KillGLWindow();        // Reset The Display
  MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
  return FALSE;        // Return FALSE
 }

 if(!SetPixelFormat(hDC,PixelFormat,&pfd))  // Are We Able To Set The Pixel Format?
 {
  KillGLWindow();        // Reset The Display
  MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
  return FALSE;        // Return FALSE
 }

 if (!(hRC=wglCreateContext(hDC)))    // Are We Able To Get A Rendering Context?
 {
  KillGLWindow();        // Reset The Display
  MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
  return FALSE;        // Return FALSE
 }

 if(!wglMakeCurrent(hDC,hRC))     // Try To Activate The Rendering Context
 {
  KillGLWindow();        // Reset The Display
  MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
  return FALSE;        // Return FALSE
 }

 ShowWindow(hWnd,SW_SHOW);      // Show The Window
 SetForegroundWindow(hWnd);      // Slightly Higher Priority
 SetFocus(hWnd);         // Sets Keyboard Focus To The Window
 ReSizeGLScene(width, height);     // Set Up Our Perspective GL Screen

 if (!InitGL())         // Initialize Our Newly Created GL Window
 {
  KillGLWindow();        // Reset The Display
  MessageBox(NULL,"Initialization Failed.","ERROR",MB_OK|MB_ICONEXCLAMATION);
  return FALSE;        // Return FALSE
 }

 return TRUE;         // Success
}

LRESULT CALLBACK WndProc( HWND hWnd,   // Handle For This Window
       UINT uMsg,   // Message For This Window
       WPARAM wParam,   // Additional Message Information
       LPARAM lParam)   // Additional Message Information
{
 switch (uMsg)         // Check For Windows Messages
 {
  case WM_ACTIVATE:       // Watch For Window Activate Message
  {
   if (!HIWORD(wParam))     // Check Minimization State
   {
    active=TRUE;      // Program Is Active
   }
   else
   {
    active=FALSE;      // Program Is No Longer Active
   }

   return 0;        // Return To The Message Loop
  }

  case WM_SYSCOMMAND:       // Intercept System Commands
  {
   switch (wParam)       // Check System Calls
   {
    case SC_SCREENSAVE:     // Screensaver Trying To Start?
    case SC_MONITORPOWER:    // Monitor Trying To Enter Powersave?
    return 0;       // Prevent From Happening
   }
   break;         // Exit
  }

  case WM_CLOSE:        // Did We Receive A Close Message?
  {
   PostQuitMessage(0);      // Send A Quit Message
   return 0;        // Jump Back
  }

  case WM_KEYDOWN:       // Is A Key Being Held Down?
  {
   keys[wParam] = TRUE;     // If So, Mark It As TRUE
   return 0;        // Jump Back
  }

  case WM_KEYUP:        // Has A Key Been Released?
  {
   keys[wParam] = FALSE;     // If So, Mark It As FALSE
   return 0;        // Jump Back
  }

  case WM_LBUTTONDOWN:
  {
   int xPos,yPos;
   xPos = LOWORD(lParam);
   yPos = HIWORD(lParam);
   LastXPos = xPos;
   LastYPos = yPos;
   IsLBDown = TRUE;
   return 0;
  }

  case WM_MOUSEMOVE:
  {
   if(IsLBDown)
   {
    int xPos,yPos;
    xPos = LOWORD(lParam);
    yPos = HIWORD(lParam);

    xrot += GLfloat(yPos - LastYPos) / GLfloat(5.0);
    yrot += GLfloat(xPos - LastXPos) / GLfloat(5.0);
    
    LastXPos = xPos;
    LastYPos = yPos;    
   }
   return 0;
  }

  case WM_LBUTTONUP:
  {
   IsLBDown = FALSE;
   return 0;
  }


  case WM_SIZE:        // Resize The OpenGL Window
  {
   ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));  // LoWord=Width, HiWord=Height
   return 0;        // Jump Back
  }
 }

 // Pass All Unhandled Messages To DefWindowProc
 return DefWindowProc(hWnd,uMsg,wParam,lParam);
}

int WINAPI WinMain( HINSTANCE hInstance,   // Instance
     HINSTANCE hPrevInstance,  // Previous Instance
     LPSTR  lpCmdLine,   // Command Line Parameters
     int   nCmdShow)   // Window Show State
{
 MSG  msg;         // Windows Message Structure
 BOOL dOne=FALSE;        // Bool Variable To Exit Loop

 // Ask The User Which Screen Mode They Prefer
/* if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO)
 {
  fullscreen=FALSE;       // Windowed Mode
 }
*/

 fullscreen = FALSE;

 // Create Our OpenGL Window
 if (!CreateGLWindow("OpenGL Cube Sample",640,480,16,fullscreen))
 {
  return 0;         // Quit If Window Was Not Created
 }

 while(!done)         // Loop That Runs While dOne=FALSE
 {
  if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting?
  {
   if (msg.message==WM_QUIT)    // Have We Received A Quit Message?
   {
    dOne=TRUE;       // If So dOne=TRUE
   }
   else         // If Not, Deal With Window Messages
   {
    TranslateMessage(&msg);    // Translate The Message
    DispatchMessage(&msg);    // Dispatch The Message
   }
  }
  else          // If There Are No Messages
  {
   // Draw The Scene.  Watch For ESC Key And Quit Messages From DrawGLScene()
   if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) // Active?  Was There A Quit Received?
   {
    dOne=TRUE;       // ESC or DrawGLScene Signalled A Quit
   }
   else         // Not Time To Quit, Update Screen
   {
    SwapBuffers(hDC);     // Swap Buffers (Double Buffering)
    if (keys[VK_F1])      // Is F1 Being Pressed?
    {
     keys[VK_F1]=FALSE;     // If So Make Key FALSE
     KillGLWindow();      // Kill Our Current Window
     fullscreen=!fullscreen;    // Toggle Fullscreen / Windowed Mode
     // Recreate Our OpenGL Window
     if (!CreateGLWindow("OpenGL Cube Sample",640,480,16,fullscreen))
     {
      return 0;      // Quit If Window Was Not Created
     }
    }
   }
  }
 }

 // Shutdown
 KillGLWindow();         // Kill The Window
 return (msg.wParam);       // Exit The Program
}


推荐阅读
  • PBO(PixelBufferObject),将像素数据存储在显存中。优点:1、快速的像素数据传递,它采用了一种叫DMA(DirectM ... [详细]
  • 本文介绍了如何在 MapReduce 作业中使用 SequenceFileOutputFormat 生成 SequenceFile 文件,并详细解释了 SequenceFile 的结构和用途。 ... [详细]
  • 本文介绍了如何使用 Gesture Detector 和 overridePendingTransition 方法来实现滑动界面和过渡动画。 ... [详细]
  • DirectShow Filter 开发指南
    本文总结了 DirectShow Filter 的开发经验,重点介绍了 Source Filter、In-Place Transform Filter 和 Render Filter 的实现方法。通过使用 DirectShow 提供的类,可以简化 Filter 的开发过程。 ... [详细]
  • 本文通过基准测试(Benchmark)对.NET Core环境下Thrift和HTTP客户端的微服务通信性能进行对比分析。基准测试是一种评估系统或组件性能的方法,通过运行一系列标准化的测试来衡量其表现。 ... [详细]
  • WPF项目学习.一
    WPF项目搭建版权声明:本文为博主初学经验,未经博主允许不得转载。一、前言记录在学习与制作WPF过程中遇到的解决方案。使用MVVM的优点是数据和视图分离,双向绑定,低耦合,可重用行 ... [详细]
  • 本文介绍了如何使用Python爬取妙笔阁小说网仙侠系列中所有小说的信息,并将其保存为TXT和CSV格式。主要内容包括如何构造请求头以避免被网站封禁,以及如何利用XPath解析HTML并提取所需信息。 ... [详细]
  • 自然语言处理(NLP)——LDA模型:对电商购物评论进行情感分析
    目录一、2020数学建模美赛C题简介需求评价内容提供数据二、解题思路三、LDA简介四、代码实现1.数据预处理1.1剔除无用信息1.1.1剔除掉不需要的列1.1.2找出无效评论并剔除 ... [详细]
  • 2020年9月15日,Oracle正式发布了最新的JDK 15版本。本次更新带来了许多新特性,包括隐藏类、EdDSA签名算法、模式匹配、记录类、封闭类和文本块等。 ... [详细]
  • 我有一个从C项目编译的.o文件,该文件引用了名为init_static_pool ... [详细]
  • 如果应用程序经常播放密集、急促而又短暂的音效(如游戏音效)那么使用MediaPlayer显得有些不太适合了。因为MediaPlayer存在如下缺点:1)延时时间较长,且资源占用率高 ... [详细]
  • 基于iSCSI的SQL Server 2012群集测试(一)SQL群集安装
    一、测试需求介绍与准备公司计划服务器迁移过程计划同时上线SQLServer2012,引入SQLServer2012群集提高高可用性,需要对SQLServ ... [详细]
  • VB.net 进程通信中FindWindow、FindWindowEX、SendMessage函数的理解
    目录一、代码背景二、主要工具三、函数解析1、FindWindow:2、FindWindowEx:3、SendMessage: ... [详细]
  • WinMain 函数详解及示例
    本文详细介绍了 WinMain 函数的参数及其用途,并提供了一个具体的示例代码来解析 WinMain 函数的实现。 ... [详细]
  • 本文详细介绍了 Pentaho Kettle 中 RowMetaInterface.writeMeta 方法的使用,并提供了多个代码示例,帮助开发者更好地理解和应用该方法。 ... [详细]
author-avatar
初学
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有