It is currently Fri May 24, 2013 3:32 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [PB4.0 final]CreateSprite(... #PB_Sprite_Alpha) works not...
PostPosted: Fri May 12, 2006 6:51 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1300
Location: Germany: 49º 45' 21.96" N 10º 38' 4.04" E
CreateSprite(0,10,10, #PB_Sprite_Alpha) returns '0'´
All others working correct.

Code:
InitSprite()

hWnd = OpenWindow(0, 0, 0,800,600,"#PB_Sprite_Alpha - Test")
OpenWindowedScreen(hWnd,0,0,800,600,0,0,0)


Debug CreateSprite(0,10,10, #PB_Sprite_Alpha)
Debug CreateSprite(1,10,10, #PB_Sprite_Memory)
Debug CreateSprite(2,10,10, #PB_Sprite_Texture)
Debug CreateSprite(3,10,10)
Debug CreateSprite(4,10,10,0)

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
http://chipmunk4purebasic.freeforums.org/index.php


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 12, 2006 11:29 am 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 6465
It's not something you want to do anyway as the DisplayAlphaSprite() command docs strongly suggest StartSpecialFX() to speed the operation up, for which #PB_Sprite_Memory is a requirement. Retry your test with:

Code:
Debug CreateSprite(0,10,10, #PB_Sprite_Alpha|#PB_Sprite_Memory)

and see if it succeeds. If so, should be no problem imho. (assuming I'm not out to lunch)

_________________
Veni, vidi, vici.


Top
 Profile  
 
 Post subject: Re: [PB4.0 final]CreateSprite(... #PB_Sprite_Alpha) works no
PostPosted: Mon May 07, 2012 7:59 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jul 25, 2005 3:51 pm
Posts: 2401
Location: Utah, USA
CreateSprite(... #PB_Sprite_AlphaBlending) seems to be working fine in PB 4.61b2.

Tested under XP Sp3 x86 using both DirectX7 and DirectX9 using:
Code:
InitSprite()

OpenWindow(0, 0, 0,800,600,"#PB_Sprite_Alpha - Test")
OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0)


Debug CreateSprite(0,10,10, #PB_Sprite_AlphaBlending)
Debug CreateSprite(1,10,10, #PB_Sprite_Memory)
Debug CreateSprite(2,10,10, #PB_Sprite_Texture)
Debug CreateSprite(3,10,10)
Debug CreateSprite(4,10,10,0)

_________________
Image


Top
 Profile  
 
 Post subject: Re: [PB4.0 final]CreateSprite(... #PB_Sprite_Alpha) works no
PostPosted: Mon May 07, 2012 8:41 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 6465
Note that #PB_Sprite_Alpha and #PB_Sprite_Alphablending serve two completely different purposes.

Demivec wrote:
CreateSprite(... #PB_Sprite_AlphaBlending) seems to be working fine in PB 4.61b2.

Yes you're right it works; however it's not good for much because of a bug in drawing the alpha layer to a sprite.
This code is tested here working under Directx7 and fails under Directx9 and OpenGL:
Code:
InitSprite():InitSprite3D()
OpenWindow(0,0,0,320,240,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,128,128,0,0,0)
CreateSprite(0,128,128,#PB_Sprite_Texture|#PB_Sprite_AlphaBlending)
CreateImage(0,128,128,32|#PB_Image_Transparent)
StartDrawing(ImageOutput(0))
  DrawingMode(#PB_2DDrawing_AllChannels)
  Circle(64,64,40,RGBA(0,0,200,255))
StopDrawing()
StartDrawing(SpriteOutput(0))
  DrawAlphaImage(ImageID(0),0,0)
StopDrawing()
CreateSprite3D(0,0)
ImageGadget(0,128,0,128,128,ImageID(0))
quit=0
Repeat
  Repeat
    EventID = WindowEvent()
    If EventID = #PB_Event_CloseWindow
      quit=1
      Break
    EndIf
  Until EventID = 0
  ClearScreen(GetSysColor_(#COLOR_3DFACE))
  Start3D()
    DisplaySprite3D(0,0,0)
  Stop3D()
  FlipBuffers()
Until quit

Until it gets fixed the only good way to get an alpha layer onto a sprite is via LoadSprite or CatchSprite as drawing to it is currently bugged.

_________________
Veni, vidi, vici.


Top
 Profile  
 
 Post subject: Re: [PB4.0 final]CreateSprite(... #PB_Sprite_Alpha) works no
PostPosted: Tue May 08, 2012 6:41 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jul 25, 2005 3:51 pm
Posts: 2401
Location: Utah, USA
netmaestro wrote:
Note that #PB_Sprite_Alpha and #PB_Sprite_Alphablending serve two completely different purposes.


True they are different, but since the original example used #PB_Sprite_Alpha, which isn't used with CreateSprite() it had to be changed to the correct one.

netmaestro wrote:
Yes you're right it works; however it's not good for much because of a bug in drawing the alpha layer to a sprite.
This code is tested here working under Directx7 and fails under Directx9 and OpenGL:

netmaestro wrote:
Until it gets fixed the only good way to get an alpha layer onto a sprite is via LoadSprite or CatchSprite as drawing to it is currently bugged.


I appreciate the additional example and I agree that there are still other areas that can be improved. I was trying to stay focused and simply evaluate the issue being reported here to see if anything had been fixed with the progression of PureBasic from the time this was reported.

Apparently the original problem was probably mis-posted by using the wrong constant. Whatever the case, CreateSprite() functions in the situation that was originally referenced.

_________________
Image


Top
 Profile  
 
 Post subject: Re: [PB4.0 final]CreateSprite(... #PB_Sprite_Alpha) works no
PostPosted: Tue May 08, 2012 8:22 am 
Offline
User
User
User avatar

Joined: Thu Apr 07, 2011 1:14 pm
Posts: 90
Location: 3 arks
Hi

In windows Xp sp2 (x86) - Pb4.61b2, the first CreateSprite() returns 0, with directX 9 :

Code:
Debug CreateSprite(0,10,10, #PB_Sprite_AlphaBlending)


The other lines are ok (with directX9).

With DirectX 7, all lines are ok.

CG nvidia Geforce 9800 GTX+


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye