📄 1.c
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -