Author Topic: New Coding Challenge (Tunnel effects).  (Read 29244 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New Coding Challenge (Tunnel effects).
« Reply #20 on: May 16, 2006 »
Thanks for the comments, I'm going to have a little bit of a play with this today, the frame rate will probably drop a bit but it might be worthwhile.

Just a point to note, I changed the method I've been using to clear the screen buffer to re-dimming the screen buffer, it saves about 80fps here on the 800 X 600 screen.

Probably it's being used widely anyway but just in case anyone else is still doing it the way I was (with a loop), redim seems to be a lot faster, especially when the buffer is big.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New Coding Challenge (Tunnel effects).
« Reply #21 on: May 16, 2006 »
Relsoft gave me the idea for this with his lines, this isn't as pretty but it uses a similar type of effect to blend three dot tunnels together.
(sorry for the lowres the speed took a hit!)
Code: [Select]
'
' Tunnel Routine For DBF Tunnel Challenge By Shockwave^DBF.
' =========================================================
'
' This is a much more basic type of tunnel than the others posted so far
' but still, I hope that you'll like it.
'
'------------------------------------------------------------------------------

'-------------------------------------
' Includes.
'-------------------------------------
        #define dbfcls   reDim Shared As Integer Buffer( 320 * 240 )
       
        #define dbfclsr   reDim Shared As Integer Bufferr( 320 * 240 )
        #define dbfclsg   reDim Shared As Integer Bufferg( 320 * 240 )
        #define dbfclsb   reDim Shared As Integer Bufferb( 320 * 240 )
       
        '#define ptc_win
        #Include Once "tinyptc.bi"
        option dynamic

'-------------------------------------------------------------------------
' Open 800 X 600 Screen.
'-------------------------------------------------------------------------

        If( ptc_open( "DBF TUNNEL", 320, 240 ) = 0 ) Then
        End -1
        End If
   
'--------------------------------------------------------------------------
' Define Storage;
'--------------------------------------------------------------------------
        defint a-z
        Dim Shared As Integer Buffer( 320 * 240 )
       
        Dim Shared As Integer Bufferr( 320 * 240 )
        Dim Shared As Integer Bufferg( 320 * 240 )
        Dim Shared As Integer Bufferb( 320 * 240 )
       
        dim shared rings as integer     
        rings=50
        dim shared rxr(rings) as double
        dim shared ryr(rings) as double
        dim shared rzr(rings) as double
        dim shared gaddr as integer
        dim shared zspr as double       
        dim shared mover as double
        dim shared offsr as integer
        offsr=1           
        mover=0.0
        zspr=(rings+1)/2
        gaddr=0
        for a=1 to rings
           
            rxr(a)=500*sin(gaddr/33)
            ryr(a)=500*sin(gaddr/35)
            rzr(a)=zspr
            zspr=zspr-.5
            gaddr=gaddr+5
        next

        dim shared rxg(rings) as double
        dim shared ryg(rings) as double
        dim shared rzg(rings) as double
        dim shared gaddg as integer
        dim shared zspg as double       
        dim shared moveg as double
        dim shared offsg as integer
        offsg=1           
        moveg=0.0
        zspg=(rings+1)/2
        gaddg=0
        for a=1 to rings
           
            rxg(a)=460*sin(gaddg/33)
            ryg(a)=460*sin(gaddg/35)
            rzg(a)=zspg
            zspg=zspg-.5
            gaddg=gaddg+5
        next
       
       
        dim shared rxb(rings) as double
        dim shared ryb(rings) as double
        dim shared rzb(rings) as double
        dim shared gaddb as integer
        dim shared zspb as double       
        dim shared moveb as double
        dim shared offsb as integer
        offsb=1           
        moveb=0.0
        zspb=(rings+1)/2
        gaddb=0
        for a=1 to rings
           
            rxb(a)=480*sin(gaddb/33)
            ryb(a)=480*sin(gaddb/35)
            rzb(a)=zspb
            zspb=zspb-.5
            gaddb=gaddb+5
        next
       

       
        dim shared circx(1440) as double
        dim shared circy(1440) as double
       
        for a=1 to 1440
            circx(a)=1600*sin(a*3.14/720)
            circy(a)=1600*cos(a*3.14/720)
        next
'---------------
'-Debug Stuff; -
'---------------
    dim shared oldtime,newtime as double
    dim shared TST as string
    dim shared ticks as integer
    ticks=0
'-----------------------------------------------------------------
' Read In Our Font;
'-----------------------------------------------------------------
        dim shared FONT (81 * 59) as integer
        FOR LP=1 TO (81*59)
                READ FONT(LP)
        NEXT
   
'--------------------------------------------------------------------------
' Define Subs;
'--------------------------------------------------------------------------
   
declare sub DBFWPF(BYVAL BX AS INTEGER, BYVAL BY AS INTEGER , BYVAL CH AS INTEGER )
declare sub DBFWPFR(BYVAL BX AS INTEGER, BYVAL BY AS INTEGER , BYVAL CH AS INTEGER )
declare sub DBFWPFG(BYVAL BX AS INTEGER, BYVAL BY AS INTEGER , BYVAL CH AS INTEGER )
declare sub DBFWPFB(BYVAL BX AS INTEGER, BYVAL BY AS INTEGER , BYVAL CH AS INTEGER )
declare sub DBFTEXT(BYVAL BX AS INTEGER , BYVAL BY AS INTEGER , BYVAL CH AS INTEGER , BYVAL CLR AS INTEGER)
declare sub bufferin()
declare SUB Millisecs()
declare sub draw_ringsr()
declare sub draw_ringsg()
declare sub draw_ringsb()

    oldtime=timer
    DO
       
        draw_ringsr()
        draw_ringsg()
        draw_ringsb()
       
        bufferin()
        millisecs()
        Ptc_Update @Buffer(0)
        dbfcls
        'dbfclsr
        'dbfclsg
        'dbfclsb
       
       
        ticks=ticks+1
    LOOP UNTIL INKEY$<>""
   
sub bufferin()
    dim i as integer
    for i=1 to (320*240)
        buffer(i)=rgb(bufferr(i),bufferg(i),bufferb(i))
        'bufferr(i)= bufferr(i) shr 1
        if bufferr(i)>=5 then bufferr(i)=bufferr(i)-5
        if bufferg(i)>=5 then bufferg(i)=bufferg(i)-5
        if bufferb(i)>=5 then bufferb(i)=bufferb(i)-5
    next
       
end sub

sub draw_ringsr()
    mover=mover+.05
    dim tx,ty as integer
    offsr=offsr+1
    if offsr>20 then offsr=offsr-20
   
   
   
    for a=1 to rings
        tx=(rxr(a)/(rzr(a)-mover))+160
        ty=(ryr(a)/(rzr(a)-mover))+120
        clr=a shl 2
        clr2=a shl 1
       
        for z=offsr to 1440 step 20
           
            ttx=(circx(z)/(rzr(a)-mover))+tx
            tty=(circy(z)/(rzr(a)-mover))+ty
           
            dbfwpfr(ttx,tty,clr)
            dbfwpfb(ttx-1,tty,clr2)
            dbfwpfb(ttx+1,tty,clr2)
            dbfwpfb(ttx,tty+1,clr2)
            dbfwpfb(ttx,tty-1,clr2)

           
        next
           
           
    next
 
    if mover>=.5 then
        gaddr=gaddr-255
       for a=1 to rings
            rxr(a)=500*sin(gaddr/33)
            ryr(a)=500*sin(gaddr/35)
            gaddr=gaddr+5
        next
       
        mover=mover-.5
    end if
end sub


sub draw_ringsg()
    moveg=moveg+.05
    dim tx,ty as integer
    offsg=offsg+1
    if offsg>20 then offsg=offsg-20
   
   
   
    for a=1 to rings
        tx=(rxg(a)/(rzr(a)-moveg))+160
        ty=(ryg(a)/(rzr(a)-moveg))+120
        clr=a shl 2
        clr2=a shl 1
       
        for z=offsg to 1440 step 20
           
            ttx=(circx(z)/(rzg(a)-moveg))+tx
            tty=(circy(z)/(rzg(a)-moveg))+ty
           
            dbfwpfg(ttx,tty,clr)
            dbfwpfb(ttx-1,tty,clr2)
            dbfwpfb(ttx+1,tty,clr2)
            dbfwpfb(ttx,tty+1,clr2)
            dbfwpfb(ttx,tty-1,clr2)

           
        next
           
           
    next
 
    if moveg>=.5 then
        gaddg=gaddg-255
       for a=1 to rings
            rxg(a)=460*sin(gaddg/33)
            ryg(a)=460*sin(gaddg/35)
            gaddg=gaddg+5
        next
       
        moveg=moveg-.5
    end if
end sub

sub draw_ringsb()
    moveb=moveb+.05
    dim tx,ty as integer
    offsb=offsb+1
    if offsb>20 then offsb=offsb-20
   
   
   
    for a=1 to rings
        tx=(rxb(a)/(rzb(a)-moveb))+160
        ty=(ryb(a)/(rzb(a)-moveb))+120
        clr=a shl 2
        clr2=a shl 1
       
        for z=offsb to 1440 step 20
           
            ttx=(circx(z)/(rzb(a)-moveb))+tx
            tty=(circy(z)/(rzb(a)-moveb))+ty
           
            dbfwpfb(ttx,tty,clr)
            dbfwpfb(ttx-1,tty,clr2)
            dbfwpfb(ttx+1,tty,clr2)
            dbfwpfb(ttx,tty+1,clr2)
            dbfwpfb(ttx,tty-1,clr2)
           
        next
           
           
    next
 
    if moveb>=.5 then
        gaddb=gaddb-255
       for a=1 to rings
            rxb(a)=480*sin(gaddb/33)
            ryb(a)=480*sin(gaddb/35)
            gaddb=gaddb+5
        next
       
        moveb=moveb-.5
    end if
end sub




SUB Millisecs()
    t=timer

if  t-oldtime >=1 then
    newtime = ticks
    ticks=0
    oldtime=timer
end if

    TST = str( (newtime) )
    TST = "FPS "+TST
    for LP=1 to len(tst)
        CH=(ASC(MID(TST,LP,1)))-31
        DBFTEXT((LP*10),1,CH,&hFFFFFF)
    NEXT
   
end sub


   
'-------------------------------------------------------------------------
'Sub To Draw A Letter AnyWhere On The Screen (With Clipping);
'-------------------------------------------------------------------------
sub DBFTEXT(BYVAL BX AS INTEGER , BYVAL BY AS INTEGER , BYVAL CH AS INTEGER , BYVAL CLR AS INTEGER)
dim blx,bly as integer
    '---------------------------------
    'Calculate Offset In Font Data;---
    '---------------------------------
    bm=(ch*81)-81
    FOR BLY=0 TO 8
    FOR BLX=1 TO 9
        '--------
        'Clip;---
        '--------
        IF (BX+BLX>0) AND (BX+BLX<319) AND (BY+BLY>0) AND (BY+BLY<239) THEN
           
            '----------------------------------------------------
            'Draw Pixel In Buffer If Onscreen And If Binary 1 ---
            '----------------------------------------------------
           
            MM= FONT(((BLY*9)+BLX)+BM)
            IF MM >0 THEN BUFFER (((BY+BLY)*320)+BX+BLX)=CLR
        END IF
    NEXT
    NEXT
END SUB

SUB DBFWPF (BYVAL BX AS INTEGER , BYVAL BY AS INTEGER , BYVAL CH AS INTEGER)
   
    IF (BX>0) AND (BX<319) AND (BY>0) AND (BY<239) THEN
        BUFFER ((BY*320)+BX)=CH       
    END IF
   
END SUB


SUB DBFWPFR (BYVAL BX AS INTEGER , BYVAL BY AS INTEGER , BYVAL CH AS INTEGER)
   
    IF (BX>0) AND (BX<319) AND (BY>0) AND (BY<239) THEN
        BUFFERR ((BY*320)+BX)=CH       
    END IF
   
END SUB

SUB DBFWPFG (BYVAL BX AS INTEGER , BYVAL BY AS INTEGER , BYVAL CH AS INTEGER)
   
    IF (BX>0) AND (BX<319) AND (BY>0) AND (BY<239) THEN
        BUFFERG ((BY*320)+BX)=CH       
    END IF
   
END SUB

SUB DBFWPFB (BYVAL BX AS INTEGER , BYVAL BY AS INTEGER , BYVAL CH AS INTEGER)
   
    IF (BX>0) AND (BX<319) AND (BY>0) AND (BY<239) THEN
        BUFFERB ((BY*320)+BX)=CH       
    END IF
   
END SUB

'==============================================================================
' Binary Font By Shockwave / DBF; (59 Chars)
'==============================================================================

'space
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
'!
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
'"
data 0,1,1,0,1,1,0,0,0
data 0,1,1,0,1,1,0,0,0
data 0,1,1,0,1,1,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
'#
data 0,0,0,0,0,0,0,0,0
data 0,1,1,0,0,0,1,1,0
data 1,1,1,1,1,1,1,1,1
data 0,1,1,0,0,0,1,1,0
data 0,1,1,0,0,0,1,1,0
data 0,1,1,0,0,0,1,1,0
data 1,1,1,1,1,1,1,1,1
data 0,1,1,0,0,0,1,1,0
data 0,0,0,0,0,0,0,0,0
'£
data 0,0,1,1,1,1,0,0,0
data 0,1,1,1,1,1,0,0,0
data 0,1,1,0,0,0,0,0,0
data 0,1,1,0,0,0,0,0,0
data 0,1,1,1,1,0,0,0,0
data 0,1,1,0,0,0,0,0,0
data 0,1,1,0,0,0,0,0,0
data 1,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,0
'%
data 0,0,0,0,0,0,0,0,0
data 0,1,1,0,0,0,0,0,0
data 0,1,1,0,0,0,1,0,0
data 0,0,0,0,0,1,0,0,0
data 0,0,0,0,1,0,0,0,0
data 0,0,0,1,0,0,0,0,0
data 0,0,1,0,0,0,1,1,0
data 0,0,0,0,0,0,1,1,0
data 0,0,0,0,0,0,0,0,0
'&
data 0,0,0,1,1,1,0,0,0
data 0,0,1,1,1,1,1,0,0
data 0,0,1,1,0,1,1,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,1,1,0,1,1,0,0
data 0,1,1,0,0,1,1,1,1
data 0,1,1,1,0,0,1,1,0
data 0,0,1,1,1,1,1,0,0
data 0,0,0,0,1,1,0,0,0
''
data 0,1,1,0,0,0,0,0,0
data 0,1,1,0,0,0,0,0,0
data 0,1,1,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
'(
data 0,0,0,0,0,1,1,1,0
data 0,0,0,0,1,1,1,1,0
data 0,0,0,0,1,1,0,0,0
data 0,0,0,0,1,1,0,0,0
data 0,0,0,0,1,1,1,0,0
data 0,0,0,0,1,1,1,0,0
data 0,0,0,0,1,1,1,0,0
data 0,0,0,0,1,1,1,1,0
data 0,0,0,0,0,1,1,1,0
')
data 0,1,1,1,0,0,0,0,0
data 0,1,1,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,1,1,1,0,0,0,0
data 0,0,1,1,1,0,0,0,0
data 0,0,1,1,1,0,0,0,0
data 0,1,1,1,1,0,0,0,0
data 0,1,1,1,0,0,0,0,0
'*
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,1,0,0,0,0
data 0,0,1,0,1,0,1,0,0
data 0,0,0,1,1,1,0,0,0
data 0,1,1,1,1,1,1,1,0
data 0,0,0,1,1,1,0,0,0
data 0,0,1,0,1,0,1,0,0
data 0,0,0,0,1,0,0,0,0
data 0,0,0,0,0,0,0,0,0
'+
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,1,0,0,0,0
data 0,0,0,0,1,0,0,0,0
data 0,0,1,1,1,1,1,0,0
data 0,0,0,0,1,1,0,0,0
data 0,0,0,0,1,1,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
''
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,0,1,0,0,0,0
'-
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,1,1,1,1,1,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
'.
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
'/
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,1,0
data 0,0,0,0,0,0,1,1,0
data 0,0,0,0,0,1,1,0,0
data 0,0,0,0,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0,0
data 0,1,1,1,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
'0
data 0,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,1,1,1
data 1,1,0,0,0,1,0,1,1
data 1,1,0,0,1,0,0,1,1
data 1,1,0,1,1,0,0,1,1
data 1,1,1,1,0,0,0,1,1
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,0
'1
data 0,0,0,1,1,0,0,0,0
data 0,0,1,1,1,0,0,0,0
data 0,0,1,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,1,1,1,1,1,1,0,0
data 0,1,1,1,1,1,1,0,0
'2
data 0,0,1,1,1,1,1,1,0
data 0,0,1,1,1,1,1,1,1
data 0,0,0,0,0,0,0,1,1
data 0,0,0,0,0,0,0,1,1
data 0,1,1,1,1,1,1,1,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
'3
data 1,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,0
data 0,0,0,0,0,0,0,1,1
data 0,0,0,0,0,0,0,1,1
data 0,0,0,0,1,1,1,1,0
data 0,0,0,0,0,0,1,1,1
data 0,0,0,0,0,0,1,1,1
data 1,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,0
'4
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,1,1,0,0,0
data 1,1,0,0,1,1,0,0,0
data 1,1,1,1,1,1,1,1,1
data 0,0,0,0,0,1,1,1,0
data 0,0,0,0,0,1,1,1,0
data 0,0,0,0,0,1,1,1,0
data 0,0,0,0,0,1,1,1,0
'5
data 0,1,1,1,1,1,1,0,0
data 0,1,1,1,1,1,1,0,0
data 0,1,1,0,0,0,0,0,0
data 0,1,1,0,0,0,0,0,0
data 0,1,1,1,1,1,1,1,0
data 0,0,0,0,0,0,1,1,1
data 0,0,0,0,0,0,1,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,0
'6
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,1,1,1,1,1,1,0
data 1,1,0,0,0,0,1,1,1
data 1,1,0,0,0,0,1,1,1
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,0
'7
data 0,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,1
data 0,0,0,0,0,0,0,1,1
data 0,0,0,0,0,0,0,1,1
data 0,0,0,0,1,1,1,1,1
data 0,0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1,0
data 0,0,0,0,0,1,1,1,0
data 0,0,0,0,0,1,1,1,0
'8
data 0,0,1,1,1,1,1,0,0
data 0,1,1,1,1,1,1,1,0
data 0,1,1,0,0,0,1,1,0
data 0,1,1,0,0,0,1,1,0
data 0,0,1,1,1,1,1,0,0
data 1,1,1,0,0,0,1,1,1
data 1,1,0,0,0,0,1,1,1
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,0
'9
data 0,0,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,1
data 0,1,1,0,0,0,0,1,1
data 0,1,1,0,0,0,0,1,1
data 0,0,1,1,1,1,1,1,1
data 0,0,0,0,0,0,1,1,1
data 0,0,0,0,0,0,1,1,1
data 0,0,0,0,0,0,1,1,1
data 0,0,0,0,0,0,1,1,1
':
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
';
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,0,1,0,0,0,0
'<
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,1,1,0,0
data 0,0,0,0,1,1,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,1,1,1,0,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,0,1,1,1,0,0
data 0,0,0,0,0,1,1,0,0
data 0,0,0,0,0,0,0,0,0
'=
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,1,1,1,1,1,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,1,1,1,1,1,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
'>
data 0,0,0,0,0,0,0,0,0
data 0,0,1,1,0,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,0,1,1,0,0,0
data 0,0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0,0
data 0,1,1,1,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0
'?
data 0,0,1,1,1,1,1,0,0
data 0,1,1,1,1,1,1,1,0
data 0,1,1,0,0,0,1,1,0
data 0,0,0,0,0,0,1,1,0
data 0,0,0,1,1,1,1,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,0,0,0,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
'@
data 0,0,0,0,0,0,0,0,0
data 0,0,1,1,1,1,1,0,0
data 0,1,0,0,0,0,0,0,0
data 0,1,0,0,1,1,1,0,0
data 0,1,0,1,0,0,0,1,0
data 0,1,0,1,1,1,0,1,0
data 0,1,0,0,0,0,0,1,0
data 0,0,1,1,1,1,1,0,0
data 0,0,0,0,0,0,0,0,0
'a
data 0,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,0
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
'b
data 1,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,0
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,0
'c
data 0,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,1
'd
data 1,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,0
'e
data 0,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,1,1,1,1,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,1
'f
data 0,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,1,1,1,1,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
'g
data 0,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,1,1,1,1
data 1,1,0,0,0,0,1,1,1
data 1,1,0,0,0,0,1,1,1
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,0
'h
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
'i
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
'j
data 1,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,0
data 0,0,0,0,0,0,0,1,1
data 0,0,0,0,0,0,0,1,1
data 0,0,0,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,0
'k
data 1,1,0,0,0,0,1,1,0
data 1,1,0,0,0,0,1,1,0
data 1,1,0,0,0,0,1,1,0
data 1,1,0,0,0,0,1,1,0
data 1,1,1,1,1,1,1,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
'l
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,1
'm
data 0,1,1,1,0,1,1,1,0
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,1,0,0,1,1
data 1,1,0,0,1,0,0,1,1
data 1,1,0,0,1,0,0,1,1
data 1,1,1,0,1,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
'n
data 1,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1

'o
data 0,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,0
'p
data 1,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
'q
data 0,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,1,0,1,1
data 1,1,1,0,0,0,1,1,1
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,0
'r
data 1,1,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,0
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
's
data 0,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,0,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0,0
data 0,1,1,1,1,1,1,1,0
data 0,0,0,0,0,0,1,1,1
data 0,0,0,0,0,0,1,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,0
't
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,0,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0,0
'u
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,1,0
'v
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,1,0
data 0,0,1,1,1,1,1,0,0
'w
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,1,0,1,0,0,1,1
data 1,1,1,0,1,0,0,1,1
data 1,1,1,0,1,0,0,1,1
data 1,1,1,1,1,1,1,1,1
data 0,1,1,1,0,1,1,1,0
'x
data 0,1,1,0,0,0,1,1,0
data 0,1,1,0,0,0,1,1,0
data 0,1,1,0,0,0,1,1,0
data 0,1,1,0,0,0,1,1,0
data 0,1,1,1,1,1,1,1,0
data 1,1,1,1,0,0,1,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
data 1,1,1,0,0,0,0,1,1
'y
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 1,1,0,0,0,0,0,1,1
data 0,1,1,1,1,1,1,1,1
data 0,0,0,0,0,0,1,1,1
data 0,0,0,0,0,0,1,1,1
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,0
'z
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
data 0,0,0,0,0,0,0,1,1
data 0,0,0,0,0,0,1,1,1
data 0,1,1,1,1,1,1,1,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0,0
data 1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New Coding Challenge (Tunnel effects).
« Reply #22 on: May 16, 2006 »
Ok, one more varient (this is the best one by me but still not as good as the others that have been submitted).

The source and the exe are in the attachment to this post.
Replaced the dots for bobs, added an unusual scroller.
FPS is about 160 here but I reckon it may be a lot slower than that on some systems.

Could be sped up by dropping the res.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Re: New Coding Challenge (Tunnel effects).
« Reply #23 on: May 16, 2006 »
Nice!!! I like the scroller!! Never thought of making a scroller that way!!! Kudos!
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New Coding Challenge (Tunnel effects).
« Reply #24 on: May 16, 2006 »
Cheers Relsoft :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline TheArchitect

  • ZX 81
  • *
  • Posts: 19
  • Karma: 2
    • View Profile
Re: New Coding Challenge (Tunnel effects).
« Reply #25 on: May 16, 2006 »
W O W
and 30 mins for that last one.....
 :o :o :o :o :o :o :o :o
You are a BEAST

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New Coding Challenge (Tunnel effects).
« Reply #26 on: May 16, 2006 »
Lol, I've been called worse :)
Seriously though, Relsoft and Stonemonkey's are both miles better.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: New Coding Challenge (Tunnel effects).
« Reply #27 on: May 16, 2006 »
As usual, with adding stuff and finding ways to test thought i'd mess around with this. Still working on this so exe only atm and all a bit random.
« Last Edit: May 16, 2006 by Stonemonkey »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New Coding Challenge (Tunnel effects).
« Reply #28 on: May 16, 2006 »
Everyone should download that! It's great :)
Shockwave ^ Codigos
Challenge Trophies Won:

xteraco

  • Guest
Re: New Coding Challenge (Tunnel effects).
« Reply #29 on: May 16, 2006 »
woa! thats awesome! lol...   FBF is totally getting in on this tunnel thing, we'll have ours done by tommorow hopefully

fbf = Xteraco and Rattrapmax btw

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: New Coding Challenge (Tunnel effects).
« Reply #30 on: May 16, 2006 »
@All yees' - Awesome tunnels folks.
@Xteraco - Invite Ratrtapmax over dude.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline zparticle

  • Atari ST
  • ***
  • Posts: 168
  • Karma: 11
    • View Profile
    • ScottShaver2000
Re: New Coding Challenge (Tunnel effects).
« Reply #31 on: May 16, 2006 »
Stonemonkey - that is freaking cool

xteraco

  • Guest
Re: New Coding Challenge (Tunnel effects).
« Reply #32 on: May 18, 2006 »
well, we were planning to have our tunnel done yesterday, but life got in the way, we pushed the deadline up to friday... still alot to do, its gonna be pretty good for something we started on tuesday :)

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New Coding Challenge (Tunnel effects).
« Reply #33 on: May 18, 2006 »
Looking forward to tomorrow then :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2755
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: New Coding Challenge (Tunnel effects).
« Reply #34 on: May 19, 2006 »
Here's my entrie, is just an OGL version from a BB code - box tunnel by Shockwave.
Hope you like it !

