I share you my code as fun
Code: Select all
;;;
;;; Created by threedslider -- 11/13/2023
;;;
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 800, 600, "OpenGL : Diamond 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)
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 360
move.f + 1/100000
helix_x.f = 50 *Exp((move-x)/200) * Cos(move+x)
helix_y.f = 50 *Exp((move-x)/200) * Sin(move+x)
glBegin_(#GL_LINES)
glColor3f_(1.0, 0.3, 1.0)
glVertex3f_( helix_x*0.3, 0.3, 0.3)
glVertex3f_( -0.3, -helix_y*0.3, 0.3)
glEnd_();
Next
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or quit = 1