Image and DirectX7/DirectX9/OpenGL inconsistency
Posted: Tue Feb 28, 2012 12:14 pm
Try this code with the different subsystems : different results. Only DirectX7 is giving the good one.
Added by fred (updated 5.20+ code):
Code: Select all
InitSprite()
InitSprite3D()
Window = OpenWindow(#PB_Any, 0, 0, 400, 400, "Test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(Window), 0, 0, 400, 400, 1, 0, 0)
;An image
CreateImage(0, 64, 64, 32|#PB_Image_Transparent)
StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0, 0, 64, 64, RGBA(0, 0, 0, 0))
DrawingMode(#PB_2DDrawing_Gradient|#PB_2DDrawing_AllChannels)
BackColor(RGBA($FF, $FF, $FF, $FF))
FrontColor(RGBA(0, 0, 0, 0))
CircularGradient(32, 32, 31)
Circle(32, 32, 31)
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0, 0, 20, 20, RGBA($FF, $FF, $FF, 0))
StopDrawing()
;The sprite from the image
CreateSprite(0, 64, 64, #PB_Sprite_Texture|#PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(0))
DrawAlphaImage(ImageID(0), 0, 0)
StopDrawing()
CreateSprite3D(0, 0)
;The sprite from the screen from the image
StartDrawing(ScreenOutput())
DrawAlphaImage(ImageID(0), 0, 0)
StopDrawing()
GrabSprite(1, 0, 0, 64, 64, #PB_Sprite_Texture|#PB_Sprite_AlphaBlending)
CreateSprite3D(1, 1)
Repeat
eventID = WaitWindowEvent(1)
ClearScreen(RGB(100,100,100))
StartDrawing(ScreenOutput())
DrawAlphaImage(ImageID(0), 0, 0)
StopDrawing()
Start3D()
DisplaySprite3D(0, 100, 0)
DisplaySprite3D(1, 200, 0)
Stop3D()
FlipBuffers()
Until eventID = #PB_Event_CloseWindow
Code: Select all
InitSprite()
InitSprite()
Window = OpenWindow(#PB_Any, 0, 0, 400, 400, "Test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(Window), 0, 0, 400, 400, 1, 0, 0)
;An image
CreateImage(0, 64, 64, 32, #PB_Image_Transparent)
StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0, 0, 64, 64, RGBA(0, 0, 0, 0))
DrawingMode(#PB_2DDrawing_Gradient|#PB_2DDrawing_AllChannels)
BackColor(RGBA($FF, $FF, $FF, $FF))
FrontColor(RGBA(0, 0, 0, 0))
CircularGradient(32, 32, 31)
Circle(32, 32, 31)
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0, 0, 20, 20, RGBA($FF, $FF, $FF, 0))
StopDrawing()
;The sprite from the image
CreateSprite(0, 64, 64, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(0))
DrawAlphaImage(ImageID(0), 0, 0)
StopDrawing()
;The sprite from the screen from the image
StartDrawing(ScreenOutput())
DrawAlphaImage(ImageID(0), 0, 0)
StopDrawing()
GrabSprite(1, 0, 0, 64, 64, #PB_Sprite_AlphaBlending)
Repeat
eventID = WaitWindowEvent(1)
ClearScreen(RGB(100,100,100))
StartDrawing(ScreenOutput())
DrawAlphaImage(ImageID(0), 0, 0)
StopDrawing()
DisplayTransparentSprite(0, 100, 0)
DisplayTransparentSprite(1, 200, 0)
FlipBuffers()
Until eventID = #PB_Event_CloseWindow