manipulatine "output" picture..

Blitz3D Forums/Blitz3D Programming/manipulatine "output" picture..

Spy(Posted 2004) [#1]
topic title may be a little confusing :) but let me explain what i mean..

is it possible to grab a frame.. change it.. and display it..

by changing it i mean... put an effect on it.. like pixleize it or blure it.. so the player sees this effect in the game..


/Spy


Bot Builder(Posted 2004) [#2]
sure. After calling renderworld, modify the pixels of the backbuffer. However, this strategy is way to slow. simply writepixelfast and readpixelfast would take a while, much less additional calculation.

here are some better methods that do it differently:

http://www.blitzbasic.com/codearcs/codearcs.php?code=814 - HAven't used myself, but looks good

There's one by Arkon that is probably in the code arcs, but I couldn't find it, so here:

Global ark_blur_image, ark_blur_texture, ark_sw, ark_sh

Function CreateBlurImage()
	ark_sw = GraphicsWidth()
	ark_sh = GraphicsHeight()	
	;Create sprite
	Local spr = CreateMesh(camera)
	Local sf = CreateSurface(spr)
	AddVertex sf, -1, 1, 0, 0, 0
	AddVertex sf, 1, 1, 0, 1, 0
	AddVertex sf, -1, -1, 0, 0, 1
	AddVertex sf, 1, -1, 0, 1, 1
	AddTriangle sf, 0, 1, 2
	AddTriangle sf, 3, 2, 1
	EntityFX spr, 17
	ScaleEntity spr, 1024.0 / Float(ark_sw), 1024.0 / Float(ark_sw), 1
	PositionEntity spr, 0, 0, 1.0001
	EntityOrder spr, -100000
	EntityBlend spr, 1
	ark_blur_image = spr
	;Create blur texture
	ark_blur_texture = CreateTexture(1024, 1024, 256)
	EntityTexture spr, ark_blur_texture
End Function

Function UpdateBlur(power#)
	EntityAlpha ark_blur_image, power#
	CopyRect  ark_sw / 2 - 512, ark_sh / 2 - 512, 1024, 1024, 0, 0, BackBuffer(), TextureBuffer(ark_blur_texture)	
End Function



Spy(Posted 2004) [#3]
oh thank you...

hmm another thing i wanted to know is.. is it possible to manipulate the picture within a .dll file.. and output it in the program..
i know how to use .dll's to do something liek findwindo and some windows stuff.. but if theres a pice of code somewhere how to acctualy do something that is "visal" over a .dll it would be cool if someone could post the link to it here..

well i think i saw somewhere a demo how to mess around with sprites in a program over a .dll but it had no source so i wasnt able to see how it was done..

/Spy


Ice9(Posted 2004) [#4]
I believe it is. There was a thread going about a month or so ago about accessing memory directly using some decls and some windows API stuff.