Compile with Dev 4.9.9.2, should work with VC6.0 too.



Quote
//
//  OpenGL Vector Tunnel by Rbraz - May 2006
//
//  Original BB code by Shockwave
// 
//



/**************************
 * Includes
 *
 **************************/
#include <windows.h>
#include <math.h>
#include <gl/gl.h>
#include <gl/glu.h>


/**************************
 * Function Declarations
 *
 **************************/
LRESULT CALLBACK WndProc (HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
void EnableOpenGL (HWND hWnd, HDC *hDC, HGLRC *hRC);
void DisableOpenGL (HWND hWnd, HDC hDC, HGLRC hRC);

void glInit();
void glDraw();   
void Init_Structure();
void Draw_Structure();

// Global screen variables
int width  = 640;
int height = 480;

//===================================================================================
// Define Box Storage;
//===================================================================================
float      off=0.0f;
const      int maxsegs=30;
float      genadd;
float      genadd2;

float      scale=200.0f;
float      celx [4][maxsegs];
float      cely [4][maxsegs];
float      celz[4][maxsegs];



/**************************
 * WinMain
 *
 **************************/
int WINAPI WinMain (HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpCmdLine,
                    int iCmdShow)
{
    WNDCLASS wc;
    HWND hWnd;
    HDC hDC;
    HGLRC hRC;       
    MSG msg;
    BOOL bQuit = FALSE;

    /* register window class */
    wc.style = CS_OWNDC;
    wc.lpfnWndProc = WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor (NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = "OGL Vector Tunnel by Rbraz 2006";
    RegisterClass (&wc);

    /* create main window */
    hWnd = CreateWindow (
      wc.lpszClassName, wc.lpszClassName,
      WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,
      0, 0, width, height,
      NULL, NULL, hInstance, NULL);

    /* enable OpenGL for the window */
    EnableOpenGL (hWnd, &hDC, &hRC);
   
    //Initialyze OGL
    glInit();

    /* program main loop */
    while (!bQuit)
    {
        /* check for messages */
        if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
        {
            /* handle or dispatch messages */
            if (msg.message == WM_QUIT)
            {
                bQuit = TRUE;
            }
            else
            {
                TranslateMessage (&msg);
                DispatchMessage (&msg);
            }
        }
        else
        {
            /* OpenGL animation code goes here */

            glDraw();

            SwapBuffers (hDC);

            Sleep (1);
        }
    }

    /* shutdown OpenGL */
    DisableOpenGL (hWnd, hDC, hRC);

    /* destroy the window explicitly */
    DestroyWindow (hWnd);

    return msg.wParam;
}


/********************
 * Window Procedure
 *
 ********************/
LRESULT CALLBACK WndProc (HWND hWnd, UINT message,
                          WPARAM wParam, LPARAM lParam)
{

    switch (message)
    {
    case WM_CREATE:
        return 0;
    case WM_CLOSE:
        PostQuitMessage (0);
        return 0;

    case WM_DESTROY:
        return 0;

    case WM_KEYDOWN:
        switch (wParam)
        {
        case VK_ESCAPE:
            PostQuitMessage(0);
            return 0;
        }
        return 0;

    default:
        return DefWindowProc (hWnd, message, wParam, lParam);
    }
}


/*******************
 * Enable OpenGL
 *
 *******************/
void EnableOpenGL (HWND hWnd, HDC *hDC, HGLRC *hRC)
{
    PIXELFORMATDESCRIPTOR pfd;
    int iFormat;

    /* get the device context (DC) */
    *hDC = GetDC (hWnd);

    /* set the pixel format for the DC */
    ZeroMemory (&pfd, sizeof (pfd));
    pfd.nSize = sizeof (pfd);
    pfd.nVersion = 1;
    pfd.dwFlags = PFD_DRAW_TO_WINDOW |
      PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
    pfd.iPixelType = PFD_TYPE_RGBA;
    pfd.cColorBits = 24;
    pfd.cDepthBits = 16;
    pfd.iLayerType = PFD_MAIN_PLANE;
    iFormat = ChoosePixelFormat (*hDC, &pfd);
    SetPixelFormat (*hDC, iFormat, &pfd);

    /* create and enable the render context (RC) */
    *hRC = wglCreateContext( *hDC );
    wglMakeCurrent( *hDC, *hRC );

}

/******************
 * Disable OpenGL
 *
 ******************/
void DisableOpenGL (HWND hWnd, HDC hDC, HGLRC hRC)
{
    wglMakeCurrent (NULL, NULL);
    wglDeleteContext (hRC);
    ReleaseDC (hWnd, hDC);
}

void glInit()            
{
   // Start Of User Initialization
   glMatrixMode(GL_PROJECTION);                        // Select The Projection Matrix
   glLoadIdentity();                                 // Reset The Projection Matrix
   gluPerspective(45.0f, (float)width/(float)height, 0.1f,  100.0f); // Set Our Perspective
   glMatrixMode(GL_MODELVIEW);                           // Select The Modelview Matrix
   glLoadIdentity();                                 // Reset The Modelview Matrix

   glShadeModel(GL_SMOOTH);                     // Enable Smooth Shading
   glClearColor(0.0f, 0.0f, 0.0f, 0.0f);            // Black Background
   glClearDepth(1.0f);                           // Depth Buffer Setup
   glEnable(GL_DEPTH_TEST);                     // Enables Depth Testing
   glDepthFunc(GL_LEQUAL);                        // The Type Of Depth Testing To Do
   glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);   // Really Nice Perspective Calculations
    glEnable(GL_TEXTURE_2D);                     // Enable 2D Texture Mapping
   
    Init_Structure();         
}

void glDraw()                                        // Draw The Scene
{
   glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);      // Clear Screen And Depth Buffer
   glLoadIdentity();                                 // Reset The View   
   
    glPushMatrix();
     glTranslatef(0.0f,0.0f,-40.0f);
     genadd=genadd+0.01f;
     genadd2=genadd2+0.02f;
     Draw_Structure();
    glPopMatrix();
     
}

