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 / Why is this running at 30 fps not matter what? (DBPro/Memblocks)

Author
Message
NeilF
18
Years of Service
User Offline
Joined: 2nd Aug 2006
Location:
Posted: 20th Aug 2006 22:03
I'm doing some work with memblocks in order to fast pixel related graphics...

No matter what, this code runs at 30fps? What have I missed?

Thanks!

NeilF
18
Years of Service
User Offline
Joined: 2nd Aug 2006
Location:
Posted: 22nd Aug 2006 11:17
Anyone? I've done a couple of things like this and they're all sync'ing to 30fps no matter what I define

Asus P4PE | P4@3.22(533) | 2G PC3200 | ATI800Pro/XT@570/570 | Audigy2
MatrixOrbital MX422 | XP Pro | 120Gb Maxtor Plus9IDE | 200Gb Barracuda.9Sata
FROGGIE!
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: in front of my computer
Posted: 22nd Aug 2006 13:08 Edited at: 22nd Aug 2006 13:08
it runs at 49 fps on my computer. there are 2 things which could do this:

it may be that your computer is just too slow to run it at 50 fps, but loking at your stats i dont think thats the case, so check that theres no other apps running which could cause the computer to slow down.

It could also be because the sync rate command isnt a very accurate way of setting the fps, theres a tutorial for using timer based sync rates in the july/august 2005 (cant remember which) newsletter, it basically just sets the sync rate to 0 and then uses timers to slow down loops according to the fps.

Also have you tried setting the sync rate to 0, this will help to work out if its just the sync rate command being inaccurate.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Aug 2006 15:27
Memblocks are useful. Memblocks are great. But they are not the best way to draw a thousand dots at random to the screen.

Get rid of the memblocks, use LOCK PIXELS/UNLOCK PIXELS and draw each dot usnig the dot command.

The code in the following link draws 3000 dots per frame over twice as fast as using a memblock, and that's on a P3/850 with a mobile graphics card : http://www.thegamecreators.com/?m=codebase_view_code&i=ca1aae16eed1bbd1dc358dfb1394f9f7

NeilF
18
Years of Service
User Offline
Joined: 2nd Aug 2006
Location:
Posted: 22nd Aug 2006 16:04
Quote: "Memblocks are useful. Memblocks are great. But they are not the best way to draw a thousand dots at random to the screen.

Get rid of the memblocks, use LOCK PIXELS/UNLOCK PIXELS and draw each dot usnig the dot command.

The code in the following link draws 3000 dots per frame over twice as fast as using a memblock, and that's on a P3/850 with a mobile graphics card : http://www.thegamecreators.com/?m=codebase_view_code&i=ca1aae16eed1bbd1dc358dfb1394f9f7"


Oh! I was recommended to use memblocks because "dot" was so slow...

So simply locking/unlocking it is the key (& is faster than memblocks) - That's a bit annoying as I spent a fair amount of time learning memblocks for ploting etc

Thanks...


Asus P4PE | P4@3.22(533) | 2G PC3200 | ATI800Pro/XT@570/570 | Audigy2
MatrixOrbital MX422 | XP Pro | 120Gb Maxtor Plus9IDE | 200Gb Barracuda.9Sata
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Aug 2006 16:12
Well think about it a bit. With the dots, you are updating 4000 bytes (1000*4) of information. With memblocks, you are updating 1228800 bytes (640*480*4)

Although there are economies in that updates will be faster when updating a single big area of memory, it's not big enough to counter the sheer volume of information being sent when you refresh the whole display for 1000 dots.

If you are doing a lot more updates to your display than that, then you might find it faster to use a memblocks, but you'll need to experiment to find the break-even point.

Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 22nd Aug 2006 20:44
Quote: "That's a bit annoying as I spent a fair amount of time learning memblocks for ploting etc "


Well, now you know how to use them, don't you? Even if it was not the best way to do this project, you could have use of the knolage about memblocks for projects in the future.
NeilF
18
Years of Service
User Offline
Joined: 2nd Aug 2006
Location:
Posted: 22nd Aug 2006 21:51
Quote: "Well think about it a bit. With the dots, you are updating 4000 bytes (1000*4) of information. With memblocks, you are updating 1228800 bytes (640*480*4)

Although there are economies in that updates will be faster when updating a single big area of memory, it's not big enough to counter the sheer volume of information being sent when you refresh the whole display for 1000 dots."


With my current coding I replaced the memblock coding to instead just use a DOT.

With 100,000 pixels being plotted, my frame rate went up from 13fps to.... wait for it... 14fps


Asus P4PE | P4@3.22(533) | 2G PC3200 | ATI800Pro/XT@570/570 | Audigy2
MatrixOrbital MX422 | XP Pro | 120Gb Maxtor Plus9IDE | 200Gb Barracuda.9Sata
NeilF
18
Years of Service
User Offline
Joined: 2nd Aug 2006
Location:
Posted: 22nd Aug 2006 21:53
ps: Still get tops of 30fps! Even with just ONE pixel being plotted!


Asus P4PE | P4@3.22(533) | 2G PC3200 | ATI800Pro/XT@570/570 | Audigy2
MatrixOrbital MX422 | XP Pro | 120Gb Maxtor Plus9IDE | 200Gb Barracuda.9Sata
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Aug 2006 15:56
Quote: "With 100,000 pixels being plotted"


So you are filling a third of the screen with dots ... do you expect that to be fast? Instead of telling us the solution and what the problems are, maybe you should tell us what you are trying to achieve.

Quote: "ps: Still get tops of 30fps! Even with just ONE pixel being plotted!"


Then *you* are doing something in your code. I can't think of one way to get code that slow without setting the sync rate to 30. Post both the code and your project, and we can take a look.

Login to post a reply

Server time is: 2024-09-25 07:24:15
Your offset time is: 2024-09-25 07:24:15