| |
|
|
Sven Bader | Mit el Accumulation Buffer dejar se bastante nette Sachen realisieren, como para Ejemplo una Bewegungsunschärfe.
La idea es, dass uno mehrere Frames en un zusammenfasst. Gibt lo no Bewegung, así merkt uno no hay diferencia ansonsten sieht uno, como bewegten Objetos Schlieren ziehen.
In mi Ejemplo aumenta el Anzahl el zusammengefassten Bilder con el Geschwindigkeit y lo se zusätzlich ni kleine Abweichung instalado, en el Effekt a verstärken.
Ohne Accum Buffer (oder Stillstand)
Mit Accum Buffer
Mit Accum Buffer + Schütteleffekt (dx!, dy!, dz!)
$H windows.ph
declarar xrot!, yrot!, zrot!
declarar xpos!, xspeed!, ypos!, yspeed!, zpos!, zspeed!
proc DrawGLScene
parámetros dx!, dy!, dz!
declarar id&
ogl("glClear",~GL_DEPTH_BUFFER_BIT | ~GL_COLOR_BUFFER_BIT)'ogl("clear") cleared a viel!
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
declarar 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)
caso max! <= 1 : max! = 1
caso max! > 10 : max! = 10
ogl("glClear",~GL_ACCUM_BUFFER_BIT)
whileloop 0, max!-1
DrawGLScene(dx! * &bucle, dy! * &bucle, dz! * &bucle)
ogl("glAccum",~GL_ACCUM, 1.0 / max!)
endwhile
ogl("glAccum",~GL_RETURN, 1.0)
ogl("Pop")
~SwapBuffers(%hDC)'Ersetzt show!!
ENDPROC
' Hauptprogramm
' -------------
declarar hWnd&, ende%, hpic&,tex&,tex2&
CLS 0
oGL("Init", %hWnd, 1, 1, 1, 0)
'Texture de Icons
Mcls 32,32
startpaint -1
DrawIcon "A", 0,0
endpaint
hPic&=create("HPIC",0,"& MEMBMP")
tex&=ogl("getTextureBmp",hPic&,1)
DeleteObject hPic&
'Texture de 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.
Sinestar encargado ende%
WaitInput
If IsKey(27)
Ende% = 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
|
|
|
| |
|
|