资源简介
open gl图形编程案例,是最为经典的学习资料,适合入门
代码片段和文件信息
/*
* 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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-10-17 21:42 Lesson01\
目录 0 2013-10-17 21:41 Lesson01\Debug\
文件 608 2013-10-17 21:41 Lesson01\Debug\cl.command.1.tlog
文件 13304 2013-10-17 21:41 Lesson01\Debug\CL.read.1.tlog
文件 136 2013-10-17 21:41 Lesson01\Debug\CL.write.1.tlog
文件 200779 2011-10-31 20:39 Lesson01\Debug\lesson1.exe
文件 236140 2011-10-31 20:39 Lesson01\Debug\lesson1.ilk
文件 55 2013-10-17 21:41 Lesson01\Debug\Lesson1.lastbuildstate
文件 932 2013-10-17 21:41 Lesson01\Debug\Lesson1.log
文件 0 2013-10-17 21:41 Lesson01\Debug\Lesson1.unsuccessfulbuild
文件 713 2013-10-17 21:41 Lesson01\Debug\Lesson1.vcxprojResolveAssemblyReference.cache
文件 0 2013-10-17 21:41 Lesson01\Debug\Lesson1.write.1.tlog
文件 216064 2013-10-17 21:41 Lesson01\Debug\vc100.idb
文件 53248 2013-10-17 21:41 Lesson01\Debug\vc100.pdb
文件 132096 2011-10-31 20:39 Lesson01\Debug\vc60.idb
文件 77824 2011-10-31 20:39 Lesson01\Debug\vc60.pdb
目录 0 2013-10-17 21:41 Lesson01\ipch\
目录 0 2013-10-17 21:41 Lesson01\ipch\lesson1-614b0551\
文件 15241 2000-10-08 17:04 Lesson01\Lesson1.cpp
文件 4056 2000-12-24 04:06 Lesson01\Lesson1.dsp
文件 539 1999-09-29 22:50 Lesson01\Lesson1.dsw
文件 32768 2000-10-08 17:04 Lesson01\Lesson1.exe
文件 41984 2012-03-28 23:20 Lesson01\Lesson1.ncb
文件 48640 2012-03-28 23:20 Lesson01\Lesson1.opt
文件 1199 2011-10-31 20:39 Lesson01\lesson1.plg
文件 24137728 2013-10-17 21:42 Lesson01\Lesson1.sdf
文件 2560 2013-10-17 21:42 Lesson01\Lesson1.suo
文件 6698 2013-10-17 21:41 Lesson01\Lesson1.vcxproj
文件 903 2013-10-17 21:41 Lesson01\Lesson1.vcxproj.filters
文件 143 2013-10-17 21:41 Lesson01\Lesson1.vcxproj.user
文件 766 2003-09-22 22:44 Lesson01\NeHe‘s Readme.txt
............此处省略0个文件信息
- 上一篇:c编写的旅游管理信息系统
- 下一篇:网口相机连接Demo
相关资源
- 703N Openwrt固件 UVC免驱摄像头WIFI智能小
- 异常行为检测
- qt+opencv视频图像采集与基于tcp协议的
- Qt下 用OpenGL 实现的模拟太阳系
- how google works
- opengl实现的太阳系
- opencv2.4.3和4.0函数手册带目录可搜索
- OpenGL 4 Shading Language Cookbook - Second Ed
- OpenGL从盒子飞出的气球
- opengl3D路灯
- 红帽云RHCA OpenShift DO280-OCP3.9-全程随堂
- openssh.rar
- 遗留物检测
- 反向运动学演示程序含核心代码
- QtOpenGL以及Graphics-View框架整合的演示
- 基于Qt和GLSL的着色器演示程序+源代码
- 笔记本OpenCV调用摄像头进行人脸捕捉
- VS+OPENCV手势识别
- Google零信任安全架构.rar
- opencv下haarclassifiercascade加上LBPHFaceRe
- Indy10.6和OpenSSL解决D7下GET&POST;乱码
- 841n v7 ar7241+9287 openwrt固件明月永在版
- 图片动漫风格化
- 自动化运维-openssh7.9一键升级(redha
- 卫星航拍图像
- OpenGL 4.0 Shading Language Cookbook
- 基于SVM与ANN的车牌识别
- OpenCV实现同一窗口显示多幅图片
- haar特征的手势检测OpenCV
- 基于opencv的人脸表情识别的预处理
评论
共有 条评论