small (32k) purebasic demonstration

Developed or developing a new product in PureBasic? Tell the world about it.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by traumatic.

hi all!

because I'm ill right now I finally found some time to code a few lines in pb.

this is not to be considered nice - maybe it can show the people that are interested in purebasic that pb is not only for applications.

of course, there can be done even more in 32kb.

regards,
traumatic
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by traumatic.

as i already wrote: I'm ill :wink:

here's the missing link
http://files.connection-refused.org/pbtest.zip
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by WolfgangS.

Extreme !!!

would you provide us with the sourcecode ???

Best regards ...
WolfgangS
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by MrVainSCL.


Hi traumatic
Really great example! I like it Exactly the stuff we want to do with PB too, hehe... I think your example is based on OGL instead of DX, isnt it? Will you release the source for the comunity for learning a bit more about such great tunnel fx in realtime with PB using OGL? :wink:

Keep on your great work, dude.
respect


PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by WolfgangS.

Reminds me to "Master of the Lamps" 15 Years ago ...

...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
... Will you release the source for the comunity for learning a bit more about such great tunnel fx in realtime with PB using OGL? :wink:

Keep on your great work, dude.
respect


PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten
REALTIME

NO! NADA! NEE!
Not on my AMD-Duron-900 with ATI Mobility Graphic and WinXP.
This is soooo sloooow.
If this is OpenGL maybe WinXP has bad OpenGL drivers

Have all of you REALTIME


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by MrVainSCL.
Franco wrote:[/]
REALTIME

NO! NADA! NEE!
Not on my AMD-Duron-900 with ATI Mobility Graphic and WinXP.
This is soooo sloooow.
If this is OpenGL maybe WinXP has bad OpenGL drivers

Have all of you REALTIME


Hi Franco
I dont know if its realtime or not... I just thought so... Mhhhh, but maybe you are right and "traumatic" is using only some tables... think he will tell us and then we will see... I think you cant do the same fx in PB in that speed or faster, using the new fast Plot() command...!?

traumatic wrote:[/]
topic: small (32k) demonstration...


Hi traumatic
hehe... 32k? hehe... your file is 32.800 bytes and so its over 32k *lol*, becuase 32k = 32768 bytes - You could remove with a PE Editor, the empty BSS section in your file and pack then with UPX, then you will have an exact 32k demonstration, hehe... Like your example...


PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

I guess it only use the plot() command ? Run very smooth here Only problem: call ClearScreen(0,0,0) on the back buffer too, because I see the windows background apps . Nice effect !

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by MrVainSCL.
Fred wrote
I guess it only use the plot() command ? Run very smooth here Only problem: call ClearScreen(0,0,0) on the back buffer too, because I see the windows background apps . Nice effect !
Hi Fred
Its a poor OGL application as you can see in the end of file, also no DX Plot()? Here on my PIII450 the effect works very smooth too... I dont have any problems and so i never see the win background app here!

PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

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!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

Nice little Effects... Tunnel and Screen Wobbling.
Remembers me on some old BBS intro...

I have the same problem like Frederic -
the Effect is nice, but above and under
the effect the windows background comes
through and flickers.

cya,
...Danilo


(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by traumatic.
I have the same problem like Frederic -
the Effect is nice, but above and under
the effect the windows background comes
through and flickers.
ah, i guess i know what you're talking about
is it just above and below the center of the screen (96px.) ?

then it's glscissors causing this.
i thought you can see the windows background through the entire screen.
thanks!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
Run very smooth here Only problem: call ClearScreen(0,0,0) on the back buffer too, because I see the windows background apps . Nice effect !

Fred - AlphaSND
Yes, very nice effect !
It runs smoothly @work PIII-1GhZ and Matrox graphic & Win98SE.
But you don't switch back from your resolution (I work with 1600x1200 and have to switch back manually somehow...).
I see the windows background apps too.
And I'm wondering why it is so slow @home.
Because of WinXP? Because of AMD Duron900? Because of ATI Mobility? Because of OpenGL drivers? Help needed...


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pupil.
And I'm wondering why it is so slow @home.
Because of WinXP? Because of AMD Duron900? Because of ATI Mobility? Because of OpenGL drivers? Help needed...
My suggestions would be to update your drivers for the video card, i got a Duron800 and it runs smoothly here, with the exception of the before mentioned anoying flickering border showing the desktop.

GF2GTS, on w2k
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tinman.
And I'm wondering why it is so slow @home.
Because of WinXP? Because of AMD Duron900? Because of ATI Mobility? Because of OpenGL drivers? Help needed...
I read that WinXP does come with poor OpenGL drivers, because MS didn't want/weren't allowed/didn't have a proper lisence for up to date ones.
I think they released an update though?

As for the demo, very nice. Works smoothly on my Duron750 (win98, Voodoo3), but I have a problem. I guess there is supposed to be text over the tunnel? I just get white blocks. Don't worry, I'm sure it's a driver problem, I just want to know what I'm missing :)

--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.20)

Edited by - tinman on 26 June 2002 22:16:05
Post Reply