|
Post by PeterMaria on Dec 14, 2015 9:18:41 GMT -5
Hi,
glMatrixMode (GL_PROJECTION) glLoadIdentity() glOrtho(0,640,480,0,-1,1) glMatrixMode (GL_MODELVIEW) glDisable(GL_DEPTH_TEST) glEnable(GL_POINT_SMOOTH) declare Sub Circle(x#,y#,r1#) declare Sub FillCircle(x#,y#,r1#)
struc STARS x, y end struc
dim STARS s(200) dim r#, w#, x, y, i
for i=0 to 199 s(i).x = rnd()% 640 s(i).y = rnd()% 480 next while scankeydown(27)=0 glClearColor(0,0,0,1) glClear(GL_COLOR_BUFFER_BIT) for i=0 to 199 glColor3ub(i+55,i+55,i+55) fillcircle(s(i).x,s(i).y,2) next for i=1 to 180 x = cos(r#*i-r#)*i y = sin(r#*i+r#)*i glcolor3ub(255,255,255) fillcircle(x+300,y+220,8) glcolor3ub(255,i,i) circle(x+300,y+220,8) next
r# = r#+0.01 if r# >=4 then r#=-r#: end if swapbuffers() sleep(10) wend end Sub Circle(x#,y#,r1#) dim r#=r1#/2, i# glPointSize(1.0) glBegin(GL_POINTS) For i#=0 to 360 glVertex2f(x#+sin(i#)*r#, y#+cos(i#)*r#) Next glEnd() End Sub
Sub FillCircle(x#,y#,r1#) dim r#=r1#/2, t# glBegin(GL_TRIANGLE_FAN) glVertex2f(x#, y#) For t#=0 to 360 step 5 glVertex2f(x#+sin(t#)*r#, y#+cos(t#)*r#) Next glEnd() End Sub
|
|
|
Post by matthew on Dec 15, 2015 18:54:42 GMT -5
Nice, Peter. :-)
|
|