Sprite problem

Blitz3D Forums/Blitz3D Beginners Area/Sprite problem

AbbaRue(Posted 2004) [#1]
I copied the screen to an imagebuffer.
Now how do I turn that imagebuffer into a sprite, so I can use it as a backdrop.

gfxBlank=CreateImage (1024,768)
CopyRect 0,0,1024,768,0,0,FrontBuffer(),ImageBuffer(gfxBlank)

The screen is now in the ImageBuffer, but I can't use it.

If I use the following.
CopyRect 0,0,1024,768,0,0,ImageBuffer(gfxBlank),FrontBuffer()

It is overwritten by the BackBuffer on the next frame.
So it needs to be made into a sprite, so it stays on the screen in the background.


Snarty(Posted 2004) [#2]
DrawBlock gfxBlank,0,0


Who was John Galt?(Posted 2004) [#3]
@Abbarue - generally you draw everything including the background to the buffer each loop.

@Snarty - How's Propixel animation stuff coming along? If you need any testers.......


Snarty(Posted 2004) [#4]
RAM

Not bad, working on the UI for it currently, I've already sketched out the design, and have the initial tool set lined up. At the moment I'm creating the new icons needed for the animation tools. :)


Who was John Galt?(Posted 2004) [#5]
Good stuff snarty - I'll be needing this, so don't stand here chatting all day, snap to it man ; )


AbbaRue(Posted 2004) [#6]
I couldn't get DrawBlock gfxBlank,0,0
to work for me but:
MagicalTux mensioned the following command.
"Disable clear screen on render via CameraClsMode"
I didn't know about it. Setting the Camera cls mode allows one to draw over one screen buffer with another,
without erasing the first. That worked, it allowed 2 buffers to be displayed at once, one over the other.

But none of this answered my question.
I wanted to know if one could convert an imagebuffer into a sprite, without saving the image and reloading it as a sprite.
I guess Blitz3D just doesn't have that functionality. The only way to get a sprite is to load it from a file.
The code would be quite simple, just convert an images handle into a sprite handle, should do it.


Snarty(Posted 2004) [#7]
My 3D is rusty to say the least, but don't you attach a Texture to a sprite?

Create the sprite, create the texture, attach the texture to the sprite, copy the rect to the texture buffer.


Rob Farley(Posted 2004) [#8]
thingy=createsprite()
entitytexture thingy,texture

The texture could be created by using createtexture(x,y)

Then copyrect the image to the texture.


Ross C(Posted 2004) [#9]
Yeah, no need to create an image. Just create a sprite :)