CreatePlane Bug?

Everything related to 3D programming
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

CreatePlane Bug?

Post by Samuel »

If I give the plane a TileCount greater than 255 the program crashes. Not sure if it's a bug, but I thought in previous versions I could exceed 255.


Code: Select all

InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()

Width  = 800
Height = 600

;###########
TileCountX=256
TileCountZ=256
;###########

If OpenWindow(0, 0, 0, Width, Height, "Test")
  If OpenWindowedScreen(WindowID(0), 0, 0, Width, Height, 0, 0, 0)
    
    CreateTexture(0, 32, 32)
    StartDrawing(TextureOutput(0))
      Box(0, 0, 32, 32 ,RGB(255,0,0))
    StopDrawing()
      
    CreateMaterial(0, TextureID(0))
    CreatePlane(0,600,600,TileCountX,TileCountZ,1,1)
    CreateEntity(0, MeshID(0), MaterialID(0),0,-30,0)
   
    CreateCamera(0, 0,0,100,100)
    MoveCamera(0, 0, 5, 30)
    CameraLookAt(0, 0, 5, 0)
    CameraBackColor(0, RGB(20, 0, 0))
    
    CreateLight(0, RGB(200,200,200), 900, 2000, 0)
    ReleaseMouse(1)
    
    Repeat
      If ExamineKeyboard()
      EndIf
      
      RenderWorld()
      FlipBuffers()

    Until WindowEvent() = #PB_Event_CloseWindow Or KeyboardPushed(#PB_Key_Escape)
    
  EndIf
EndIf

End
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: CreatePlane Bug?

Post by Comtois »

TileCountX*TileCountZ should be <65535 (16 bits for index).
this work

Code: Select all

TileCountX=5600
TileCountZ=10
Please correct my english
http://purebasic.developpez.com/
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: CreatePlane Bug?

Post by Samuel »

I forgot about that limit on meshes. To solve my problem I'll just create a second plane next to the first one. Thanks!
Post Reply