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 / DBpro using texture

Author
Message
Lavikori
15
Years of Service
User Offline
Joined: 8th Jun 2009
Location:
Posted: 9th Dec 2009 23:17
Hi !

I'm having problems with Dark Basic Pro... I've did a 3d model for a game project (with blender), i've UV-mapped it but when I export it to a .X file and use it in DB, I can't see the texture... my mesh is just grey...

Here's my code.


sync on : sync rate 30
load object "models/mesh.x",1
load image "models/meshTex.jpg", 4

do
makeHero();
sync
loop

function makeHero()
make mesh from object 1,1
texture object 1, 4
endfunction


endfunction

Why can't I see my texture ?

ps : Sorry for my bad english... i'm french !
Digger412
17
Years of Service
User Offline
Joined: 12th Jun 2007
Location:
Posted: 9th Dec 2009 23:55 Edited at: 9th Dec 2009 23:57
I'm surprised that that doesn't crash! You're constantly creating a new hero and not deleting the old hero, why doesn't it say that the object already exists? Also, why do you have 2 endfunctions?

Last little qualm, it's much easier to other users of this forum if you put your code in code tags: [.code][./code] without the dots.
Lavikori
15
Years of Service
User Offline
Joined: 8th Jun 2009
Location:
Posted: 10th Dec 2009 00:39
For the two end functions, it's just a copy-paste error ^^

I've modified my code... : think it's better like this (thanks you !) :



But, my texture still does'nt appear...
Lavikori
15
Years of Service
User Offline
Joined: 8th Jun 2009
Location:
Posted: 10th Dec 2009 03:37
Sorry for this double post, but I've find what is the problem... but I dont know how to fix it...

I can now get my texture appear, but my UV is not well exported... here's an screen... (ya I know, the normals are inverted and... uh the guy too...)

Attachments

Login to view attachments
Digger412
17
Years of Service
User Offline
Joined: 12th Jun 2007
Location:
Posted: 10th Dec 2009 04:53
Hmm...my first idea would be that your texture isn't in the same directory as the model, but judging from your code it is. Are you sure that you have the same texture that you used when creating the model? What does the model look like loaded? Gray? Black? It'd help if you included your media files, so I could see better what was going on.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 10th Dec 2009 16:46
There are some very elementary problems with you code which will cause major problems for you when your programs grow larger.

if boutonJouer() = 1 then goto play

Don't use Goto - it's not good and gets you into bad programming habits. Use Gosub instead.

If you don't know how Gosub works, read some tutorials and force yourself to learn now rather than later. It will save you hours of frustration later on!

Don't have two Main Do..Loops. Just use one. The key is to set the layout of your programs in a modular fashion.

You'll find things like this here:

Tutorials For Beginers

TDK

Lavikori
15
Years of Service
User Offline
Joined: 8th Jun 2009
Location:
Posted: 11th Dec 2009 03:31
@TDK : Thanks you, I will read that and modify my code !

@Digger412 : Yes, I use the same texture as in blender... and my texture is in the same folder as my model... but I really think my problem is that the UV is not well exported... I tried to open my model in a UV editing software... and it looked like that : (the picture is attached )

Weird... I'll try with another model, if it does the same.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-27 15:41:23
Your offset time is: 2024-11-27 15:41:23