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 / basic2d disappears after sync

Author
Message
fraktal
16
Years of Service
User Offline
Joined: 8th Jan 2008
Location:
Posted: 9th Jan 2008 00:43 Edited at: 9th Jan 2008 11:19
I'm trying to do some 2d drawing in what will be a 3d program. It appears that after you sync, you lose whatever you drew...
I know this is probably not the case if you don't set up a 3d environment (which I have - not shown). I tried drawing to a bitmap and then copying that to the screen, but the same thing happens.
Basically, I see a rows of lbocks chasing each other down the screen, when I want to see a picture slowly being built (ie, the previous blocks are retained). Any ideas?


BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Jan 2008 09:47
Anything using 2D drawing functions has to be redrawn every cycle. DB Pro's 2D drawing capabilities are quite slow. So you have 3 options:

1. Draw to a bitmap, and paste the bitmap to the screen each time

2. Draw to a bitmap, then convert the bitmap to a sprite which will retain the detail between SYNCs

3. Use Cloggy's D3D plugin, which is much faster at drawing.
fraktal
16
Years of Service
User Offline
Joined: 8th Jan 2008
Location:
Posted: 9th Jan 2008 11:25
Ah, okay.

But, the above code (which I know has some syntax errors, but you know what I mean) draws to a bitmap, and then pastes the bitmap. How come it doesn't work?

If I get rid of the sync in the middle then when I do sync the whole lot appears, but using it in the loop seems to remove the drawings from the bitmap, too.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Jan 2008 14:53
Only bitmap 0 is ever displayed. If you want to see something, that's where the results need to end up.

pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 9th Jan 2008 18:18
this bitmap demo

fraktal
16
Years of Service
User Offline
Joined: 8th Jan 2008
Location:
Posted: 12th Jan 2008 14:08
For some reason in my original problem I was drawing to an off-screen bitmap and then copying it to the screen, and it would revert the bitmap after each sync. I have implemented it in a different way now, so maybe it was a bug in my code.
Thanks for your help!

Login to post a reply

Server time is: 2024-09-27 10:37:37
Your offset time is: 2024-09-27 10:37:37