I have a polygon. I can change its shape (distortion and size), that would set up an even rectangle for the image of the projector.
And I want to display this polygon rotating about its axis in the sprite.

Code: Select all
ClearScreen(#black)
StartDrawing ( SpriteOutput( polygon ) )
DisplayTransparentSprite( texture, 0, 0 ... )
StopDrawing()
TransformSprite ( Polygon, .... )
DisplayTransparentSprite( Polygon, .... )
Code: Select all
InitSprite():InitKeyboard()
OpenWindow(0,0,0,640,640,"Press ESC to exit...",#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,640,640)
CreateSprite(0, 256,256)
CreateSprite(1, 512,512)
StartDrawing(SpriteOutput(0))
DrawingMode(#PB_2DDrawing_Gradient)
BackColor($000099)
FrontColor($dd0000)
LinearGradient(0, 0, 0, 256)
Box(0,0,256,256)
StopDrawing()
; We want sprite 0 drawn on sprite 1, so step 1: Grab the drawing image
StartDrawing(SpriteOutput(0))
this = GrabDrawingImage(#PB_Any,0,0,256,256)
StopDrawing()
; Step 2: Draw the grabbed image to sprite 1:
StartDrawing(SpriteOutput(1))
Box(0,0,512,512,RGB(255,255,223))
DrawImage(ImageID(this),128,128)
StopDrawing()
Repeat
While WindowEvent():Wend
ClearScreen(0)
DisplaySprite(1, 60,60)
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
That approach doesn't look like it lets you make use of any of the features available to sprites, such as rotation, scaling, blending modes, etc.netmaestro wrote:GrabDrawingImage, a relatively new command (v4.4 iirc) is what you want:
It would if you then converted it to a 3D sprite!That approach doesn't look like it lets you make use of any of the features available to sprites, such as rotation, scaling, blending modes, etc.