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 / Question regarding spheres

Author
Message
strykerm
14
Years of Service
User Offline
Joined: 25th Aug 2010
Location:
Posted: 12th Dec 2011 02:37
Hi there ya'll. I've got a question regarding loading and using spheres. I'm working on a program that is using a sphere, and I've been able to get it to work fine. Figured out how to provide texture to the sphere, so its all good. I've even figured out how to make the sphere rotate slowly. The problem comes in when I try to load a bitmap and use it as a background. The picture loads, then the sphere rotates and it keeps switching back and forth. If I don't load the bitmap at all the sphere rotates smoothly. If I do, it keeps switching back and forth but never displaying both at the same time without flickering. How do I get the computer to display the sphere, allow it to keep rotating, and display the bitmap in the background at the same time? Here's the code I've been using so far to work from...

make object sphere 1,2
Position object 1,-1,.5,1
load image "\media\star.bmp",3
load image "\media\starflt_012.png",2
texture object 1,3
DO rem enters loop
XROTATE OBJECT 1,WRAPVALUE(OBJECT ANGLE X(1)+0.3)
paste image 2,0,0
position object 1,-1.5,1,1
YROTATE OBJECT 1,WRAPVALUE(OBJECT ANGLE Y(1)+0.01)
LOOP
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 12th Dec 2011 10:10
It's been a while since I've programmed anything 3D in DBP mixed with pasting images so I can't exactly remember how this is supposed to fold out but the first thing you could try is turning 'sync' on, setting a sync rate and then calling 'sync' in your loop. So like this:



strykerm
14
Years of Service
User Offline
Joined: 25th Aug 2010
Location:
Posted: 12th Dec 2011 11:16
I tried the code but it will display the bitmap but not the sphere
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Dec 2011 16:06
Not tested, but you need to set up the screen first.

sync on will enable the sync command. If you turn it off, it will sync after every command. If it's turned on, it'll only sync when you tell it to.

backdrop on will enable the backdrop. If you turn it off, everything will smear itself into the backdrop. If it's on, it won't.

draw to back will make sure all 2D operations are drawn behind 3D objects. The opposite of that command is draw to front.



TheComet

strykerm
14
Years of Service
User Offline
Joined: 25th Aug 2010
Location:
Posted: 12th Dec 2011 21:49
I just tested the code. As it was, the sphere would rotate on a solid black background. the bitmap image wouldn't display. But I changed one line.
I changed "BACKDROP ON" to "BACKDROP OFF" , just because I've never messed with using that code before, and it worked. the bitmap loads, and the sphere loads in the correct position, and rotates just like it should. Thanks ya'll for the help
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Dec 2011 02:28
Hi there. We can instead of loading a bitmap, load an image and texture backdrop. Here's an example.



Cheers.

I'm not a grumpy grandpa
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 13th Dec 2011 08:31
@chafari: The command TEXTURE BACKDROP doesn't compile on versions of DBPro that consider it "Obselete" (like mine). Crazy, huh? (and annoying, that command looked very useful when I started on DBPro. I never had the chance to use it *sulks*). Well I 'spose backwards compatibility in the world of microsoft-based PCs has never been much of a requirement, lol. (It's a conspiracy to push old-school coders out of the scene!)

@strykerm: If your compiler rejects chafari's code(I hope it won't), remove the line "TEXTURE BACKDROP 1" and place the following above MAKE OBJECT SPHERE:



Note, I rotated the backdrop (Object 999) to match it with the camera position. If your camera was at 0,0,[any number > 1) facing 0,0,0 you wouldn't rotate it. There are different ways to texture an object (see SET OBJECT TEXTURE). This technique will only work for environments where no rotation takes place. For a fully-3D "world" where you can freely move the camera, you may have to look into sky spheres or get really clever with primitives.

Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 13th Dec 2011 09:24
Quote: "The command TEXTURE BACKDROP doesn't compile on versions of DBPro that consider it "Obselete" (like mine)."

Which version are you using? It runs on mine which is U77RC7.

Quote: "For a fully-3D "world" where you can freely move the camera, you may have to look into sky spheres or get really clever with primitives."

I think you can actually create a sphere with a negative number like -10000 and then texture that. The texture will appear on the inside instead of the outside and so you've made yourself a nice quick skysphere.

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Dec 2011 14:26
Hi there guys!

Quote: "@chafari: The command TEXTURE BACKDROP doesn't compile on versions of DBPro that consider it "Obselete" (like mine). "


It was just an answer in how to put a background...I normally use an sphere like in this example.




Cheers.

I'm not a grumpy grandpa
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 13th Dec 2011 17:50 Edited at: 13th Dec 2011 17:51
Quote: " Which version are you using? It runs on mine which is U77RC7. "

The editor says its "Version 1.068", according to the file properties the compiler is v1.5. I have no idea how old that is but it must be more than a year as it was about October last year when a friend traded me his laptop and an external hdd for my desktop (I'm in the [lengthy] process of emigrating) and this DBPro was already installed. This brings me to my next point: I cannot update because I only had a cellular phone for internet back then. Since moving in with my relatives (It's sort of a halfway point. The story is very long) I have had internet access but very limited access. ISPs in South Africa are evil and intent on *expletive*ing you over. My relatives are on package number 1 with these people: http://www.saol.com/adsl1.php (a Cap is a monthly bandwidth limit btw)... I would love to upgrade my DBPro since the version I use requires me to use external dll calls just to get the user's native desktop res
*Sighs* I'll be in the UK by the year's end (papers are finally sorted) and then I'll have infinite bandwidth and it'll all be over. Yatta!

@Hodgey:
Quote: "I think you can actually create a sphere with a negative number like -10000 and then texture that. The texture will appear on the inside instead of the outside and so you've made yourself a nice quick skysphere. "

Just tried that. It does work. It would definitely be fine for the same type of scenario as texturing the backdrop. Nice quick-fix, "two thumbs up"!! (I'm sure that phrase is copyrighted, lol)

@chafari:
Nice theme, pretty skysphere! About the scrolling text, or more specifically the contents of said text... Uh,





... I pwomises evewy wone I will be upgwading befaw anyfing ewlse wen I getz toow UK...

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Dec 2011 19:42
Quote: "The editor says its "Version 1.068"



Hi nonZero. That's an old version ...three year or four, and TGC had decide to add this command again time ago . Nobody knows when can we find a command useful.

Quote: "
Nice theme, pretty skysphere! About the scrolling text, or more specifically the contents of said text... Uh, "


Don't wrorry...

Cheers.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2024-11-22 11:20:58
Your offset time is: 2024-11-22 11:20:58