OK Got it!
After altering vertex alpha, you must:
1) Recall SET OBJECT TRANSPARENCY
2) Retexture the object
Eg: An addition to your code (swap the image for one on your HD)
sync on: sync rate 0
rem setting the triangle vars
polys=1
x1#=-3.0 : y1#=2.0 : z1#=1.0
x2#=3.0 : y2#=2.0 : z2#=-1.0
x3#=-1.0 : y3#=-1.0 : z3#=0.0
rem make the memblock with the right size (Each poly has 3 vertices with 36 bytes of data each)
rem plus another 12 bytes for the header
make memblock 1,(polys*3*36)+12
rem write the header
rem FVF format (4 bytes, so a dword) this is normally 338
write memblock dword 1,0,338
rem FVF size (in this case 36 bytes)
write memblock dword 1,4,36
rem Number of vertices
write memblock dword 1,8,polys*3
rem writing data for the first vertex
rem position (3 floats(float=4 bytes) for the x,y and z position of the vertex point)
write memblock float 1,12,x1#
write memblock float 1,16,y1#
write memblock float 1,20,z1#
rem normal (again 3 floats) we well set it so each vertex point faces the camera (not normal)
write memblock float 1,24,0
write memblock float 1,28,0
write memblock float 1,32,-1.00
rem color (as a dword, or as 4 bytes blue,green,red,alpha)
write memblock dword 1,36,rgb(255,0,0)
rem UV texture coordinates (2 floats) doesn't matter for now, because we don't give it a texture
write memblock float 1,40,0.00
write memblock float 1,44,0.00
rem writing data for the second vertex
rem position (3 floats(float=4 bytes) for the x,y and z position of the vertex point)
write memblock float 1,12+36,x2#
write memblock float 1,16+36,y2#
write memblock float 1,20+36,z2#
rem normal (again 3 floats) we well set it so each vertex point faces the camera (not normal)
write memblock float 1,24+36,0
write memblock float 1,28+36,0
write memblock float 1,32+36,-1.00
rem color (as a dword, or as 4 bytes blue,green,red,alpha)
write memblock dword 1,36+36,rgb(0,255,0)
rem UV texture coordinates (2 floats) doesn't matter for now, because we don't give it a texture
write memblock float 1,40+36,1.00
write memblock float 1,44+36,0.00
rem writing data for the third vertex
rem position (3 floats(float=4 bytes) for the x,y and z position of the vertex point)
write memblock float 1,12+72,x3#
write memblock float 1,16+72,y3#
write memblock float 1,20+72,z3#
rem normal (again 3 floats) we well set it so each vertex point faces the camera (not normal)
write memblock float 1,24+72,0
write memblock float 1,28+72,0
write memblock float 1,32+72,-1.00
rem color (as a dword, or as 4 bytes blue,green,red,alpha)
write memblock byte 1,36+72,0
write memblock byte 1,36+73,0
write memblock byte 1,36+74,255
write memblock byte 1,36+75,0
rem UV texture coordinates (2 floats) doesn't matter for now, because we don't give it a texture
write memblock float 1,40+72,0.50
write memblock float 1,44+72,1.00
rem make a mesh out of this memblock
make mesh from memblock 1,1
rem make an object with this mesh
make object 1,1,0
position camera 0,0,-10
set object transparency 1,1
Load Image "C:Inetpubwwwrootrwknighttzgfxcdrom.bmp",1
texture object 1,1
do
If upkey() then vaup()
If downkey() then vadown()
cval = memblock byte(1,36+75)
text 20,20,"Current Vertex Alpha: " + str$(cval)
text 20,40,"Screen FPS: " + str$(Screen FPS())
sync
loop
function vaup()
current = memblock byte(1,36+75)
if current < 255
write memblock byte 1,36+75,current+1
change mesh from memblock 1,1
change mesh 1,0,1
texture object 1,1
set object transparency 1,1
endif
endfunction
function vadown()
current = memblock byte(1,36+75)
if current > 0
write memblock byte 1,36+75,current-1
change mesh from memblock 1,1
change mesh 1,0,1
texture object 1,1
set object transparency 1,1
endif
endfunction
With P4.1 - I can do this in realtime
This could be VERY useful. For example, you could have water which gets darker and more opaque as it gets deeper.
Another use for this would be a beam effect. You could use vertex alpha to make the ends of the trail more and more feint.