-
大小: 9.13MB文件类型: .rar金币: 1下载: 0 次发布日期: 2023-11-03
- 语言: 其他
- 标签:
资源简介
NeHe opengl教程48课全(中文pdf,英文pdf,源码)
代码片段和文件信息
/*
* This Code Was Created By Jeff Molofee 2000
* A HUGE Thanks To Fredric Echols For Cleaning Up
* And Optimizing This Code Making It More Flexible!
* If You‘ve Found This Code Useful Please Let Me Know.
* Visit My Site At nehe.gamedev.net
*/
#include // Header File For Windows
#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
LRESULT CALLBACK WndProc(HWND UINT WPARAM LPARAM); // Declaration For WndProc
GLvoid ReSizeGLScene(GLsizei width GLsizei height) // Resize And Initialize The GL Window
{
if (height==0) // Prevent A Divide By Zero By
{
height=1; // Making Height Equal One
}
glViewport(00widthheight); // Reset The Current Viewport
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix
// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f(GLfloat)width/(GLfloat)height0.1f100.0f);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix
}
int InitGL(GLvoid) // All Setup For OpenGL Goes Here
{
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
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 Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix
return TRUE; // Everything Went OK
}
GLvoid KillGLWindow(GLvoid) // Properly Kill The Window
{
if (fullscreen) // Are We In Fullscreen Mode?
{
ChangeDisplaySettings(NULL0); // If So Switch Back To The Desktop
ShowCursor(TRUE); // Show Mouse Pointer
}
if (hRC) // Do We Have A Rendering Context?
{
if (!wglMakeCurrent(NULLNULL)) // 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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 15241 2000-10-08 17:04 OpenGL教程_NeHe_源代码_1-48\Lesson01\Lesson1.cpp
文件 4056 2000-12-24 04:06 OpenGL教程_NeHe_源代码_1-48\Lesson01\Lesson1.dsp
文件 539 1999-09-29 22:50 OpenGL教程_NeHe_源代码_1-48\Lesson01\Lesson1.dsw
文件 32768 2000-10-08 17:04 OpenGL教程_NeHe_源代码_1-48\Lesson01\Lesson1.exe
文件 766 2003-09-22 22:44 OpenGL教程_NeHe_源代码_1-48\Lesson01\NeHe‘s Readme.txt
文件 15729 2000-12-24 04:10 OpenGL教程_NeHe_源代码_1-48\Lesson02\Lesson2.cpp
文件 4056 2000-01-30 21:37 OpenGL教程_NeHe_源代码_1-48\Lesson02\Lesson2.dsp
文件 539 1999-10-02 21:48 OpenGL教程_NeHe_源代码_1-48\Lesson02\Lesson2.dsw
文件 32768 2000-12-24 04:12 OpenGL教程_NeHe_源代码_1-48\Lesson02\Lesson2.exe
文件 771 2003-09-22 22:43 OpenGL教程_NeHe_源代码_1-48\Lesson02\NeHe‘s Readme.txt
文件 16154 2000-05-06 21:20 OpenGL教程_NeHe_源代码_1-48\Lesson03\Lesson3.cpp
文件 4056 2000-01-30 21:35 OpenGL教程_NeHe_源代码_1-48\Lesson03\Lesson3.dsp
文件 539 1999-10-03 07:31 OpenGL教程_NeHe_源代码_1-48\Lesson03\Lesson3.dsw
文件 32768 2000-05-06 21:21 OpenGL教程_NeHe_源代码_1-48\Lesson03\Lesson3.exe
文件 765 2003-09-22 22:45 OpenGL教程_NeHe_源代码_1-48\Lesson03\NeHe‘s Readme.txt
文件 16775 2000-05-06 21:23 OpenGL教程_NeHe_源代码_1-48\Lesson04\Lesson4.cpp
文件 4056 2000-01-30 21:40 OpenGL教程_NeHe_源代码_1-48\Lesson04\Lesson4.dsp
文件 539 1999-10-08 19:23 OpenGL教程_NeHe_源代码_1-48\Lesson04\Lesson4.dsw
文件 32768 2000-05-06 21:22 OpenGL教程_NeHe_源代码_1-48\Lesson04\Lesson4.exe
文件 763 2003-09-22 22:47 OpenGL教程_NeHe_源代码_1-48\Lesson04\NeHe‘s Readme.txt
文件 19673 2003-05-01 19:19 OpenGL教程_NeHe_源代码_1-48\Lesson05\Lesson5.cpp
文件 4056 2000-01-30 22:44 OpenGL教程_NeHe_源代码_1-48\Lesson05\Lesson5.dsp
文件 539 1999-10-16 22:50 OpenGL教程_NeHe_源代码_1-48\Lesson05\Lesson5.dsw
文件 32768 2000-05-06 22:24 OpenGL教程_NeHe_源代码_1-48\Lesson05\Lesson5.exe
文件 760 2003-09-22 22:48 OpenGL教程_NeHe_源代码_1-48\Lesson05\NeHe‘s Readme.txt
文件 196664 2000-03-06 02:10 OpenGL教程_NeHe_源代码_1-48\Lesson06\Data\NeHe.bmp
..A.SH. 6144 2009-03-24 15:22 OpenGL教程_NeHe_源代码_1-48\Lesson06\Data\Thumbs.db
文件 19275 2000-05-06 21:27 OpenGL教程_NeHe_源代码_1-48\Lesson06\Lesson6.cpp
文件 4056 2000-01-31 00:48 OpenGL教程_NeHe_源代码_1-48\Lesson06\Lesson6.dsp
文件 539 1999-10-22 01:30 OpenGL教程_NeHe_源代码_1-48\Lesson06\Lesson6.dsw
............此处省略534个文件信息
评论
共有 条评论