• 大小: 743KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-14
  • 语言: 其他
  • 标签: openGL  兔子  

资源简介

用openGL编制的兔子模型,本模型通过兔子的便面点的构建,生成三维的兔子模型,并可用鼠标对其进行旋转移动等操作

资源截图

代码片段和文件信息

//-----------------------------------------------------------------------------
//           Name: ogl_stanford_bunny.cpp
//         Author: Kevin Harris (kevin@codesampler.com)
//  Last Modified: 02/01/05
//    Description: This sample demonstrates how to make use of the useful 
//                 Stanford Bunny model or data set for testing and prototyping 
//                 purposes.
//
//   Control Keys: Left Mouse Button - Spin the view
//                 Up Arrow - Move the bunny model away
//                 Down Arrow - Move the bunny model away
//-----------------------------------------------------------------------------

#define STRICT
#define WIN32_LEAN_AND_MEAN

#include 
#include 
#include 
#include 
#include “resource.h“

//-----------------------------------------------------------------------------
// GLOBALS
//-----------------------------------------------------------------------------
HWND   g_hWnd = NULL;
HDC    g_hDC  = NULL;
HGLRC  g_hRC  = NULL;

GLuint g_stanfordBunnyDL = -1;

bool g_bRenderInWireframe = false;

float g_fDistance = -2.0f;
float g_fSpinX    =  0.0f;
float g_fSpinY    =  0.0f;

//-----------------------------------------------------------------------------
// PROTOTYPES
//-----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstanceHINSTANCE hPrevInstance 
   LPSTR lpCmdLine int nCmdShow);
LRESULT CALLBACK WindowProc(HWND g_hWnd UINT msg WPARAM wParam LPARAM lParam);
void init(void);
void render(void);
void shutDown(void);

extern GLint Gen3DobjectList();

//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: The application‘s entry point
//-----------------------------------------------------------------------------
int WINAPI WinMain( HINSTANCE hInstance
   HINSTANCE hPrevInstance
   LPSTR     lpCmdLine
   int       nCmdShow )
{
WNDCLASSEX winClass; 
MSG        uMsg;

memset(&uMsg0sizeof(uMsg));

winClass.lpszClassName = “MY_WINDOWS_CLASS“;
winClass.cbSize        = sizeof(WNDCLASSEX);
winClass.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
winClass.lpfnWndProc   = WindowProc;
winClass.hInstance     = hInstance;
winClass.hIcon        = LoadIcon(hInstance (LPCTSTR)IDI_OPENGL_ICON);
winClass.hIconSm    = LoadIcon(hInstance (LPCTSTR)IDI_OPENGL_ICON);
winClass.hCursor       = LoadCursor(NULL IDC_ARROW);
winClass.hbrBackground = (HBRUSH)GetStockobject(BLACK_BRUSH);
winClass.lpszMenuName  = NULL;
winClass.cbClsExtra    = 0;
winClass.cbWndExtra    = 0;

if( !RegisterClassEx(&winClass) )
return E_FAIL;

g_hWnd = CreateWindowEx( NULL “MY_WINDOWS_CLASS“ 
                    “OpenGL - Stanford Bunny Data Set“
                    WS_OVERLAPPEDWINDOW | WS_VISIBLE
                    0 0 640 480 NULL NULL hInstance NULL );

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

     文件       7406  2003-10-07 08:50  ogl_stanford_bunny兔子\codesampler.ico

     文件       8071  2005-02-01 15:24  ogl_stanford_bunny兔子\ogl_stanford_bunny.cpp

     文件       4445  2004-01-12 13:53  ogl_stanford_bunny兔子\ogl_stanford_bunny.dsp

     文件        561  2005-05-31 10:30  ogl_stanford_bunny兔子\ogl_stanford_bunny.dsw

     文件     442368  2005-02-03 15:45  ogl_stanford_bunny兔子\ogl_stanford_bunny.exe

     文件      41984  2005-05-31 10:33  ogl_stanford_bunny兔子\ogl_stanford_bunny.ncb

     文件      53760  2005-05-31 10:33  ogl_stanford_bunny兔子\ogl_stanford_bunny.opt

     文件       1647  2005-05-31 10:30  ogl_stanford_bunny兔子\ogl_stanford_bunny.plg

     文件       3058  2003-10-07 09:46  ogl_stanford_bunny兔子\ogl_stanford_bunny.rc

     文件       4981  2005-01-28 00:06  ogl_stanford_bunny兔子\ogl_stanford_bunny.vcproj

     文件       1000  2002-05-02 21:30  ogl_stanford_bunny兔子\resource.h

     文件    1136015  2003-08-19 12:40  ogl_stanford_bunny兔子\stanford_bunny.cpp

     目录          0  2005-06-10 17:08  ogl_stanford_bunny兔子

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

              1705514                    14


评论

共有 条评论