PureBasic Forum
https://www.purebasic.fr/english/

5.43 - TransformSprite()
https://www.purebasic.fr/english/viewtopic.php?f=4&t=66749
Page 1 of 1

Author:  J. Baker [ Tue Oct 11, 2016 9:21 pm ]
Post subject:  5.43 - TransformSprite()

This works on my old graphics card but not on my Nvidia GT 630 under DirectX. Using TransformSprite() keeps the sprite from displaying. Under "OpenGL" it will display but of course the Z values don't do anything.

Code:
InitSprite()

If OpenWindow(0, 0, 0, 640, 480, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   OpenWindowedScreen(WindowID(0), 0, 0, 640, 480, 0, 0, 0)
   
   ;LoadSprite(0, #PB_Compiler_Home + "examples/sources/Data/PureBasicLogo.bmp")
   
   CreateSprite(1, 64, 64)
   StartDrawing(SpriteOutput(1))
     Box(0, 0, 64, 64, $ffffff)
   StopDrawing()
   
Repeat

  ClearScreen(0)
 
  TransformSprite(1,    0, 0, 0,    64, 0, 0,   64, 64,  0,     0, 64, 0)
  DisplaySprite(1, 0, 0)
   
  FlipBuffers()
   
Until WindowEvent() = #PB_Event_CloseWindow

EndIf

Author:  J. Baker [ Thu May 25, 2017 8:49 pm ]
Post subject:  Re: 5.43 - TransformSprite()

Can anyone else confirm this on their pc? Still does not work in PB 5.60.

Thanks! ;)

Author:  Mesa [ Fri May 26, 2017 8:14 am ]
Post subject:  Re: 5.43 - TransformSprite()

Yes, i've got tthe same problem with XPSP3 32b, pb 5.60 x86.

But it works if you set a non zero value on "Z":
Code:
InitSprite()

If OpenWindow(0, 0, 0, 640, 480, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
      OpenWindowedScreen(WindowID(0), 0, 0, 640, 480, 0, 0, 0)
      
      ;LoadSprite(0, #PB_Compiler_Home + "examples/sources/Data/PureBasicLogo.bmp")
      
      CreateSprite(1, 64, 64)
      StartDrawing(SpriteOutput(1))
         Box(0, 0, 64, 64, $ffffff)
      StopDrawing()
      
Repeat

   ClearScreen(0)
   
   TransformSprite(1,    0, 0, 1,    64, 0, 1,   64, 64,  1,     0, 64, 1)
;    TransformSprite(1,    0, 0,     64, 0,    64, 64,       0, 64) ; woks too
   DisplaySprite(1, 0, 0)
      
   FlipBuffers()
      
Until WindowEvent() = #PB_Event_CloseWindow

EndIf


Mesa.

Author:  J. Baker [ Fri May 26, 2017 1:42 pm ]
Post subject:  Re: 5.43 - TransformSprite()

Thanks Mesa! You are right. Under DirectX, the Z values must at least be 1. Not sure if this is the way Fred intended or if it's how newer graphics cards work? If so, problem solved.

Author:  J. Baker [ Wed Oct 09, 2019 3:55 pm ]
Post subject:  Re: 5.43 - TransformSprite()

Still an issue in v5.71.

I almost re-posted this issue but saw that I had this issue before. Drove me nuts for about five minutes. The debugger should alert if the Z values are not at least 1. Otherwise the sprite is hidden or not displayed.

Just a suggestion. ;)

Author:  Mesa [ Thu Oct 10, 2019 8:49 am ]
Post subject:  Re: 5.43 - TransformSprite()

it works with #PB_Ignore, but "TransformSprite(1, 0, 0, 64, 0, 64, 64, 0, 64)" is better.

Code:
InitSprite()

If OpenWindow(0, 0, 0, 640, 480, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  OpenWindowedScreen(WindowID(0), 0, 0, 640, 480, 0, 0, 0)
 
  ;LoadSprite(0, #PB_Compiler_Home + "examples/sources/Data/PureBasicLogo.bmp")
 
  CreateSprite(1, 64, 64)
  StartDrawing(SpriteOutput(1))
  Box(0, 0, 64, 64, $ffffff)
  StopDrawing()
 
  Repeat
   
    ClearScreen(0)
   
    TransformSprite(1,   0, 0, #PB_Ignore,   64, 0, #PB_Ignore,   64, 64,  #PB_Ignore,     0, 64, #PB_Ignore)
    ;    TransformSprite(1, 0, 0, 64, 0, 64, 64, 0, 64) ; works too
    DisplaySprite(1, 0, 0)
   
    FlipBuffers()
   
  Until WindowEvent() = #PB_Event_CloseWindow
 
EndIf


M.

Author:  J. Baker [ Thu Oct 10, 2019 1:19 pm ]
Post subject:  Re: 5.43 - TransformSprite()

Mesa wrote:
it works with #PB_Ignore, but "TransformSprite(1, 0, 0, 64, 0, 64, 64, 0, 64)" is better.

As you know, you need the Z values. Unless you are using solid colors. ;)

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/