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 / anyone know why this texture wont show?

Author
Message
El Goorf
19
Years of Service
User Offline
Joined: 17th Sep 2006
Location: Uni: Manchester, Home: Dunstable
Posted: 3rd Oct 2009 16:38
Hi, firsly i apologize for the state of the code, its as tidy as i could get it. It's been 18 months since I last used DBP so im feeling very rusty atm so forgive me if i've made a noob error

The problem I'm having is I've created an object, placed all the vertices and indices, and entered the UV data, but the texture wont show. I'm guessing its either something i've missed in loading the texture or somewhere i've messed up in the UV data. can anyone see where? cheers



http://notmybase.com
All my base are not belong to anyone.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 3rd Oct 2009 18:08 Edited at: 3rd Oct 2009 18:14
I don't see anything wrong
If you want me to check further
post the texture jpg image

Or send me an email with the jpg attached
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 3rd Oct 2009 18:49 Edited at: 3rd Oct 2009 18:50
Well I did more testing, here is what I got to work.



Needs to be at the top of your program or at least executed first
setting display mode deletes any loaded textures I believe


I add the ambient light, you can play with this
I added loading my own .bmp file for testing
hope this helps
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd Oct 2009 18:51
Hi El Goorf

A clue from the Help file for set display mode :

Quote: "It is vital to know that when this command is called, everything is deleted, including music and sound, so you must re-load all your assets after a call to this command"


In other words, load your images AFTER set display mode.

[I'm supposed to be on holiday still but since I'm only gardening today and it's raining I couldn't resist a quick peek at the forum. ]
El Goorf
19
Years of Service
User Offline
Joined: 17th Sep 2006
Location: Uni: Manchester, Home: Dunstable
Posted: 5th Oct 2009 01:54
thanks, i never noticed set display mode doing that before, and was expecting an error like "texture does not exist", if it was being wiped from memory before being applied..

http://notmybase.com
All my base are not belong to anyone.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Oct 2009 14:19
I agree. Might be worth posting this in the Bug Reports.
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 5th Oct 2009 14:24
Thats because Set Display Mode is re-creating the D3D device. Its going to wipe anything in video memory. This is not a bug. Its Direct X.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Oct 2009 14:39
You've missed the point - shouldn't DBPro flag an error when you try to apply a non-existent image?
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 5th Oct 2009 14:52
The display mode also denotes the depth of images used in the system - if you run in 16-bit colour, then the textures would be loaded as 16-bit as well. It's not ideal, especially for those who like to mess with memblock images, I'd rather they just made 32-bit a standard depth, even if they made it so you can specifiy the display depth of images with a command.

But that doesn't detract from this being a pain, but kinda excusable, I mean I always have to restart games after changing the display mode. To do the same just load up a setup file to check, set the desired resolution then load all your media. If the user changes the resolution, save the results but just tell them to restart to apply the new display mode. Players will excuse this, because we're all in the same boat I think - lots of engines hate to change resolution. It's not like the old days huh!, I remember coding on the ST, which could change resolution mid-frame!, damn I miss standardized hardware.

If you absolutely must change the resolution after loading media, then I suggest making a setup procedure, and make functions to handle any media loading instead of natively. That way, you can check to make sure the loading is necessary...

Function load_image(fn$,num)
if file exist(fn$)=1 and num>0
if image exist(num)=0 then load image fn$,num,1
endif
Endfunction

This way, you could load all your media back in, but only if it's not already loaded and only if it finds the file. You could also use automatic numbering, so instead of num, you might use -1, which could tell the system to get a free image number instead and use that. I'd probably have these loader functions return the object, image, sound number if the loading is succesful. Maybe it can return a -1 if the file is missing, there's a few things you could do if you go this route. It's like, if your gonna do this, then you might as well do it properly, have some error trapping in there to make life easier when debugging. For a really dynamic WIP project, have it make dummy images even, or replace missing files with stand in cubes. I guess it depends on how you work, but I imagine it's possible to save a lot of compile time like this. Instead of compiling to see if the new media loads up ok, fixing it, compiling again until it works - well you could have it display the name of the file it hasn't found, then you could ignore that and have it make a dummy object instead - and you can debug more things at the same time, and see straight away what needs done. Worth considering going the whole hog if you have to take precautions anyway.


Health, Ammo, and bacon and eggs!
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 5th Oct 2009 18:46
Quote: "You've missed the point - shouldn't DBPro flag an error when you try to apply a non-existent image?"

I would have to agree, that is unless the Image ID specified is zero.

Login to post a reply

Server time is: 2026-06-11 14:44:51
Your offset time is: 2026-06-11 14:44:51