Restored from previous forum. Originally posted by traumatic.
hello and thank you for all your nice coments!!
so, mr. vain was correct - it's
poor opengl - and it's realtime
sorry fred, no plot() involved
since everyone seems to be interested in how to achieve this kind of effect,
here's some code-snippet:
this is where the tunnel-drawing happens...
Code: Select all
; 'ElapsedTime' is used as the angle here
For i.b = 0 To 32
For j.b = 0 To 32
; calculate texture-coordinates (this way only works for 24bit images)
texCoord(i,j)\u = (i / 32.0 + Cos(((ElapsedTime*3) + 8 * j) / 60.0) / 2)
texCoord(i,j)\v = (j / 32.0 + ((ElapsedTime*3) + j) / 120)
; setup tunnel
polyCoord(i,j)\x = (3.0 - j/12.0)*(Cos(2.0*#PI/32*i)+ 2*Sin((ElapsedTime+2*j)/29) + Cos((ElapsedTime+2*j)/13) - 2*Sin(ElapsedTime/29) - Cos(ElapsedTime/13))
polyCoord(i,j)\y = (3.0 - j/12.0)*(Sin(2.0*#PI/32*i)+ 2*Cos((ElapsedTime+2*j)/33) + Sin((ElapsedTime+2*j)/17) - 2*Cos(ElapsedTime/33) - Sin(ElapsedTime/17))
polyCoord(i,j)\z = -j
Next
Next
glColor3f_(0.7, 0.7, 0.7)
glEnable_(#GL_TEXTURE_2D)
glBindTexture_(#GL_TEXTURE_2D, tunnelTex)
; draw cylinder for tunnel
For xl.b = 0 To 31
glBegin_(#GL_QUADS)
For yl.b = 0 To 31
glTexCoord2f_(texCoord(xl,yl)\u, texCoord(xl,yl)\v)
glVertex3f_(polyCoord(xl,yl)\x, polyCoord(xl,yl)\y, polyCoord(xl,yl)\z)
glTexCoord2f_(texCoord(xl+1,yl)\u, texCoord(xl+1,yl)\v)
glVertex3f_(polyCoord(xl+1,yl)\x, polyCoord(xl+1,yl)\y, polyCoord(xl,yl)\z)
glTexCoord2f_(texCoord(xl+1,yl+1)\u, texCoord(xl+1,yl+1)\v)
glVertex3f_(polyCoord(xl+1,yl+1)\x, polyCoord(xl+1,yl+1)\y, polyCoord(xl,yl+1)\z)
glTexCoord2f_(texCoord(xl,yl+1)\u, texCoord(xl,yl+1)\v)
glVertex3f_(polyCoord(xl,yl+1)\x, polyCoord(xl,yl+1)\y, polyCoord(xl,yl+1)\z)
Next
glEnd_()
Next
...whereas the above code uses the following arrays/structures:
Code: Select all
Structure TCoord ; Texture Coordinates
u.f
v.f
EndStructure
Structure PCoord ; Polygon Coordinates
x.f
y.f
z.f
EndStructure
Dim polyCoord.PCoord(36,36)
Dim texCoord.TCoord(36,36)
hope that helped a bit
regards,
traumatic
fred:
seeing the background apps is a nice feature, isn't it
i'll check that, since i never saw this problem. thank you
mr. vain:
this would easily fit in less than 32k (upx-compressed),
even without modifying the pe-header. there are still
unused/unnecessary procedures and warning-messages in
the source
btw.: anyone interested in a 'pb128k'-compo?
rules:
- coded in purebasic
- no more than 128kb filesize
- files can be applications, demos, games, whatever
thanks again!