I have taken the code snippet for adding 3d nameplates above a player's head and modified it for my program. Here is the source/modified code: (This compilable; test it out)
Sync On : sync rate 60
Make Object Sphere 1,12
Color Object 1,16711680
Position Object 1,500,6,500
Position Camera 500,10,450
do
sync
if returnkey()=1 then goto duh:
loop
start:
Do
YRotate Object 1,WrapValue(Object Angle Y(1)+Rnd(2))
Move Object 1,3
Position Object 2,Object Position X(1),Object Position Y(1)+10,Object Position Z(1)
Point Object 2,Camera Position X(),Camera Position Y(),Camera Position Z()
Point Camera Object Position X(1),Object Position Y(1),Object Position Z(1)
Sync
Loop
duh:
Name$="Player1"
q = 1
z = 2
Create Bitmap q,800,600
Print Name$
LabelWid=Text Width(Name$)
Get Image q,0,0,LabelWid,16
Delete Bitmap q
Make Object Plain z,LabelWid,16
Texture Object z,q
SET OBJECT z,1,1,0,0,0
yrotate object z, 0
Fix Object Pivot z
goto start:
I took that code and made it into a function for my real program:
function makenameplate(Name$)
Name$ = "Player1"
q = findnextimage()
z = findnextobject()
Create Bitmap q,800,600
Print Name$
LabelWid=Text Width(Name$)
Get Image q,0,0,LabelWid,16
Delete Bitmap q
Make Object Plain z,LabelWid,16
Texture Object z,q
SET OBJECT z,1,0,0,0,0
yrotate object z, 0
Fix Object Pivot z
endfunction z
When that runs in my program everything works except for that the image that is taken from the "create bitmap" is completely black.
That code it just about copy paste from the code I have posted at the top. Why isn't this working?
Heres the outcome of the program:
http://img822.imageshack.us/i/fpswrong.png/
Ventures of the worlds around us are only limited by imagination.