This was the purpose - anyone got a guess as to what I did wrong?
global Dist# as float
Global Object as integer
Global PX# as float
Global PY# as float
Global PZ# as float
for a=0 to 256
for b=0 to 256
dot a,b,RGB(rnd(255), Rnd(255), Rnd(255))
NEXT
NEXT
GET IMAGE 1, 0,0,256,256
MAKE MEMBLOCK FROM IMAGE 1, 1
cls 0
SYNC ON : SYNC RATE 0
Size=Get memblock size(1)
sync
cls 0
text 10,10, "The memblock's size is : "+Str$(Size)
text 10, 25, "Press any key to check"
sync
WAIT KEY
For Check = 12 to size-12 step 4
PixelX=((check-8)/4)/IMAGE WIDTH(1)
PixelY=((check-8)/4)/IMAGE Height(1)
NEXT
sync
MAKE OBJECT PLAIN 1, 1000, 1000
ROTATE OBJECT 1, 90, 180, 180
COLOR BACKDROP 0
TEXTURE OBJECT 1, 1
AUTOCAM OFF
SET CAMERA RANGE 0.001, 1000
position camera 500, 300, 0
POINT CAMERA 0,0,0
do
sync
if mouseclick()=1
DivX#=(Object Size X(1)/IMAGE WIDTH(1))
DivY#=(Object Size Z(1)/IMAGE HEIGHT(1))
for U#=0.0 to 1.0 step 0.1
For V#=0.0 to 1.0 step 0.1
Obj=location()
if Obj>0
ScaleX#=(Get2DscaleX(1,1))
PosX#=((PX#/(ScaleX#*U#))+IMAGE WIDTH(1)/2)
ScaleY#=(Get2DscaleY(1,1))
PosY#=((PZ#/(ScaleY#*V#))+IMAGE HEIGHT(1)/2)
Paint(1, 1, 1, 255,0,0, (posX#), (PosY#))
endif
if escapekey()=1 then end
NEXT V#
NEXT U#
endif
If Obj>0
Handle$=Report3D()
HandleB$=Report2D(1, 1, int(U#), int(V#))
Text mouseX(), mouseY(), Handle$
Text mouseX(), mouseY()+10, HandleB$
TEXT mouseX(), MouseY()+20, "UV locations are: U= "+Str$((U#))+ ", V= "+Str$((V#))
endif
LOOP
end
function location()
Dist#=Get pick Distance()
Object=Pick object(MouseX(), MouseY(), 1, 1)
PX#=Get pick Vector X()+Camera Position X()
PY#=Get pick Vector Y()+Camera Position Y()
PZ#=Get pick Vector Z()+Camera Position Z()
ENDFUNCTION Object
Function Report3D()
Answer$="The current position in 3D - X= "+Str$(int(PX#))+", Y= "+Str$(int(PY#))+", Z= "+Str$(int(PZ#))
ENDFUNCTION Answer$
Function Report2D(ImgNum, ObjNum, U, V)
ScaleX#=Get2DscaleX(ImgNum, ObjNum)
ScaleY#=Get2DscaleY(ImgNum, ObjNum)
Answer$="The current position in 2D - X= "+Str$((int(PX#/ScaleX#)+IMAGE WIDTH(imgnum)/2))+", Y= "+Str$((int(PZ#/ScaleY#)+IMAGE HEIGHT(imgnum)/2))
ENDFUNCTION Answer$
Function Get2DscaleX(ImgNum, ObjNum)
Scale#=(Object Size X(ObjNum)/IMAGE WIDTH(ImgNum))
ENDFUNCTION Scale#
Function Get2DscaleY(ImgNum, ObjNum)
Scale#=(Object Size y(ObjNum)/IMAGE HEIGHT(ImgNum))
ENDFUNCTION Scale#
function paint(memblock, imgnum, ObjNum, Red, Green, Blue, CursorX, CursorY)
For X=0 to image width(imgnum)-1
For y=0 to image height(imgnum)-1
MemLoc=(IMAGE WIDTH(imgnum)*y+x)*4+12
D#=Distance2D(CursorX, CursorY, X, y)
if D#<10
write memblock byte memblock, Memloc + 0, Blue
write memblock byte memblock, Memloc + 1, Green
write memblock byte memblock, Memloc + 2, Red
write memblock byte memblock, memloc + 3, 128
ENDIF
NEXT y
NEXT x
If IMAGE EXIST(imgnum)=1
DELETE IMAGE imgnum
MAKE IMAGE FROM MEMBLOCK imgnum, memblock
TEXTURE OBJECT objnum, imgnum
sync
ENDIF
ENDFUNCTION
function Distance2D(X1, Y1, X2, Y2)
if VECTOR EXIST(1)=0
temp=MAKE VECTOR2(1)
ENDIF
SET VECTOR2 1, X2-X1, Y2-Y1
Distance#=LENGTH VECTOR2(1)
ENDFUNCTION Distance#
Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.