Fullscreen quads?

Blitz3D Forums/Blitz3D Programming/Fullscreen quads?

aCiD2(Posted 2005) [#1]
Hey, if I have a quad that is -1 to 1 on both the x and the y axis, how much should I scale it to make it a pixel perfect quad that takes up the whole screen. The texture is 1024x1024, but it may vary. Any ideas? I tryed using Arkon's code, but his uses a texture that is offset, that is - it doesnt actually start at 0, 0.

Thankies! :)


maverick69(Posted 2005) [#2]
It depends on the Camera-Position how many pixel the quad will be on the screen. Also, don't forget to set the correct CameraRange if you have it very near to the camera.

Use the TextureCoords-Command to set the uv coords.


(tu) ENAY(Posted 2005) [#3]
You will find that stretching a quad to the size of the entire is very slow on older machines.


jfk EO-11110(Posted 2005) [#4]
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