Questions about a Billboard source code

Just starting out? Need help? Post your questions and find answers here.
WolfgangS
Enthusiast
Enthusiast
Posts: 174
Joined: Fri Apr 25, 2003 3:30 pm

Questions about a Billboard source code

Post by WolfgangS »

Hi!
I got two questions about this source code.

First:
If you start the source code and you press cursor down you will see 21 balls. 12 of these balls are flying away the 9 will stay. Why aren´t fly all away ?

Second:
If you un-remark the line with the RorateMaterial() function you will see the balls are no balls anymore. Why ?

Thank you & MFG
WolfgangS


Code: Select all

#CameraSpeed = 10
#AmountBB   = 20    ; 0-20 = 21 BillBoards

IncludeFile "Screen3DRequester.pb"
DefType.f KeyX, KeyY, MouseX, MouseY
If InitEngine3D()
  InitSprite()
  InitKeyboard()
  InitMouse()
  If Screen3DRequester()
  


  ; create a Texture
  CreateTexture(10,64,64)
  StartDrawing(TextureOutput(10))
    Circle(32,32,16,$9abcde)
  StopDrawing()

  ; create A Material + Rorate + BlendingMode
  CreateMaterial(10, TextureID(10))
  ;RotateMaterial(10,0.1,#PB_Material_Animated)
  MaterialBlendingMode(#10, #PB_Material_add) 
   
  ; create Billboard
  CreateBillboardGroup(0, MaterialID(10), 10, 10)
  
  ; Create the Billboards  
  For i=0 To #AmountBB         
    AddBillboard(i,0,Random(80),Random(80),Random(80))
  Next
          
  ; Creat the Camera
  CreateCamera(0, -200, -250, 100, 100)
  CameraLookAt(0,152,72,0)

  Repeat
      Screen3DEvents()
      ClearScreen(0, 0, 0)

      If ExamineKeyboard()
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = #CameraSpeed 
        Else
          KeyX = 0
        EndIf
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = #CameraSpeed 
        Else
          KeyY = 0
        EndIf
      EndIf
      
      ; Move the Billboards
      For i=0 To #AmountBB   
        MoveBillboard(i,0,0,1,0)
      Next
      
      
      If ExamineMouse()
        MouseX = -(MouseDeltaX()/10)*#CameraSpeed/2
        MouseY = -(MouseDeltaY()/10)*#CameraSpeed/2
      EndIf
      
      RotateCamera(0, MouseX, MouseY, RollZ)
      MoveCamera  (0, KeyX, 0, KeyY)
    
      RenderWorld()
      ;Screen3DStats()
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
    
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
  
End
; ExecutableFormat=Windows
; CursorPosition=12
; FirstLine=1
; EOF
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

Error 3D engine can't be inialized

Post by LJ »

I keep getting the error "The 3D Engine can't be initialized". The InitEngine3D() command has some problems. See the Bugs message forum for more information on this. This may be a clue as to what is wrong with the command.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Wolfgang: Seems like the rotating point is not the texture center.. I will investigate this.

LJ: this is not the problem, you don't need to post this to any 3D related post. Please join IRC or send me an email to solve this issue.
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

OK

Post by LJ »

Fred - Ok. Sent you an e-mail.
Post Reply