Page 1 of 1
Effect - Broken TV
Posted: Fri Jun 25, 2004 7:49 pm
by syntax error
Code updated for 5.20+
Code: Select all
; broken TV
; Converted from Jeppe Nielsons Blitz 'Broken TV' code
sw.l=GetSystemMetrics_(#SM_CXSCREEN)
sh.l=GetSystemMetrics_(#SM_CYSCREEN)
#cell=72
dSW=sw/4 : dSH=sh/4
bw.f=dSW/#cell : bh.f=dSH/#cell
; setup display
ShowCursor_(0)
OpenWindow(0, 0, 0, sw, sh, "", #PB_Window_BorderLess)
; main loop
Repeat
DC=StartDrawing(WindowOutput(0))
For y=0 To #cell-1
For x=0 To #cell-1
c=50+Random(200)
FrontColor(RGB(c,c,c))
Box(x*bw,y*bh,bw,bh)
Next
Next
BitBlt_(DC , dSW,0 , dSW,dSH , DC , 0,0,#SRCCOPY)
BitBlt_(DC , 0,dSH , dSW*2,dSH , DC , 0,0,#SRCCOPY)
BitBlt_(DC , 0,dSH*2 , dSW*2,dSH*2 , DC , 0,0,#SRCCOPY)
BitBlt_(DC , dSW*2,0 , dSW*2,dSH*4 , DC , 0,0,#SRCCOPY)
StopDrawing()
Delay(5)
Until GetAsyncKeyState_(#VK_ESCAPE)=-32767
; cleanup
CloseWindow(0)
ShowCursor_(1)
End
Posted: Fri Jun 25, 2004 8:33 pm
by Dreglor
intresting,
is it me or do i see a pattern in the noise o_O
maybe i should laydown...
Posted: Fri Jun 25, 2004 8:47 pm
by benny
@SyntaxTerror:
Nice one ... I made a TV-Noise screen, too. See here :
viewtopic.php?p=44495&highlight=#44495
However, I like the fact that you achieve a pretty cool running FX without using an Open(Windowed)Screen ! Thanx for sharing...
@Dreglor:
The actual random pattern is just a 72*72 region in this example. the rest is blitted/copied.
Comment out some of the
BitBlt_ commands to see what I mean.
Posted: Fri Jun 25, 2004 9:32 pm
by syntax error
I saw a similar effect in a game once and wondered how they managed to change so many dots in realtime. Thanks to Jeppe Neilsons Blitz example code I found out how.
It's clever how the repeated blocks of the main image manage to merge together so well without too much noticable tiling.
The above example is very system friendly which means it can be used as a (broken monitor) screensaver!
Posted: Fri Jun 25, 2004 10:29 pm
by benny
syntax error wrote:I saw a similar effect in a game once and wondered how they managed to change so many dots in realtime. Thanks to Jeppe Neilsons Blitz example code I found out how.
It's clever how the repeated blocks of the main image manage to merge together so well without too much noticable tiling.
The above example is very system friendly which means it can be used as a (broken monitor) screensaver!
I had the idea of a screensaver, too - after I wrote my version .. you can download it from my site :
http://www.weltenkonstrukteur.de/cw.html
Re: Effect - Broken TV
Posted: Sun Jun 27, 2004 7:16 am
by techjunkie
syntax error wrote:Code: Select all
; broken TV
; Converted from Jeppe Nielsons Blitz 'Broken TV' code
[/quote]
Another Jeppe Nielson... Sweet!! :D
Posted: Tue Jun 29, 2004 2:20 am
by fweil
Code updated for 5.20+
I played from this idea and obtained this (obtain 25 Mpixels/s, FPS 32, in 1024x768 on my PC) :
Code: Select all
; broken TV
ScreenXSize = GetSystemMetrics_(#SM_CXSCREEN)
ScreenYSize = GetSystemMetrics_(#SM_CYSCREEN)
If InitSprite() And InitKeyboard() And OpenScreen(ScreenXSize, ScreenYSize, 32, "")
Repeat
FlipBuffers()
StartDrawing(ScreenOutput())
Address = DrawingBuffer()
! MOV esi, [v_Address] ; esi = Address. esi is the start address
! MOV edi, [v_ScreenXSize] ; edi = (ScreenXSize * ScreenYSize - ScreenXSize - ScreenYSize) * 4 + 4 + Address which is equivalent to
! IMUL edi, [v_ScreenYSize] ; edi = (ScreenXSize - 1) * (ScreenYSize - 1) * 4 + Address
! SUB edi, [v_ScreenXSize] ; edi is the last address of the drawing buffer
! SUB edi, [v_ScreenYSize] ;
! SAL edi, 2 ;
! ADD edi, 4 ;
! ADD edi, esi ;
! _While_Main: ; While loop
c = Random(255) ; c = Random(255)
! MOV ebx, dword [v_c] ; ebx = c
! MOV ecx, ebx ; ecx = ebx
! SAL ecx, 8 ; ecx << 8
! ADD ecx, ebx ; ecx + ebx
! SAL ecx, 8 ; ecx << 8
! ADD ecx, ebx ; ecx + ebx, which finally corresponds to ecx = ebx << 16 + ebx << 8 + ebx or RGB(ebx, ebx, ebx) meaning RGB(c, c, c)
! CMP esi, edi ; if esi > edi
! JG _Wend_Main ; Break
! MOV [esi], ecx ; PokeL(esi, ecx)
! INC dword [v_NPoints] ; NPoints + 1
! ADD esi, 4 ; esi + 4 meaning Address + 4
! JMP _While_Main ; Wend
! _Wend_Main:
BackColor(RGB(0, 0, 0))
FrontColor(RGB(255, 255, 255))
DrawText(10, 10, Str(FPS))
DrawText(10, 30, Str(Points))
StopDrawing()
If ElapsedMilliseconds() - tz => 1000
FPS = NFrames
tz = ElapsedMilliseconds()
NFrames = 0
Points = NPoints
NPoints = 0
EndIf
NFrames + 1
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
CloseScreen()
EndIf
End
Posted: Tue Jun 29, 2004 9:14 am
by benny
@fweil:
Nice one ... get constant 41fps on my machine with a resolution of 1024*768.