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 / I can't load the texture

Author
Message
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 15th Apr 2007 12:46 Edited at: 15th Apr 2007 12:47
I'm not sure why this won't load, do you guys have any suggestions as to what i'm doing wrong?




media is included, just download it.

Binary Coder
19
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Queensland, Australia
Posted: 15th Apr 2007 13:05
Is there a way that the first do-loop can enter the second?
I didn't see any gosubs/gotos

Sorry if this post is a waste of space mate!

Why buy a game when you can make one?
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 15th Apr 2007 13:26
i'm sure i could write in a subroutine. thanks binary

have a good day

zombie

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Apr 2007 17:54
@Zombie,

Hello,

A couple of things:

You may not want to set the camera range so high unless it is necessary (SET CAMERA RANGE 1,99999). Such a high range can destroy your frames per second.

Your main question:

Quote: "I'm not sure why this won't load"


I don't think that is the real question, and if it is are you saying that the water texture won't load into the program and you are getting an error to that says that? What I see in the program is an attempt to texture an OBJECT that doesn't exist (texture object 1,1) after you've created the matrix.

I'm assuming your intention is to texture your matrix with the water. So instead of:


Try:


Enjoy your day.
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 15th Apr 2007 18:51
hehehehehehehe *knocks head in with rubber mallet* thank you latch for bailing me out again. Ugh..seriously, what would i do without you guys. You wanna know the worst part? Not my code, i'm modding it to expand on the demo as it is.

But anyway, thank you very much for helping me again, it is most appreciated.

Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 16th Apr 2007 16:27
Latch-i feel so stupid. it still won't work, it says the file does not exist and the media is in the right folder, i'm not sure whats going on, i tried it with different files as well. i'm so embarrassed becasuse i can't get it to work.



Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Apr 2007 16:57
Are you using DarkEDIT? If so, for testing purposes, start a new document:

File > New

At the top of your new document, type the words LOAD IMAGE with a space after the word IMAGE. DO NOT PRESS ENTER, instead RIGHT click at the space after the word IMAGE.

A sub menu should open. Inside the submenu there should be an item that reads Media Browser. LEFT click on that.

The media browser window should open. At the top left of this window is a folder icon. LEFT click on that. It should open a file selection dialog box. Choose the path and folder where your image is stored.

Once the final folder where your image is stored is highlighted, click on the OK button.

Inside the media browser window should be a list of all the media that DarkEDIT can recognize. Find your image, LEFT click on it ONCE to highlight it, then LEFT click on the [Insert Filename] button.

The browser window should close but in your ducument after LOAD IMAGE should be the full path including the filename of your image. Use the arrow keys to move to the end of that line and type a ,1 at the end. Should look something like:



Press ENTER. On the next line type PASTE IMAGE 1,0,0

Now press F5. If your image loaded successfully, you should see it.

You can apply this same process to your program at the point where you want to load the image. This way, you are sure you are referencing the correct path.

Enjoy your day.
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 16th Apr 2007 17:07
Latch- you're a freaking genius man, thank you thank you thank you so much. I'm out of words to thank you, you're a very very nice person to help me out so many times, thank you thank you thank you.

Have a good day and thank you again.

zombie

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Apr 2007 18:48
Did it work?

Enjoy your day.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Apr 2007 19:33
Can I suggest that it's better to copy media files to the same directory as your .DBA file rather than having such a long path to a file.

I know most people won't have any problems doing what Latch says, but I - along with many others - have experienced problems when creating a single exe using Build Final when employing this method. (For me, DB routinely ignored .X, BMP, JPG and MP3 files when they weren't located somewhere inside the project folder).

Even if you create a normal exe and supply all the media externally, you'll have to copy it into a folder to supply with the exe, so you might as well do it for Build Final.

Once the file Latch gives in his example is copied to the project folder, it simply becomes:

LOAD IMAGE "jeans01.bmp",1

You can of course create a folder called Media in your project folder, copy all the files in there and it would become:

LOAD IMAGE "media\jeans01.bmp",1

As long as this folder is in the project directory, DB doesn't seem to mind - it's only including file from folders outside the project that can cause occasional hiccups.

TDK_Man

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Apr 2007 22:03
@Zombie

Like TDK said, for your project, you should keep your files and folders in the same directory as your main program.

My example, however, was for the sake of testing whether or not your file was in the location you thought it was and then being able to load it to make sure that it exists and can be viewed.

