1.cpp

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

CPP
47
字号
#include<windows.h>
#include<gl.h>
#include<glut.h>


//float a,b,c;

void myInit(void)
	{
		glClearColor(1.0,1.0,1.0,1.0);
		glPointSize(4.0);
		gluOrtho2D(0.0,640.0,0.0,480.0);
	}


void myDisplay()
	{
		glClear(GL_COLOR_BUFFER_BIT);
		glBegin(GL_POINTS);
		int i,j;
		int rand();
		for(i=0;i<640;i++)
		{
			
			for(j=0;j<480;j++)
			{
			glColor3f(rand()%5,rand()%5,rand()%5);
			glVertex2i(rand(i),rand(j));
			}
		}
		glEnd();
		glFlush();
	}


void main(int argC, char **argV)
	{
		glutInit(&argC, argV);
		glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
		glutInitWindowSize(640,480);
		glutInitWindowPosition(100,50);
		glutCreateWindow("pixels");
		glutDisplayFunc(myDisplay);
		myInit();
		glutMainLoop();
	}

⌨️ 快捷键说明

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