资源简介
OPENGL 画地球-纹理贴图 光照 动画
VS2005工程,需要gl glu glut glaux支持。
有任何问题可留言。

代码片段和文件信息
/************************************************************
Copyright (C) 2008-2010 Jbctech. Co. Ltd.
FileName: test.cpp
Author:Jacob Chen
Description: 旋转地球
Version: V1.0
History: NONE
Date: 2009.8.31
***********************************************************/
# include
#include
#include
#include
# include
GLuint texture[1];
GLUquadricObj *q;
AUX_RGBImageRec *TextureImage[1];
GLfloat xrot=0.1; // Angle For The Triangle
/*************************************************
Function: LoadBMP
Description: load a BMP picture from the disk
Input: Filename is the path of the file
Return: return a point to the Bitmap picture if success
return NUll while faile to open the file.
Others: none
*************************************************/
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
}
/*************************************************
Function: init
Description: init material light and texture.then enable the
Input: none
Return: none
Others: none
*************************************************/
void init ( void )
{
GLfloat mat_specular [ ] = { 1.0 1.0 1.0 1.0 };
GLfloat mat_diffuse [ ] = { 0.0 2.0 2.0 0.1};
GLfloat mat_shininess [ ] = { 100.0 };
// Light Parameters
GLfloat LightAmb[] = {0.3f 0.3f 0.3f 1.0f}; // Ambient Light
GLfloat LightDif[] = {1.0f 1.0f 1.0f 1.0f}; // Diffuse Light
GLfloat light0_position [ ] = { 2.0 0.1 0.0 0.0 };
GLfloat light1_position [ ] = { 2.0 0.1 0.0 0.0 };
GLfloat light2_position [ ] = { 10.0 0.0 0.0 0.0 };
glClearColor ( 0.0 0.0 0.0 1.0 );
glShadeModel ( GL_SMOOTH );
glLightfv ( GL_LIGHT1 GL_AMBIENT LightAmb); // Set The Ambient Lighting For Light0
glLightfv ( GL_LIGHT1 GL_DIFFUSE LightDif); // Set The Diffuse Lighting For Light0
glLightfv ( GL_LIGHT0 GL_POSITION light0_position);
glLightfv ( GL_LIGHT1 GL_POSITION light1_position);
/*******************use the quadratic to creat the object**************************************/
q = gluNewQuadric(); // Create A New Quadratic
gluQuadricNormals(q GL_SMOOTH); // Generate Smooth Normals For The Quad
gluQuadricTexture(q GL_TRUE); // Enable Texture Coor
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2009-09-24 13:17 debug\
文件 69632 2009-09-24 13:22 debug\Rolling-earth.exe
文件 649420 2009-09-24 13:22 debug\Rolling-earth.ilk
文件 527360 2009-09-24 13:22 debug\Rolling-earth.pdb
目录 0 2009-09-24 13:21 Rolling-earth\
文件 7834624 2009-09-24 13:22 Rolling-earth.ncb
文件 904 2009-09-24 11:57 Rolling-earth.sln
目录 0 2009-09-24 12:00 Rolling-earth\Data\
文件 19110 2009-08-26 16:38 Rolling-earth\Data\1.jpg
文件 49206 2000-04-27 21:51 Rolling-earth\Data\Ball.bmp
文件 196662 2000-05-18 02:04 Rolling-earth\Data\Envroll.bmp
文件 49206 2000-05-18 02:04 Rolling-earth\Data\Envwall.bmp
文件 3145784 2009-08-26 17:18 Rolling-earth\Data\jbBall.bmp
文件 196664 2009-08-28 15:17 Rolling-earth\Data\jbBall1.bmp
文件 786488 2009-08-26 17:13 Rolling-earth\Data\jbball2.bmp
文件 31232 2009-08-31 09:07 Rolling-earth\Data\Thumbs.db
目录 0 2009-09-24 13:22 Rolling-earth\Debug\
文件 7936 2009-09-24 13:22 Rolling-earth\Debug\BuildLog.htm
文件 67 2009-09-24 13:22 Rolling-earth\Debug\mt.dep
文件 403 2009-09-24 13:17 Rolling-earth\Debug\Rolling-earth.exe.em
文件 468 2009-09-24 13:17 Rolling-earth\Debug\Rolling-earth.exe.em
文件 385 2009-09-24 13:22 Rolling-earth\Debug\Rolling-earth.exe.intermediate.manifest
文件 34334 2009-09-24 13:22 Rolling-earth\Debug\Rolling-earth.obj
文件 306176 2009-09-24 13:22 Rolling-earth\Debug\vc80.idb
文件 94208 2009-09-24 13:22 Rolling-earth\Debug\vc80.pdb
文件 986 2009-09-24 11:57 Rolling-earth\ReadMe.txt
文件 7939 2009-09-24 13:21 Rolling-earth\Rolling-earth.cpp
文件 4081 2009-09-24 13:16 Rolling-earth\Rolling-earth.vcproj
文件 1407 2009-09-24 13:22 Rolling-earth\Rolling-earth.vcproj.CC_PC.Administrator.user
相关资源
- OpenGL参考手册
- Qt Creator opengl实现四元数鼠标控制轨迹
- OpenGL文档,api大全,可直接查询函数
- opengl轮廓字体源代码
- MFC读三维模型obj文件
- 利用OpenGL写毛笔字算法
- MFC中OpenGL面和体的绘制以及动画效果
- 基于OPENGL的光线跟踪源代码368758
- VC 实现三维旋转(源码)
- 自编用openGL实现3D分形树,分形山
- OpenGL球形贴图自旋程序
- OpenGL导入贴图的Texture类
- 计算机图形学(openGL)代码
- 用OpenGL开发的机械臂运动仿真程序(
- OpenGL-3D坦克模拟
- OPENGL实现世界上最小的3D游戏
- VS2012OpenGL配置所需要的全部libdllh文件
- 基于OpenGL的仿蝗虫机器人三维动态仿
- 图形学 - OpenGL实现3种三维茶壶显示源
- opengl程序-会跳舞的骷髅
- opengl实现三维网格光顺Laplacian算法
- opengl——爆炸
- OpenGL三维地形建模
- opengl游戏编程徐明亮版(含源码)
- 用OPENGL画的一个简单的直升飞机
- opengl完美天空盒
- 3D绘图程序设计:使用Direct3D 10/9和Ope
- OpenGL绘制可运动自行车源程序.zip
- OpenGL实现飘动效果
- opengl室内场景的绘制,包括碰撞检测
评论
共有 条评论