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 / Program to view objects

Author
Message
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 18th Oct 2003 16:45
Hi,
im trying 2 write a program that lets u click a x or 3ds file in windows and it iopens a window and shows the model.
i reffered to my may post about opening files in gerneral and the told me to:

filetoload$=cl$()
load object filetoload$,1

but for some reason that dosnt work

please excuse my typing, imsick, itsvery erly in da morning, i cant sleep bcuzx i cant breath...

All help would be greatly appreciated

The rock has rolled!
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 18th Oct 2003 19:17
cl$() only returns what has been given as a command line parameter

You have to do some config work to get it work properly. Do you know how to create file associations?

I strongly suggest that you print out filetoload$ to the screen so you can see what you are trying to do.
--
TAZ
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 19th Oct 2003 18:35
How would i do that?

The rock has rolled!
Kentaree
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 19th Oct 2003 18:41
If you set the file association in windows to your file, whenever you click a file with the corresponding extension, your program will be loaded up as
yourfilename.exe model.x
model.x will be used as your entry into the cl$(), and so this should work. You might want to search Google on registry values you can change to associate your program with model files automatically.

I would be unstoppable if I could just get started...
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 19th Oct 2003 20:14
The fasest way to set a file association is to simply double click on the file. If none has been set, Windows will fire up a wizard so you can select a file.

But, if you need to edit and existing association, go to My Computer > Tools > Folder Options [The exact words may vary depending on your version of Windows, but the idea still holds true.]

This will bring up the Options dialogue box. One of the tabs should be file types. Clicking on that tab will bring up a list of extension and comments. I find that the easiest way to locate an extension is to click on the new button and type in the extension (X in this case) and hit OK. Windows will tell you if the extension is in use and by what.

From here Windows can vary significantly, under XP there is a change button for the quick and dirty association and there is an advanced button that brings up the new/edit/remove dialogue box. Here, you can add multiple file associations and set which one you want to be the default action when a file is double clicked on. The other associations are assessible via right clicking on the file. You have probably seen that right click menu a thousand times, this is one way to add entries to the menu.

Well that should point you in the right direction. Try to figure it out from there and give me a hollar if you get stuck.

BTW, have you added that print statement to your code yet? Learning to use milestone and debugging statements are essenetial if you want to see what your program is doing while it is running.
--
TAZ
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 19th Oct 2003 22:44
yes,
I did acessicate it, but it says "object does not exist" when I try to open it.

The rock has rolled!
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 20th Oct 2003 05:38 Edited at: 20th Oct 2003 07:21
And... what was the value of filetoload$ set to?

Do you see where I'm coming at here? You might have an absolute or relative path problem.

Or... perhaps the file name and path is surrounded by quotes which make it an invalid path? [hint, hint]
--
TAZ



You need more than the code above to make a good viewer, but it should get you past this hurdle.
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 20th Oct 2003 08:17 Edited at: 20th Oct 2003 08:18
I decide to say what the hey and run with the viewer idea in case you got sick of it.

Here's a complete minimal viewer with mouse rotation and pitch as well as wheel mouse zooming.



A funny thing about this code, it liked alien.x but bombed on alien.3ds. No idea why, it was a fatal error with no return data. Some other 3DS files worked just fine. Your mileage may vary with which DBP patch version and OS you're using.

Features you can add... The ability to turn lights on and off, maybe tweak ambient lighting, add a transparent reference plane or grid that runs through 0,0,0, add a scale 'ruler' and allow for setting scaling values on the fly so programmers know what values to use when they load the model in their games, etc.
--
TAZ
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 21st Oct 2003 04:46
Thanks,
I'll play with that code.

.....

Login to post a reply

Server time is: 2026-07-26 05:21:25
Your offset time is: 2026-07-26 05:21:25