Full Screen Ghosting Effect?

BlitzMax Forums/MiniB3D Module/Full Screen Ghosting Effect?

Ked(Posted 2009) [#1]
Hey. Again, I am looking for any code or examples that let's me create a full-screen quad/sprite. It needs to be precisely measured to fit the dimensions of the screen, regardless of what resolution it is set on. I've looked through the code archives and have found nothing that works like I want it to. Any help would be appreciated.

Thanks!


Ked(Posted 2009) [#2]
:) Nevermind. I realized that I already had the code, but I needed to adjust it a little. Here is the code:
Function CreateFullScreenQuad:TMesh(parent:TCamera)
	Local gwidth:Int=GraphicsWidth(),gheight:Int=GraphicsHeight()
	
	Local mesh:TMesh=CreateMesh(parent)
	Local surf:TSurface=CreateSurface(mesh)
	
	AddVertex(surf,-1,1,0,0,0)
	AddVertex(surf,1,1,0,1,0)
	AddVertex(surf,-1,-1,0,0,1)
	AddVertex(surf,1,-1,0,1,1)
	
	AddTriangle(surf,0,1,2)
	AddTriangle(surf,3,2,1)
	
	PositionEntity mesh,0,0,1.0
	ScaleEntity mesh,1.0*(gwidth/gheight),1.0,1.0
	EntityOrder mesh,-10000
	EntityFX mesh,1
	
	Return mesh
EndFunction

I've tested it and it seems to work perfectly in 640x480, 800x600, and 1024x768.


ima747(Posted 2009) [#3]
I think that might have problems for widescreen formats, you could probably fix it by modifying the ScaleEntity line to take into account the screen's aspect ratio...

regardless thanks for the code I'm sure I'll be using it :0)


Ked(Posted 2009) [#4]
Updated the code above to work with widescreen formats (almost positive). I tested it with 1280x720, 1280x800, 1600x900 and everything checked out OK.