Enjoy your day.
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 18th Apr 2007 04:58 Edited at: 18th Apr 2007 05:11
@latch and tdk- thank you both very much, both methods have worked. Although i did have a question for latch on a side question.

Latch-When i opened up the media path, it was only showing .bmps. I haven't checked it yet, but is there a configuration in darkedit to change it to multiple files?

well tdk, thats funny haha, i can't seem to work anything you guys ever give me, it drives me up the wall. i put this in and it just could be lack of commands, but this is what i put in, and it said there was no file. *and it was in the folder, i checked.*



Tdk and Latch-Once again, thank you both of you for your assistance, it has helped greatly. You two really know your stuff .

And as of right now, i'm learning collision so i can draw a character *a box for me* and have it walk around and jump to platforms.

so thank you again, and i'm looking forward to the next competition.

well tdk, thats funny haha, i can't seem to work anything you guys ever give me, it drives me up the wall. i put this in and it just could be lack of commands, but this is what i put in, and it said there was no file. *and it was in the folder, i checked.* Its not the biggest problem in the world, but can i apply world collison to a bmp?



TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Apr 2007 07:31 Edited at: 18th Apr 2007 16:47
Quote: "can i apply world collison to a bmp?"


You can only use the 3D collision commands with objects - not images.

You can however load an image and use it as a texture on a Plain - and then use the collision commands with the plain.



TDK_Man

Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 18th Apr 2007 13:52 Edited at: 18th Apr 2007 15:35
thanks tdk

on a side note, darkedit still doesn't like my jpegs, whats going on with that? have you ever had a problem?

TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Apr 2007 16:43
Quote: "darkedit still doesn't like my jpegs"


What exactly do you mean by that. I don't understand as there's nothing for DarkEdit to like. DarkEdit is only a text editor which passes whatever you type to the DB compiler (DB.EXE) whenever you run or compile your program.

If anything doesn't like what you've put, it's the DB compiler - not Dark Edit - at which point DB passes an error back to DarkEdit which displays it for you. Exactly what error are you getting?

When it comes to images, 99 times out of 100, any errors are because the file isn't actually where DB has been told it is - or the program isn't where you think it is!

For example, say you have the project folder C:\MyNewProject and inside this you have two more folders - Sword and Media.

load image "Sword\Grass07.jpg",1

... is a relative path. In other words, the sword directory only exists when the program's current directory is C:\MyNewProject.

If in your program you use a DB command like CD to switch to another directory such as Media to load something, then Media becomes the current directory.

If you don't switch back, then the above Load Image command will fail because in the Media directory, the folder Sword doesn't exist.

One way to fix this is by using 'absolute' paths. This is where you put everything - from the C:\ onwards. This can result in very long paths and if you move your program to a different directory it won't work.

A little trick I use is to create a StartDir$ variable which is set to whatever directory the program is run from. You can use the variable whenever you load any files and never have to change directories in your program at all.

On the first working line of your program put:

StartDir$=Get Dir$()+"\"

Then, when you load media from any folder you just use:

load image StartDir$+"Media\Water06.jpg",1
load image StartDir$+"Sword\Grass07.jpg",1


Oops! I've also just noticed that on your load line you used Sword/Grass07.jpg. Forward slashes (/) are used in web page URL's. In file paths you should be using the backslash (\).

TDK_Man

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 18th Apr 2007 18:37
Quote: "it was only showing .bmps"

Quote: "darkedit still doesn't like my jpegs"


@Zombie
Wow, the media browser on DarkEDIT doesn't seem to recognize jpegs. I never noticed that before. I don't see any configuration settings to change this, it must be hard-coded to just recognize bitmaps. Like TDK said, this shouldn't have anything to do with DarkBASIC not being able to load them. You can still type the filename on a program line.

Quote: "Exactly what error are you getting?"


@TDK
Quote: "I've also just noticed that on your load line you used Sword/Grass07.jpg"


I'm pretty sure in DarkBASIC you can use either the UNIX / or Windows \ file slash convention.

Enjoy your day.
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 20th Apr 2007 02:00
yea sorry guys, i actually figured out what i was doing and i'm loading in pics just fine, thank you for all of your support, i appreciate it greatly. You guys are the best.

Login to post a reply

Server time is: 2026-07-05 18:39:18
Your offset time is: 2026-07-05 18:39:18