maxpixel.cpp

来自「a source code for banker s algorithm」· C++ 代码 · 共 39 行

CPP
39
字号
#include<windows.h>
#include<gl.h>
#include<glut.h>
void myInit()
{
 glClearColor(1.0,1.0,1.0,1.0);
 glColor3f(0.0f,0.0f,0.0f);
 glPointSize(3.0);
 gluOrtho2D(0.0,640.0,0.0,480.0);
}
void display()
{
 glClear(GL_COLOR_BUFFER_BIT);
 int read();
 glBegin(GL_POINTS);
    for(int i=0;i<=640;i=i+11) 
	{
		for(int j=0;j<=480;j=j+11)
		{glColor3f(j%10,j%5,j%6);
			
			glVertex2i(i,j);
		}

	}
 glEnd();
 glFlush();
}
void main(int argc,char **argv)
{
 glutInit(&argc,argv);
 glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
 glutInitWindowSize(500,500);
 glutInitWindowPosition(100,50);
 glutCreateWindow("random pixel program");
 glutDisplayFunc(display);
 myInit();
 glutMainLoop();
}
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?