Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / hud lock image to camera

Author
Message
Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 2nd Mar 2008 23:08
been asked a million times as i found the posts on search, but none of them had any code, and the codebase doesnt have anything either.

can someone just post a tiny snippit?

im trying to lock a 3d plain textured with an image to the camera etc but no luck as of yet.

will keep trying but if someones got a nice little example of how to lock the image on screen - i dont mind if its a 2d sprite or a 3d plain - that would be nice.

i dont have any worries about making the inputs for the hud as it seems quite easy with \"create bitmap\"

thankyou please,
Paul

Paul
Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 2nd Mar 2008 23:56
Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 3rd Mar 2008 01:09
excellent! now why can i never find these threads

Paul
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 8th Mar 2008 03:32 Edited at: 8th Mar 2008 03:33
OR

I spotted a command in the help file that would do the trick for a hud. You might have to make a separate image for each resolution that you might have to display, but it seems to work pretty good.



The last 1 on the paste image command tells it to make all pixels that are rgb(0,0,0) transparent.


It's a big universe, and they are out there somewhere.
Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 9th Mar 2008 23:05
well i've blown all my hud code away after several hours of messing about and getting nowhere near fast enough or nice enough looking for me.

I've ended up using:

load image.
paste image.

combined with the transparency flag on paste image, and exporting my hud as a png with alpha channels.

Works like a dream - why did i even both trying "lock image to camera", - i just paste my image each program cycle/loop.

Paul
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 10th Mar 2008 00:45
Glad I could help. I'm just now hitting that part of development so I'll let you know if I find any other information thats useful for this.


It's a big universe, and they are out there somewhere.
Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 10th Mar 2008 10:00
only other thing is to make an image on the fly with create bitmap but im not sure about how to get the transparency just right on bitmaps (probably end up texturing a plain with it then set object trans..)

Paul
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Mar 2008 11:07
It's worth getting to grips with using plains for a HUD. The ability to make better eye-candy is far greater. For example, you can rotate (on the X and Y axis as well as Z), scale and use shaders. They also tend to be faster than sprites or pasting.
Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 16th Mar 2008 21:10
what do you mean by rotating them on x y and z? why would i want to do that with a hud design? just wondering what you had in mind?

Paul
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 16th Mar 2008 22:54
By using textured plains you are manipulating 3D objects, which if you do it right can give you a more 3D look and feel to your HUD.

Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 18th Mar 2008 10:03
oh i see what you mean!

well im happy with a nice 2d feel in this game but i suppose it may be useful in future, thanks

Paul
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Mar 2008 15:47
One other benefit to using object not mentioned is that they will automatically stretch to the same relative scale if you change resolution.

i.e. If your object runs halfway across the screen, it will do so no matter which resolution you use, while pasting the image will cause it to draw a specific number of pixels across and will take up a different proportion of the display when you change resolution.

Login to post a reply

Server time is: 2024-11-15 16:14:10
Your offset time is: 2024-11-15 16:14:10