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 Discussion / Fastest: 4 lines or one box?

Author
Message
Neil Young
21
Years of Service
User Offline
Joined: 6th Jan 2004
Location:
Posted: 28th Apr 2004 03:29
Which requires less processing: four lines or a box?

I want to have the outline of a box which four lines would accomplish, but would it be faster to just make a box with a black box inside it to simulate an outline? Which? Thanks.
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 28th Apr 2004 06:19
im guessing that the box command is just four lines...so about the same

Do you model? contact me: [email protected]
Arkheii
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: QC, Philippines
Posted: 28th Apr 2004 06:42
Err, I've peeked into some D3D code before... seems like you can draw a box with a single function, so I'm guessing that the box is faster.


@noobs: We don't give a damn if you haven't gone through puberty. So can you code or not?
gh0u1
21
Years of Service
User Offline
Joined: 24th Apr 2004
Location:
Posted: 28th Apr 2004 08:34
I'd say that in a normal case, a box would be faster. But the way it sounds, since you only want an outline, it would take a lot less processing power to produce 4 thin lines as opposed to 2 very large boxes.

Just a thought.
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 28th Apr 2004 09:34
I'm not sure if its the same, but in an old script language I used, it changed the color of the pixels (changing some bytes) of the buffer bitmap (double-buffering).

for two boxes that create an outline (size 300x300):

for a=1 to 300
for b=1 to 300
ink #FFFFFF
pix a,b
next b
next a
for a=2 to 299
for b=2 to 299
ink #000000
pix a,b
next b
next a

This is the code my old language used, its the same as:

ink rgb(255,255,255),rgb(255,255,255)
box 1,1,300,300
ink rgb(0,0,0),rgb(0,0,0)
box 2,2,299,299

We can calculate how many times he changes the color of the pixels:
1 to 300 = 300
1 to 300 = 300 x
----------------
.........90000 times

2 to 299 = 298
2 to 299 = 298 x
----------------
.........88804 times

90000 + 88804 = 178804 changes



For 4 lines (same result):

Line 1,1,1,300
line 1,1,300,1
line 300,1,1,300
line 1,300,300,300

again, the calculation:
300 + 300 + 300 + 300 = 1200 changes.


Im not sure if darkbasic is doing this, but it surely speed up things by using 4 lines instead of 2 boxes in that old script language

Quote: "
UPDATED

Amd 2800+ 1024mb pc3200 A7N8X - Deluxe Ati Radeon 9800PRO 256mb
"

Login to post a reply

Server time is: 2025-05-30 13:59:22
Your offset time is: 2025-05-30 13:59:22