//===================================================================================
// Define Boxes Structure;
//===================================================================================
void Init_Structure()
{
    float zp=-((maxsegs+1)*2);
    int a;

 for (a=1; a <= maxsegs; a++)
 {
        celx[1][a]=-scale;
        celx[2][a]=scale;
        celx[3][a]=scale;
        celx[4][a]=-scale;
       
        cely[1][a]=-scale;
        cely[2][a]=-scale;
        cely[3][a]=scale;
        cely[4][a]=scale;

        celz[1][a]=zp;
        celz[2][a]=zp;
        celz[3][a]=zp;
        celz[4][a]=zp;
        zp=zp+2;       
 }
}

//===================================================================================
// Draw Boxes Structure;
//===================================================================================
void Draw_Structure()
{
GLfloat        tx1,tx2,tx3,tx4;
GLfloat        ty1,ty2,ty3,ty4;
GLfloat        tx5,tx6,tx7,tx8;
GLfloat        ty5,ty6,ty7,ty8;

GLfloat        otx1,otx2,otx3,otx4;
GLfloat        oty1,oty2,oty3,oty4;
GLfloat        otx5,otx6,otx7,otx8;
GLfloat        oty5,oty6,oty7,oty8;

GLfloat        xs1,xs2;
GLfloat        ys1,ys2;
int a=1;
GLfloat r,g,b;

     
 glBegin(GL_QUADS);

 for (a=1;a < maxsegs; a++)
 {
  xs1=sinf(genadd+(((float)a/10.0f)))*10.0f;
  xs2=sinf(genadd+(((float)a+1)/10.0f))*10;

  ys1=sinf(genadd2+(((float)a/10.0f)))*10;
  ys2=sinf(genadd2+(((float)a+1)/10.0f))*10;

                tx1= ((celx[1][a]/(celz[1][a]+off))+xs1);
                tx2= ((celx[2][a]/(celz[2][a]+off))+xs1);
                tx3= ((celx[3][a]/(celz[3][a]+off))+xs1);
                tx4= ((celx[4][a]/(celz[4][a]+off))+xs1);
                tx5= ((celx[1][a+1]/(celz[1][a+1]+off))+xs2);
                tx6= ((celx[2][a+1]/(celz[2][a+1]+off))+xs2);
                tx7= ((celx[3][a+1]/(celz[3][a+1]+off))+xs2);
                tx8= ((celx[4][a+1]/(celz[4][a+1]+off))+xs2);

                ty1= ((cely[1][a]/(celz[1][a]+off))+ys1);
                ty2= ((cely[2][a]/(celz[2][a]+off))+ys1);
                ty3= ((cely[3][a]/(celz[3][a]+off))+ys1);
                ty4= ((cely[4][a]/(celz[4][a]+off))+ys1);
                ty5= ((cely[1][a+1]/(celz[1][a+1]+off))+ys2);
                ty6= ((cely[2][a+1]/(celz[2][a+1]+off))+ys2);
                ty7= ((cely[3][a+1]/(celz[3][a+1]+off))+ys2);
                ty8= ((cely[4][a+1]/(celz[4][a+1]+off))+ys2);
               
                r= (float)a * 5  / 255.0f;
                g= (float)a * 6  / 255.0f;
                b= (float)a * 8  / 255.0f;
               
                glColor3f(r,g,b);
               
                 glTexCoord2f(0.0f, 0.0f); glVertex2f (tx1,ty1);
                 glTexCoord2f(1.0f, 0.0f); glVertex2f (tx2,ty2); 
                 glTexCoord2f(1.0f, 1.0f); glVertex2f (otx2,oty2);
                 glTexCoord2f(0.0f, 1.0f); glVertex2f (otx1,oty1);
         
                 glTexCoord2f(0.0f, 0.0f); glVertex2f (tx3,ty3);
                 glTexCoord2f(1.0f, 0.0f); glVertex2f (tx4,ty4);
                 glTexCoord2f(1.0f, 1.0f); glVertex2f (otx4,oty4);
                 glTexCoord2f(0.0f, 1.0f); glVertex2f (otx3,oty3);
                 
                 glTexCoord2f(0.0f, 0.0f); glVertex2f (tx1,ty1);
                 glTexCoord2f(1.0f, 0.0f); glVertex2f (tx4,ty4);
                 glTexCoord2f(1.0f, 1.0f); glVertex2f (otx4,oty4);
                 glTexCoord2f(0.0f, 1.0f); glVertex2f (otx1,oty1);                 

                 glTexCoord2f(0.0f, 0.0f); glVertex2f (tx2,ty2);
                 glTexCoord2f(1.0f, 0.0f); glVertex2f (tx3,ty3);
                 glTexCoord2f(1.0f, 1.0f); glVertex2f (otx3,oty3);
                 glTexCoord2f(0.0f, 1.0f); glVertex2f (otx2,oty2);                 

                 // grab the old values
                 otx1 = tx1; otx2 = tx2; otx3 = tx3; otx4 = tx4;
                 oty1 = ty1; oty2 = ty2; oty3 = ty3; oty4 = ty4;
                 
                 otx5 = tx5; otx6 = tx6; otx7 = tx7; otx8 = tx7;
                 oty5 = ty5; oty6 = ty6; oty7 = ty7; oty8 = ty7;
             
 }
 glEnd();
 
 off=off+0.15f;
 if (off > 2.0f)
 {
  off=off-2.0f;
  genadd=genadd-0.1f;
  genadd2=genadd2-0.1f;
 }
}
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New Coding Challenge (Tunnel effects).
« Reply #35 on: May 20, 2006 »
lol, I'm honoured that you'd port one of my old sources mate :) Yours is nicer.
Shockwave ^ Codigos
Challenge Trophies Won:

