
Code : Tout sélectionner
;;;
;;; Created by threedslider -- 12/02/2023
;;;
move.f = 0
Procedure fly(x, iter)
Shared move
helix_x.f = iter*50 * (Exp((Cos(x)-x)/200)) * Cos(move+Sin(x*2))
helix_y.f = iter*50 * (Cos((Sin(move-x)-Cos(x))/200)) * Sin(move+x)
glBegin_(#GL_POINTS)
glColor3f_(1.0, 0.3, 1.0)
glVertex3f_( helix_x*0.3, helix_y*0.3 , 0.3)
glEnd_();
glPointSize_(2.0)
If iter = 0
iter = 0
Else
fly(x, iter-1)
EndIf
EndProcedure
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 800, 600, "OpenGL : fly for test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600)
glMatrixMode_(#GL_PROJECTION)
glLoadIdentity_()
gluPerspective_(45.0, 800/600, 1.0, 60.0)
glMatrixMode_(#GL_MODELVIEW)
glTranslatef_(0, 0, -50)
glShadeModel_(#GL_SMOOTH)
glEnable_(#GL_LIGHT0)
glEnable_(#GL_LIGHTING)
glEnable_(#GL_COLOR_MATERIAL)
glEnable_(#GL_DEPTH_TEST)
glEnable_(#GL_CULL_FACE)
glViewport_(0, 0, 800, 600)
x.i = 0
Repeat
glClearColor_(0.1, 0.1, 0.1, 0) ; background color
glClear_(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
Repeat
event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
quit = 1
EndSelect
Until event = 0
For x = 0 To 860
move =move + 1/100000
fly(x,4)
Next
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or quit = 1