双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

这个程序我怎么不循环啊

haiyanhuman haiyanhuman 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include <stdio.h>
#include <time.h>
#include <windows.h>
#include <gl/glut.h>


void pixel(int x, int y, int size, GLubyte Red, GLubyte Green, GLubyte Blue)
{
glPointSize(size);

glBegin(GL_POINTS);
glColor3ub(Red, Green, Blue);
glVertex2f(x, y);
glEnd();

glFlush();
}

void drawing()
{
int base,x,y;
srand((unsigned)time(NULL));
base=rand()%255+1;
srand((unsigned)time(NULL));
x=rand()%255+1;
srand((unsigned)time(NULL));
y=rand()%255+1;
for(int i=0;i<20000;i++)//这里为什么不循环啊!!郁闷
{

pixel(x, y, i%4, base, base+50, base+20);
}
}

void init_display()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
void display()
{
init_display();

drawing();
}

void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei)w, (GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, (GLdouble)w, 0.0, (GLdouble)h);
}

int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_SINGLE);
glutInitWindowSize(800, 600);
glutInitWindowPosition(0, 0);
glutCreateWindow("Point");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
display();
glutMainLoop();






return 0;
}

...全文
评论 5
收藏 已收藏
分享
返回顶部
haiyanhuman
C语言 70,039 成员 243,237 内容