1.c
来自「a source code for banker s algorithm」· C语言 代码 · 共 49 行
C
49 行
#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()
{
int i,j;
int rand();
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
for(i=0;i<640;i++)
{
for(j=0;j<480;j++)
{
glColor3f(rand()%2,rand()%2,rand()%2);
glVertex2i(rand(),rand());
}
}
glEnd();
glFlush();
}
void main()
{
//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 + -
显示快捷键?