资源简介
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
相关资源
- CANopen使用手册_埃斯顿
- OpenGL参考手册
- The direction of synaptic plasticity mediated
- 引力波是玻色-爱因斯坦凝聚物暗物质
- 用foobar2000听google音乐[更新一下]
- Google Earth KML文件生成工具
- google earth 高程点坐标提取软件
- Qt Creator opengl实现四元数鼠标控制轨迹
- 使用OpenFileDialog打开文件对话框.rar
- Openssl给文件传输加密
- OpenGL文档,api大全,可直接查询函数
- opengl轮廓字体源代码
- MFC读三维模型obj文件
- 基于OpenCV的数字识别468815
- 使用opencv去掉二值化图像中黑色面积
- openssl 简介(中文)
- 利用OpenGL写毛笔字算法
- MFC中OpenGL面和体的绘制以及动画效果
- 基于OPENGL的光线跟踪源代码368758
- VC 实现三维旋转(源码)
- 自编用openGL实现3D分形树,分形山
- OpenGL球形贴图自旋程序
- OpenGL导入贴图的Texture类
- Douglas-Peucker 曲线离散化算法.rar
- 计算机图形学(openGL)代码
- 用OpenGL开发的机械臂运动仿真程序(
- OpenGL-3D坦克模拟
- opencv环境配置
- 探索LHC耦合中的CP振动效应
- 复合共振的行为打破了轻质风味的普
评论
共有 条评论