xteraco

  • Guest
Re: New Coding Challenge (Tunnel effects).
« Reply #36 on: May 21, 2006 »
well, after being late on our deadline, twice, we've got our 3rd demo in the demo linup for FBFusion, i say its not bad for being started tuesday, and finished on saturday.... :)

here is the link
http://www.xteraco.com/FBfusion/prods/fbf03%20the%20tunnel%20demo.rar

also, fbf's homepage should be up in a few days, it will be www.xteraco.com/fbfusion

let me know what ya think

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: New Coding Challenge (Tunnel effects).
« Reply #37 on: May 21, 2006 »
Hi exteraco, crashes here a couple of seconds after starting on both fullscreen and windowed.

AMD xp+ @1.7, 512Mb, Radeon 9600

xteraco

  • Guest
Re: New Coding Challenge (Tunnel effects).
« Reply #38 on: May 21, 2006 »
we've tested the software at each resolution on 4 different machines, with various hardware on each. We were not able to reproduce the bug you mentioned, its possible that it may be a video driver issue.

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2755
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: New Coding Challenge (Tunnel effects).
« Reply #39 on: May 21, 2006 »
@Shockie : thanks dude !  :)


@Xteraco: Works fine here, nice idea !

Btw, your bitmap font is hard to read for me :(

« Last Edit: May 21, 2006 by Rbraz »
Challenge Trophies Won: