| |
|
|
Sven Bader | with the Accumulation Buffer can integrally nice things release, How to that example a Bewegungsunschärfe.
The idea is, that one several Frames in a zusammenfasst. gives it no movement, so observes one none Difference otherwise sees one, as moved Objects Schlieren wander.
In my example increased the Number of abstracted Images with the speed and it'll additional another small deviation installed, around the effect To join.
without Accum Buffer (or stood still)
with Accum Buffer
with Accum Buffer + Schütteleffekt (dx!, dy!, dz!)
$H windows.ph
declare xrot!, yrot!, zrot!
declare xpos!, xspeed!, ypos!, yspeed!, zpos!, zspeed!
proc DrawGLScene
parameters dx!, dy!, dz!
declare id&
ogl("glClear",~GL_DEPTH_BUFFER_BIT | ~GL_COLOR_BUFFER_BIT)'ogl("clear") cleared To plenty!
oGL("Color", 0.7,0.7,0.7,1)
oGL("Origin", xpos!+dx!*0.1, ypos!+dy!*0.1, zpos!+dz!*0.1)
oGL("Rotate", xrot!, yrot!, zrot!)
oGL("Move", 0, -1, 0)
oGL("Texture", tex&, 1)
oGL("Cylinder", 1, 1, 2, 24)
oGL("Texture",tex2&, 8)
oGL("Origin", 0, -10, -24)
oGL("Quad", 29, 20)
xrot! = xrot! + xspeed!
yrot! = yrot! + yspeed!
zrot! = zrot! + zspeed!
endproc
proc Redraw
declare i%, max!, dx!, dy!, dz!
dx! = 1.0
dy! = 1.0
dz! = -1.0
ogl("Clear")
ogl("Push")
max! = if(abs(yspeed!) > abs(xspeed!), if(abs(yspeed!) > abs(zspeed!), abs(yspeed!), abs(zspeed!)), abs(xspeed!)) * 0.75
max! = round(max!, 0)
case max! <= 1 : max! = 1
case max! > 10 : max! = 10
ogl("glClear",~GL_ACCUM_BUFFER_BIT)
whileloop 0, max!-1
DrawGLScene(dx! * &loop, dy! * &loop, dz! * &loop)
ogl("glAccum",~GL_ACCUM, 1.0 / max!)
endwhile
ogl("glAccum",~GL_RETURN, 1.0)
ogl("Pop")
~SwapBuffers(%hDC)'supplant show!!
endproc
' Hauptprogramm
' -------------
declare hWnd&, end%, hpic&,tex&,tex2&
CLS 0
oGL("Init", %hWnd, 1, 1, 1, 0)
'Texture from Icons
Mcls 32,32
startpaint -1
DrawIcon "A", 0,0
endpaint
hPic&=create("HPIC",0,"&MEMBMP")
tex&=ogl("getTextureBmp",hPic&,1)
DeleteObject hPic&
'Texture from Icons
startpaint -1
DrawIcon "KNOPF1", 0,0
endpaint
hPic&=create("HPIC",0,"&MEMBMP")
tex2&=ogl("getTextureBmp",hPic&,1)
DeleteObject hPic&
xpos! = 0
ypos! = 0
zpos! = -5
xrot! = 35
yrot! = 55
zrot! = 0
xspeed! = 0
yspeed! = 0
zspeed! = 0
Ende% = 0
setTimer 10' max. 50 Frames /sek.
WhileNot end%
WaitInput
If IsKey(27)
end% = 1
ElseIf Iskey(39)
yspeed! = yspeed! + .02
ElseIf Iskey(37)
yspeed! = yspeed! - .02
ElseIf Iskey(40)
xspeed! = xspeed! + .02
ElseIf Iskey(38)
xspeed! = xspeed! - .02
ElseIf Iskey(33)
zpos! = zpos! - .1
ElseIf Iskey(65)
xpos! = xpos! - .1
ElseIf Iskey(68)
xpos! = xpos! + .1
elseIf Iskey(83)
ypos! = ypos! - .1
ElseIf Iskey(87)
ypos! = ypos! + .1
ElseIf Iskey(34)
zpos! = zpos! + .1
EndIf
redraw()
EndWhile
killTimer
end
|
|
|
| |
|
|