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 / One sprite and it dies (DB Pro)

Author
Message
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Sep 2003 03:45
As soon as I put one sprite on screen in DB Pro, the FPS drops from 33 to 5. This is the start of my HUD, 3D objects present on screen as well. Any ideas?



Intel 1Ghz
Geforce 2
DirectX 9
DB Pro Alienware demo.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Sep 2003 10:00
Yep. If you are reading from the video memory (GET IMAGE) within your loop, that may kill your frame-rate.

Also by default, sprites are save the background they overwrite. Use SET SPRITE 101,0,1 to switch this off.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Sep 2003 10:54
The code above is the initialisation of the sprite, it's not in the main loop. I have commented out everything related to this sprite in the main loop, and it's still running like a dog!

It's my Speed indicator. Any other recommeneded techniques for writing the HUD, bearing in mind this graphic ramps up and down, so it neds to be dynamic?

Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 15th Sep 2003 11:23 Edited at: 15th Sep 2003 11:29
you could use a plain and write to a bitmap any data, images etc, then copy the bitmap into your texture image, should be faster than the results you are getting, I use textured plains a lot for title screens, menus, and huds, that way you just keep menus/titles close to the camera to hide the scene loading then remove it when you are done, and hud components can slide in/out or spin off screen/whatever easily, works for me.

Mentor.

ps: why the screen width *0.7 and same kind of factor for the height?, thats should not be needed AFAIK, the screen is x pixels wide, so thats all the sprite needs to be, unless this is some patch to compensate for another unwanted DB weirdness, but scaling down?, maybe its cos you have a sprite that isnt a power of 2 wide/high, just a last minute thought.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Sep 2003 14:57 Edited at: 15th Sep 2003 14:58
Maybe I need to RTFM.

The ScreenWidth and ScreenHeight calcs are for the position. As I don't know the users specified resolution, I need to specify the position in relative terms rather than absolute.

Question...How do I set the original size of the sprite? I've just realised by your question that when you create a sprite, there are no size parameters. Maybe I have an oversized sprite and I haven't realised it.

Quote: "I use textured plains a lot for title screens, menus, and huds"

I used to use the 3D Sprite code in DB Classic (make plain, texture and lock to screen), but I couldn't get it to work in Pro. I decided to have a go with sprites because AFAIK they are 3D plain objects.

When I switched the Backsave parameter to 0, the frame rate shot back up again. Trouble is, the texture corrupted, and became black and white blurs.

Guess I'll have to keep dabbling until I get it right.

Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 15th Sep 2003 15:25
sprites are the pixel size of the image, if the image is 1024 pixels wide then so is the sprite, remember when you bring a plain close to the camera to use as a hud to set the near camera range to something less than the distance of the plain from the camera, at the moment (on my system at least since p5) you can`t have a transparent hud this way and have transparent objects in the scene unless you ghost everything, otherwise the other objects go solid instead of transparent when seen through the hud, guess this will get fixed in p5.1, cheers.

Mentor.

Login to post a reply

Server time is: 2024-09-21 01:16:21
Your offset time is: 2024-09-21 01:16:21