Page 1 of 1

[Implemented] Sprite3D not freed correctly?

Posted: Mon Jun 09, 2008 1:30 pm
by nco2k
seems like CloseScreen() doesnt free 3d sprites correctly? the 3d sprite is 'destroyed' (white box) but you can still display it:

Code: Select all

If InitSprite() And InitSprite3D() And OpenWindow(0, 0, 0, 800, 600, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0), 0, 0, 0)
  If CreateSprite(0, 128, 128, #PB_Sprite_Texture) And CreateSprite3D(0, 0)
    
    Debug "Sprite3D: "+Str(IsSprite3D(0))
    Debug "Sprite2D: "+Str(IsSprite(0))
    Debug ""
    
    CloseScreen()
    
    Debug "Sprite3D: "+Str(IsSprite3D(0))+" <-- ?!"
    Debug "Sprite2D: "+Str(IsSprite(0))
    Debug ""
    
    If OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0), 0, 0, 0)
      Repeat
        ClearScreen(0)
        If Start3D()
          DisplaySprite3D(0, 100, 100)
          Stop3D()
        EndIf
        FlipBuffers(0)
      Until WaitWindowEvent(25) = #PB_Event_CloseWindow
    EndIf
    
  EndIf
EndIf : End
DX7 & OGL: you can display the destroyed 3d sprite.
DX9: ima at line 18, but IsSprite3D() returns <> 0.

c ya,
nco2k

Posted: Mon Jun 09, 2008 4:32 pm
by freak
Where does it say that they are freed automatically ?

Posted: Mon Jun 09, 2008 5:12 pm
by nco2k
where does it say that they arent freed automatically? :)

since 2d sprites are essential for 3d sprites and all 2d sprites are freed automatically when closing the screen, where is the point in keeping an invalid 3d sprite, after it has lost its source? :?

c ya,
nco2k

Posted: Tue Jun 10, 2008 6:22 pm
by Fred
These are different objects, you have to free them separatly.

Posted: Tue Jun 10, 2008 9:40 pm
by nco2k
sorry, but i really dont see any valid reason, why pb shouldnt do this automatically aswell...

when closing a screen, everything related to that screen should be freed imho. pb is a clean language, so why making an exception here and keeping such data garbage? where is the point in having a IsSprite3D() when it returns a broken sprite? :?

ps: feel free to move this to feature requests then.

c ya,
nco2k