The source code for this demo can be found in Oxygen-inProgress: /examples/GUI/glWaveParticle.o2bas
Peter knows the algorithm:
...
sub MakePatternB(sys n)
'======================
'
%size 1024
static long pixels[size*size]
static long tx=size, ty=size, x, y, p, c
'
type rgba byte r,g,b,a
double range,x,y,r,sc,stp
long px,py,p
rgba tex at (@pixels)
'
range=28 : sc=127 : stp=range*2/size
y=-range
p=@pixels
for py=1 to size
x=-range
for px=1 to size
r = Cos(x) + Sin(y)
Tex.r = 128+sc*Cos(y*r)
Tex.g = 128+sc*Cos(x*y*r)
Tex.b = 128+sc*Sin(r*x)
Tex.a = 255
@tex+=sizeof tex 'ADVANCE TEXTURE ARRAY POINTER
x+=stp
Next
y+=stp
Next
'
glBindTexture GL_TEXTURE_2D, texn[n]
glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR
glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR
glTexImage2D GL_TEXTURE_2D, 0, 4, tx, ty, 0, GL_RGBA, GL_UNSIGNED_BYTE, @Pixels
'
end sub
...
Charles
X