|
Post by PeterMaria on Jun 29, 2015 5:40:14 GMT -5
Hello,
Function Key(ikey) Return ScanKeyDown(ikey) End Function
Sub Gl2D(width,height) glMatrixMode(GL_Projection) glLoadIdentity() glViewport(0,0,width,height) glOrtho(0,width,height,0,-1,1) glMatrixMode(GL_ModelView) glLoadIdentity() End Sub Sub glColor(r,g,b,a) glColor4ub(r,g,b,a) End Sub
Sub glPixel(x,y) glPushMatrix() glLoadIdentity() glPointSize(4) glScalef(4,4,0) glBegin(GL_POINTS) glVertex2i(x,y) glEnd() glPopMatrix() End Sub
Gl2D(800,600) dim r#(256) dim g#(256) dim b#(256) dim re#,c1#,c2#,c3#,f#,x#,y#
for x#=0 to 256 r#(x#) = 255.0 -((sin(3.14 * 2.0 * x# / 255.0) + 1.0) * 127.0) g#(x#) = ((sin(3.14 * 2.0 * x# / 127.0) + 1.0) * 64.0) b#(x#) = 255.0 - r#(x#) next
while key(27)=0 glClearColor(0,0,0,1) glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) for y#=0 to 200 for x#=0 to 200 c1# = sin(x# / 50 + f# + y# / 200) c2# = sqr((sin(0.8*f#)*160-x#+160)*(sin(0.8*f#)*160-x#+160) + (cos(1.2*f#)*100-y#+100)*(cos(1.2*f#)*100-y#+100)) c2# = sin(c2# / 50) c3# = (c1# + c2#) / 2 re# = ((c3# + 1)*127) glcolor(b#(re#),r#(re#),g#(re#),255) glpixel(x#,y#) next next f#=f#+1 swapbuffers() waittimer(100) wend
|
|
|
Post by matthew on Jun 29, 2015 8:52:24 GMT -5
Very colourful Peter. :-)
|
|