Flow abstrait 2 en OpenGL

Partagez votre expérience de PureBasic avec les autres utilisateurs.
Avatar de l’utilisateur
threedslider
Messages : 455
Inscription : dim. 01/juil./2018 22:38

Flow abstrait 2 en OpenGL

Message par threedslider »

Hello

La suite de la modification de flow abstrait 2 en OpenGL :mrgreen:

Code : Tout sélectionner

;;;
;;;  Created by threedslider -- 01/27/2024
;;;

move.f = 0

Procedure flow(x)
  Shared move
  
      fly_x.f =   5500 *Cos(Exp(x)/100) * (Cos(move+x) / 100) 
      
      fly_y.f =  Cos(Sin(move+x))* 3000 *Sin(Exp(x)/100) * (Sin(move) / 100)
      
       
    
    glBegin_(#GL_LINES)
    glColor3f_(1.0, 0.3, 1.0)
    glVertex3f_( fly_x*0.3,  0.3 , fly_y*0.3) 
    glVertex3f_( fly_x*0.3, fly_y*0.3, 0.3) 
    glEnd_();
    
      
    
EndProcedure
  

InitSprite()
InitKeyboard()


OpenWindow(0, 0, 0, 800, 600, "OpenGL : Abstract flow 2 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  +  1/100000
    
    
    flow(x)
    
    
 
         
  Next
  

  
   
 FlipBuffers()
 
 ExamineKeyboard()
 
Until KeyboardPushed(#PB_Key_Escape) Or quit = 1