[Implemented] Sprite3D not freed correctly?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

[Implemented] Sprite3D not freed correctly?

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Where does it say that they are freed automatically ?
quidquid Latine dictum sit altum videtur
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

These are different objects, you have to free them separatly.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Post Reply