Hi all,
i've been playing today with a method of drawing on 3d models in realtime. I have this code,
Rem Project: Dark Basic Pro Project
Rem Created: Sunday, October 16, 2011
Rem ***** Main Source File *****
//=system_setup===============================================================
sync on:sync rate 60
autocam off
position camera 0,0,0,-500
set ambient light 100
//=set_up_textures============================================================
dim image(512,512)
for x = 1 to 512
for y = 1 to 512
image(x,512-y) = 0
dot x,y,rgb(image(x,y),0,0)
next y
next x
get image 1,1,1,512,512
//=make_objects===============================================================
make object plane 1,512,512
make object sphere 2,10
texture object 1,1
//=Main_loop==================================================================
do
//=Control_cursor_object======================================================
if leftkey() = 1 then move object left 2,1
if rightkey() = 1 then move object right 2,1
if upkey() = 1 then move object up 2,1
if downkey() = 1 then move object down 2,1
//=Spacekey_draws_to_model====================================================
if spacekey() = 1
if (object position x(2)+256 > 0 and object position x(2)<513) and (object position y(2)+256 > 0 and object position y(2)<513)
texturex = object position x(2) + 256
texturey = object position y(2) + 256
image(int(texturex),int(texturey)) = 255
for y = 1 to 512
for x = 1 to 512
dot x,512-y,rgb(image(x,y),0,0)
next x
next y
get image 1,1,1,512,512
texture object 1,1
endif
endif
//Text_to_screen================================================================
text 0,0,"press space key to draw to object texture"
text 0,20,"texture co-ordinates = "+str$(int(object position x(2) + 256))+" " + str$(int(object position y(2) + 256))
sync
loop
which works fine, however it is a really slow way of doing it. I'm wondering If there is a more efficient method of changing a few pixels of image data, preferably without having to redraw the image.
does anyone know of any simpler "get texture co-ordinate from 3d position" style command?
any thoughts or ideas are greatly appreciated.
kezzla
Sometimes I like to use words out of contents