Try this (may have some typos)
graphics3d 1024,768,32,1
setbuffer backbuffer()
testbmp=loadimage("mybmp.bmp") ; a 1024*768 Pic
cleartexturefilters
tex=createtexture(1024,1024,256 or 16 or 32)
texturefilter "",9
copyrect 0,0,1024,768,0,128, imagebuffer(testbmp),texturebuffer(tex)
quad=createQuad()
entitytexture quad,tex
entityfx quad,1
camera=createcamera()
camerarange camera,0.01,100
translateentity camera,(1.0/1024.0),-(1.0/1024.0),-1.0
parententity quad, camera
setbuffer backbuffer()
; this ill show the diffrence of an image drawn with
; Drawblock, compared to the same image used as a texture on a quad.
;Well, there shouldn't be any diffrence. At least in 1024 Resolution.
while keydown(1)=0
renderword()
text 0,0,"Texture Version"
if(millisecs() and $1000)=$1000 then
drawblock testbmp,0,0
text 0,0,"Image Version"
endif
flip
wend
end
function CreateQuad()
mesh=createmesh()
surf=createsurface(mesh)
v0=addvertex(surf,-1.0, 1.0,0 ,0,0)
v1=addvertex(surf, 1.0, 1.0,0 ,1,0)
v2=addvertex(surf, 1.0,-1.0,0 ,1,1)
v3=addvertex(surf,-1.0,-1.0,0 ,0,1)
addtriangle(surf,v0,v1,v2)
addtriangle(surf,v0,v2,v3)
updatenormals mesh
return mesh
end function
|