青少年空军招飞定选拔:[code]3D空间中移动图像
来源:百度文库 编辑:九乡新闻网 时间:2024/04/25 05:40:31
#define _CRT_SECURE_NO_WARNINGS#pragma comment (lib,"glaux.lib") #include #include #include #include #include #include #include #include #define WIDTH 500#define HEIGHT 500
GLfloat rtri; // Angle For The Triangle ( NEW )GLfloat rquad; // Angle For The Quad ( NEW )
#define num 50 // Number Of Stars To Draw
typedef struct // Create A Structure For Star{ int r, g, b; // Stars Color GLfloat dist, // Stars Distance From Center angle; // Stars Current Angle}stars;
stars star[num]; // Need To Keep Track Of 'num' Stars
GLfloat zoom=-15.0f; // Distance Away From StarsGLfloat tilt=0.0f; // Tilt The ViewGLfloat spin; // Spin Stars
GLuint loop; // General Loop VariableGLuint texture[1]; // Storage for 1 textures
// Load Bitmap And Convert To A TextureGLvoid LoadGLTextures(){ // Load Texture AUX_RGBImageRec *texture1;
texture1 = auxDIBImageLoad(TEXT("Data/star.bmp")); if (!texture1) { exit(1); }
glGenTextures(1, &texture[0]); // Generate 1 Texture
// Create Linear Filtered Texture glBindTexture(GL_TEXTURE_2D, texture[0]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, 3, texture1->sizeX, texture1->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, texture1->data);};
int InitGL() // All Setup For OpenGL Goes Here{ LoadGLTextures(); // Load The Texture(s) glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // This Will Clear The Background Color To Black glClearDepth(1.0); // Enables Clearing Of The Depth Buffer glShadeModel(GL_SMOOTH); // Enables Smooth Color Shading
glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Reset The Projection Matrix
gluPerspective(45.0f,1.0,0.1f,100.0f); // Calculate The Aspect Ratio Of The Window
glMatrixMode(GL_MODELVIEW); glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Set The Blending Function For Translucency glEnable(GL_BLEND);
for (loop=0; loop return 1;}
void myReshape(int w, int h){ printf("---------myReshape\n"); glViewport(0,0,w,h); // 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)w/(GLfloat)h,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity();}
void myDisplay(void){ printf("---------myDisplay\n"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glBindTexture(GL_TEXTURE_2D, texture[0]);
for (loop=0; loop spin+=0.01f; star[loop].angle+= (float)(loop)/num; star[loop].dist-=0.01f; if (star[loop].dist<0.0f) { star[loop].dist+=5.0f; star[loop].r=rand()%256; star[loop].g=rand()%256; star[loop].b=rand()%256; } }
glFlush();
glutSwapBuffers();}
void myIdle(void){ printf("---------myIdle\n"); myDisplay();}
int main(int argc, char* argv[]){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutInitWindowPosition(200, 200); glutInitWindowSize(WIDTH, HEIGHT); glutCreateWindow("OpenGL光照演示");
InitGL();
glutDisplayFunc(&myDisplay); glutReshapeFunc(&myReshape); glutIdleFunc(&myIdle);
glutMainLoop(); return 0;}
GLfloat rtri; // Angle For The Triangle ( NEW )GLfloat rquad; // Angle For The Quad ( NEW )
#define num 50 // Number Of Stars To Draw
typedef struct // Create A Structure For Star{ int r, g, b; // Stars Color GLfloat dist, // Stars Distance From Center angle; // Stars Current Angle}stars;
stars star[num]; // Need To Keep Track Of 'num' Stars
GLfloat zoom=-15.0f; // Distance Away From StarsGLfloat tilt=0.0f; // Tilt The ViewGLfloat spin; // Spin Stars
GLuint loop; // General Loop VariableGLuint texture[1]; // Storage for 1 textures
// Load Bitmap And Convert To A TextureGLvoid LoadGLTextures(){ // Load Texture AUX_RGBImageRec *texture1;
texture1 = auxDIBImageLoad(TEXT("Data/star.bmp")); if (!texture1) { exit(1); }
glGenTextures(1, &texture[0]); // Generate 1 Texture
// Create Linear Filtered Texture glBindTexture(GL_TEXTURE_2D, texture[0]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, 3, texture1->sizeX, texture1->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, texture1->data);};
int InitGL() // All Setup For OpenGL Goes Here{ LoadGLTextures(); // Load The Texture(s) glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // This Will Clear The Background Color To Black glClearDepth(1.0); // Enables Clearing Of The Depth Buffer glShadeModel(GL_SMOOTH); // Enables Smooth Color Shading
glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Reset The Projection Matrix
gluPerspective(45.0f,1.0,0.1f,100.0f); // Calculate The Aspect Ratio Of The Window
glMatrixMode(GL_MODELVIEW); glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Set The Blending Function For Translucency glEnable(GL_BLEND);
for (loop=0; loop
void myReshape(int w, int h){ printf("---------myReshape\n"); glViewport(0,0,w,h); // 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)w/(GLfloat)h,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity();}
void myDisplay(void){ printf("---------myDisplay\n"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glBindTexture(GL_TEXTURE_2D, texture[0]);
for (loop=0; loop
glFlush();
glutSwapBuffers();}
void myIdle(void){ printf("---------myIdle\n"); myDisplay();}
int main(int argc, char* argv[]){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutInitWindowPosition(200, 200); glutInitWindowSize(WIDTH, HEIGHT); glutCreateWindow("OpenGL光照演示");
InitGL();
glutDisplayFunc(&myDisplay); glutReshapeFunc(&myReshape); glutIdleFunc(&myIdle);
glutMainLoop(); return 0;}
[code]3D空间中移动图像
来回移动的图像
引用水晶3D空间相册代码
中移动财报解读:增长之源在哪里-陈志刚_问己非-搜狐空间
迄今最详细3D宇宙图像公布:覆盖3.8亿光年(图)_
3.8亿光年内迄今最详细3D宇宙图像的解析解
世界首台图像可触摸3D电视在日本问世(图)
灶神星2.1万米高峰3D图像 是珠峰高度三倍
倾心推出-3d变2d轻松中大奖
U5心得教程细解之十二 图像屏幕移动
直选中3D的方法
玩转空间,U5、PS、3D、FLASH教程汇总
some code
利用移动存储设备作为缓存空间
在Photoshop中消除图像中的红眼
在Photoshop中消除图像中的红眼
花草图像馆图集 3
历代帝王图像谱表3
中戏校花李艳冰d
美国摄影师的中国图像-中国美术学院团委-搜狐空间
健美中力量训练方法及动态3D图
《越狱》中真实的D.B.Cooper (3)
彩民合买福彩3D喜中百万元大奖
移动中 / 非移动的上升和下降