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.

DarkBASIC Professional Discussion / Drawing off-screen

Author
Message
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 5th Apr 2012 16:57 Edited at: 6th Apr 2012 13:36
Hi all, I'm wanting to draw some things off-screen between syncs using PASTE SPRITE, so that it doesn't appear on-screen when it happens. My original thoughts were that it should go something like this:



In theory, I should only see the spinning cube on the screen, and never see the circle... But that doesn't happen.

Can anyone tell me why this doesn't work? And - even better - let me know how I COULD make it work?

Thanks in advance!


TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Apr 2012 17:49
I think that's because you used SPRITE 1, 0, 0, 1 at the very top, which will make DBP draw the sprite to bitmap 0 at every sync. Try paste image instead, something like this:



TheComet

CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 5th Apr 2012 18:08 Edited at: 5th Apr 2012 18:09
Bit of a facepalm moment... Let me see if that fixes it...


CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 5th Apr 2012 18:22
Hmm. No, it still flashes up. It works fine in that demo I put up, but in my full program it doesn't work...

I'm using Evolved's advanced lighting, and it only stopped working once I switched to that. I imagine they're using all of the bitmaps, perhaps?


CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 6th Apr 2012 11:34
No help on this one? Anyone else tried drawing invisibly between syncs while using shaders?


zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 6th Apr 2012 12:07 Edited at: 6th Apr 2012 12:08
Hmm... running TheComet's code worked fine. Perhaps Sprites always draw to the screen no matter what bitmap it's using?

You could just use "HIDE SPRITE spritenum" after you've drawn it so it doesn't show up:


Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 6th Apr 2012 13:36
Yeah, I've done that, and they still show up.

I think it's to do with using shaders.


Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th Apr 2012 13:41
Can't you change your sprites to plains?

James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 6th Apr 2012 14:13
Quote: "In theory, I should only see the spinning cube on the screen, and never see the circle... But that doesn't happen"


Oddly I do not get those results, I get just a spinning cube
Am using U7.5 win 7
Also I put your code in latest adv lighting demo, works fine too for me
Perhaps the answer isnt in the code, maybe the update version?
zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 6th Apr 2012 14:25
Could you possibly paste or draw the sprite at a negative position? E.g. PASTE IMAGE 1, -500,-500
Not sure. Can't test as I'm not at my computer.

Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 6th Apr 2012 16:48
Hmm... Can you use GET IMAGE from a negative screenspace?


zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 6th Apr 2012 23:17
I don't think so, but you might try to move it to positive screen space, get the image, then move it back to a negative screenspace before you sync.

Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th Apr 2012 13:38
Quote: "Oddly I do not get those results, I get just a spinning cube"


Same here (Vista 64 bit). The code in the first post works fine here - i.e. no circle.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 7th Apr 2012 15:32 Edited at: 7th Apr 2012 15:34
Maybe the Graphic card is set to sync too often. Some sort of 'Force Sync ignore program settings'

CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 8th Apr 2012 11:50
I thought that happened as soon as you used "SYNC ON"? Doesn't that force the program to SYNC the screen only when you tell it to?


Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Apr 2012 14:51
Forgot to mention that I'm using U7.7RC7. Which update are you using?
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 8th Apr 2012 15:26
The same

It's just not working for me, so I decided to do everything that I was doing in memory using arrays. Trying to draw between syncs is a bit of a dirty hack anyway, I guess


Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 8th Apr 2012 15:30 Edited at: 8th Apr 2012 15:33
Quote: "I thought that happened as soon as you used "SYNC ON"? Doesn't that force the program to SYNC the screen only when you tell it to?"


The graphic card can ignore sync on, and sync all of the time. It would be in the graphic card settings. You usually get a lot of tearing. It has a name something like sync always.

CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 8th Apr 2012 15:59
Hmm... Can't find anything in the help about it... I've simulated it all in memory now, though. Thank you for the help


Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 8th Apr 2012 18:42
Quote: "Hmm... Can't find anything in the help about it... I've simulated it all in memory now, though. Thank you for the help "


I wouldn't ignore an error in your setup, it may crop up in another way. If everybody elses graphic cards are doing something different to yours you need to find out what it is.

CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 9th Apr 2012 06:48
The error was with being able to paste an image. Now that I'm doing it in memory, there is no error.


Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 10th Apr 2012 02:12
Here's a possible work around.

Use Get Image to copy the area under the image.
Then paste the image.
Then when you are done what ever you are doing, paste the background back.

At least it works.

CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 10th Apr 2012 03:10
A little bit too Rube Goldberg for my tastes, as it would use up extra cycles to do that and I'm aiming for efficiency. But like I said, it's been done in memory now and works well.


Login to post a reply

Server time is: 2026-07-09 22:48:32
Your offset time is: 2026-07-09 22:48:32