全文预览

(参考)opengl实验报告

上传者:幸福人生 |  格式:doc  |  页数:17 |  大小:163KB

文档介绍
Keys); glutDisplayFunc(RenderScene); void ChangeSize(int w, int h) { #include <GL/gl.h> #include <GL/glut.h> #include <stdio.h> void myinit(void); void display(void); GLubyte rasters[12] = {0xff,0xff,0xc0,0xc0,0xc0,0xfc,0xfc,0xc 0,0xc0,0xc0,0xff,0xff}; void init(void) // 初始化{ glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glClearColor(0.0,0.0,0.0,0.0); // 将窗口清为黑色} void display(void) { glClear(GL_COLOR_BUFFER_BIT); //将颜色缓存清为 glClearColor 命令所设置的颜色,即背景色 glColor3f (1.0, 0.0, 1.0); glRasterPos2i (0.5,0.8); glBitmap (8,12,0.0,0.0,20.0,20.0,rasters); glBitmap (8,12,0.0,40.0,10.0,0.0,rasters); glFlush(); // 强制绘图,不驻留缓存} void main(int argc,char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE|GLU T_RGB); glutInitWindowPosition(50,100); glutInitWindowSize(300,400); glutCreateWindow("the first

收藏

分享

举报
下载此文档