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 / HELP! - I cant texture ! lol

Author
Message
simonuk74
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location:
Posted: 15th Jun 2003 03:08
I have this editor I`m doing, and for my knowledge of coding, I think I`m doing rather well, just that now and again, I stumble across stupid problems that I cant sort:

ok, I place a box ( 16,16,32 ) on the surface of my matrix - to represent a door in the map, that works fine .I have created ( in paint! )a simple texture set, a 256,256 bitmap, that I have loaded an divided it up, to use as matrix tiles ( that works fine too!)
but theres some of the textures on the bitmap that I want to use for texturing doors, for instance, some doors in the map may need higher level passes to open them - so the bitmap contains textures with DOOR1, DOOR2,DOOR3, so on.

heres a attempted example :

load bitmap "C:\1.bmp",1
set current bitmap 1
get image 1,33,33,96,64

load image "C:\1.bmp",1



rem MAKE BASE MATRIX

make matrix 1,mapx*16,mapz*16,mapx,mapz
position matrix 1,0,0,0
prepare matrix texture 1,1,8,8
set matrix tile 1,1,1,1
update matrix 1


make object box 10,16,16,32
texture object 10,1

now I know theres probably a problem with a conflict of LOAD BITMAP, GET IMAGE then LOAD IMAGE, as they use the same numbers, but I have tried the get image to be 5, not 1, but I cant get it to work
whatever I try either it textures the chosen object black ( no texture ) or the complete screen goes black ?

I know this a long question for a simple answer

but how do I texture an object with part of a bitmap ?
medwayman
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: uk
Posted: 15th Jun 2003 11:49
I’d recommend putting your bitmaps and images in the same folder as your .dba file. That way there is no need to set a path (all you need is - load image “1.bmp”,1) and it will save a lot of grief later on.

If you want to keep things nice and neat you can create a folder for your images within your project folder and access it with – load image “bitmaps/1.bmp”,1 assuming you name the folder bitmaps. You can call it whatever you want.


Changing these two lines should work

get image 1,33,33,96,64 to get image 5,33,33,96,64
texture object 10,1 to texture object 10,5

As it stands you are overwriting your image grab with - load image "C:\1.bmp",1 and texturing your door with that image.

It’s best to keep your matrix textures separate from any other textures. Have one bitmap for your matrix and another for your doors.

load image “mat_texture”,1

load bitmap “doors”,1
set current bitmap 1
get image 5,x,x,y,y
get image 6,x,x,y,y
get image 7,x,x,y,y
delete bitmap 1

Or you could place each door on it’s own bitmap and load them as images.

load image “door1”,5
load image “door2”,6
load image “door3”,7

Asteroids name: Snaggletooth
simonuk74
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location:
Posted: 15th Jun 2003 14:25
Hmm, I did try the code that you have suggested before :
Quote: "
load image “c:\1.bmp”,1
load bitmap “c:\2.bmp”,1
set current bitmap 1
get image 5,x,x,y,y
get image 6,x,x,y,y
get image 7,x,x,y,y
delete bitmap 1 - ( I didnt have this line in originally )
"


I didnt know that I have to delete the bitmap, as it sends my screen black with out it ! ?
but it works now, with delete bitmap. thanks!

medwayman
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: uk
Posted: 15th Jun 2003 14:49
You should always delete any bitmaps or images (or any other media) you’ve finished using.
Btw. You don’t need to use the - set current bitmap – command to grab your images. But if you do make sure you set it back to bitmap 0

Asteroids name: Snaggletooth

Login to post a reply

Server time is: 2026-07-18 07:31:34
Your offset time is: 2026-07-18 07:31:34