about the Tree recursion here http://www.thinbasic.com/community/s...ll=1#post90956
it needs dll and inc file to plot thick lines using another graphics lib. here is an adaptation to use thinbasic TBGL lines in 3D environment. i have used as a skeleton TBGL_TestOf3DViewports.tbasic from the thinbasic examples and using TBGL_NewList tree
but there is some flicker due to the rotation of thick lines, if it does not rotate then there is no flicker.
thanks for the original contributors
tree.PNG
Uses "math" , "tbgl" 
Const tree Value 1

' -- Create and show window
Dim hWnd As DWord  = TBGL_CreateWindowEx("recursive tree - press ESC to quit", 640, 480, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX) 

TBGL_ShowWindow 

TBGL_UseLighting %TRUE
TBGL_UseLightSource %GL_LIGHT0, %TRUE

TBGL_SetLightParameter %GL_LIGHT0, %TBGL_LIGHT_POSITION, 10, 15, 15, 1

DIM i AS DOUBLE
DIM FrameRate AS DOUBLE

' -- Resets status of all keys 
TBGL_ResetKeyState()
Dim depth As Long = 9
  TBGL_NewList tree 
  TBGL_PushMatrix
   MainDraw(0, 0, 90, depth)
  TBGL_PopMatrix 
  TBGL_EndList
  
' -- Main loop
While TBGL_IsWindow(hWnd) 
  FrameRate = TBGL_GetFrameRate

  TBGL_ClearFrame   
  
 TBGL_PushMatrix
      TBGL_Translate 0, -25, -75
      TBGL_Rotate GetTickCount/20, 0, 1, 0
      'TBGL_Scale 0.7, 0.7, 0.7
      TBGL_UseLighting %FALSE 
      TBGL_CallList tree 
      'MainDraw(0, 0, 90, depth)
      
 TBGL_PopMatrix
   
  
  TBGL_Viewport(0.0, 0, 1.0, 1)
    TBGL_ResetMatrix
    TBGL_RenderMatrix3D(%TBGL_VIEWPORT)
    
    TBGL_Camera 15, 15, 15, 0, 0, 0 
    TBGL_UseLighting %TRUE

    TBGL_Color 250, 100, 255
    TBGL_PushMatrix
    TBGL_Translate 5, -10, -5
    TBGL_Sphere 1.5
    TBGL_PopMatrix   
    
    TBGL_Color 255, 255, 250
    TBGL_Box 120, 120, 120    
    'tbgl_box 10, 10, 10
  

  TBGL_DrawFrame 

  ' -- ESCAPE key to exit application
  If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While 

Wend 

TBGL_DestroyWindow
 
Sub MainDraw(x1, y1 As Long, angle As Single, d As Long)
Dim x2, y2 As Long

If d >0 Then
x2 = x1 + Cos(DegToRad(angle)) * d * 1
y2 = y1 + Sin(DegToRad(angle)) * d * 1 

'TBGL_Color 255-d*10, 100-d, 70 
TBGL_Color 255-d*70, 150-d,20 
TBGL_LineWidth d
TBGL_Line(x1, y1, x2, y2)

'DrawLine x1, y1, x2, y2, d, Rgb(255-d*10, 100-d, 70)
MainDraw(x2, y2, angle - 20, d-1)
MainDraw(x2, y2, angle + 20, d-1)
End If
End Sub