Page 1 of 1

Strange sprite3d problem

Posted: Sun Apr 30, 2006 11:40 am
by nessie
I am trying to display a 3d Sprite but when it displays, there seems to be some corruption in the sprite. But if I just display a normal sprite it displays fine. Am I doing something wrong?

Code: Select all

If InitSprite() = 0 Or InitKeyboard() = 0 Or InitSprite3D() = 0 
  MessageRequester("Error", "Can't open DirectX 7 Or later", 0)
  End
EndIf
UsePNGImageDecoder()
InitMouse()
OpenScreen(800,600,32,"test")
LoadSprite(49,"c:\test.png",#PB_Sprite_Texture)
CreateSprite3D(49,49)
Repeat 
Delay(1)
    ExamineKeyboard()
  Gosub drawscreen

Until KeyboardPushed(#PB_Key_Escape)
End 

;- Draw Screen
drawscreen:
ClearScreen(RGB(0,50,128))
Start3D()
DisplaySprite3D(49,0,0)
Stop3D()
FlipBuffers()
Return 

here is the graphic I used

http://www.thequizgrid.co.uk/test.png

Posted: Sun Apr 30, 2006 12:14 pm
by netmaestro
PB Help Docs wrote:The texture is in fact a regular sprite loaded by LoadSprite() or CatchSprite() or created by CreateSprite() using the #PB_Sprite_Texture mode. The texture must be a square of one of the following dimensions: 16*16, 32*32, 64*64, 128*128 or 256*256. Other sizes may work on some specific cards, but not all.
Also, you can give Sprite3DQuality(1) a try, see if that helps. For PNGs with alphachannel information in them, you will also want to specify the #PB_Sprite_AlphaBlending flag when creating the sprite.

Posted: Sun Apr 30, 2006 3:05 pm
by nessie
Sprite3DQuality(1) worked a treat, I can't belive i missed that. Thanks for the help.

:D