How to Render on 2D Background Picture?

Blitz3D Forums/Blitz3D Beginners Area/How to Render on 2D Background Picture?

vircop(Posted 2010) [#1]
Hi,

i used LoadAnimMesh and Animate for my Title Screen to display an animated character. After some time that character starts to bend down, gets bored etc. Works all well so far - on a black background.

Now i wanted to render that character infront of a 2D picture that i load with "LoadImage". How do i do that? I always end up having the picture displayed but no animated character - or vice versa.

I basically need to know what should i put in the while / wend / UpdateWorld / RenderWorld Loop.

Using DrawImage before Flip doesn't work.

Thanks for any input


xtremegamr(Posted 2010) [#2]
Did you try creating a sprite, texturing it with your background, and then putting that behind your character?


Matty(Posted 2010) [#3]
Have a look at the documentation for the command "cameraclsmode", which you can disable clearing of the colour buffer, this way you can then draw your image and render over the top of it.


vircop(Posted 2010) [#4]
xtreme and matty, any code example for that?

Here's my loop so far:

While KeyHit(1)<>True

Current_Time_Title = MilliSecs() ; Store the current time.

If (Title_Stage = 1) Then
If ( Current_Time_Title - Current_Trigger ) > 0 Then
Animate vircop_mesh,0,.5,vircop_idle,7
Animate vircop_mesh,3,.5,VirCop_Duck2,7
Reset_Timer2
Update_Stage
End If
End If
If (Title_Stage = 2) Then
If ( Current_Time_Title - Current_Trigger ) > 0 Then
Animate vircop_mesh,0,.5,vircop_Duck2,7
Animate vircop_mesh,3,.5,VirCop_Duck3,7
Reset_Timer1
Update_Stage
End If
End If
If (Title_Stage = 3) Then
If ( Current_Time_Title - Current_Trigger ) > 0 Then
Animate vircop_mesh,0,.5,vircop_Duck3,7
Animate vircop_mesh,1,.5,VirCop_Idle,7
Reset_Timer2
Update_Stage
End If
End If

UpdateWorld
RenderWorld

Flip


As i said it works on a black background. Now all i need to do is getting that over a 2d picture.


vircop(Posted 2010) [#5]
Ok, it's working now. Screenshot: http://yfrog.com/5p83900048j
I used the Camera Cls together with:

UpdateWorld
Cls
DrawImage image,0,0
RenderWorld