How can I manipulate textures

BlitzMax Modules Forums/MiniB3D/How can I manipulate textures

Is there a way to convert texures from ttexture to tpixmap?
Or maybe there is another way to manipulate it?

Can't get the BackBufferToTex to work either. The texture gets the color of the first pixel I draw.

Regards
Sveinung

how do you check your texture?
because if you do it on a model: are you sure the model has UV data? cause the error you describe is the common error that happens when an object without UV data (-> all UV 0,0 -> all colored with pixel top left of texture) is textured.

Take a look at this post: http://www.blitzbasic.com/Community/posts.php?topic=67027

You have to use : DisableTextureFilter() before doing BackbuffertoTex() because if you don't you will only copy the texture to mip level 0 and this is only used if you go very and i mean very close to the model.

Thank you both. Got it to work :D

Sveinung

it would be nice if you post a working solution. i want to manipulate a texture.

thanks

stephan

OK
Here is an example...not a good one
BTW this is WIP
SuperStrict

SetGraphicsDriver GLMax2DDriver(),GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER

Graphics3D 800,600,32
ClearTextureFilters()

Local tsize:Int=64
Global proc_array:Long[tsize*tsize]

Local cpiv:TPivot=CreatePivot()

Local cam:tcamera=CreateCamera()
PositionEntity cam,0,0,-5
PointEntity cam,cpiv

Local lig:tlight=CreateLight()
PositionEntity lig,0,4,-5
LightRange lig,4

Local obj:tmesh=CreateCube()

Local tx:ttexture=CreateTexture(tsize,tsize)

Local overlay:tmesh=CreateCube()
ScaleEntity overlay,1,1,0
PositionEntity overlay,0,0,-4
EntityTexture overlay,tx
EntityAlpha overlay,0.15
PositionTexture(tx,-0.08,0.08)
ScaleTexture(tx,1.2,-1.2)

Repeat
	CameraViewport cam,0,0,tsize,tsize
	HideEntity overlay
	TurnEntity obj,1,1,0
	RenderWorld()
	quick_blur(tsize,tsize,2)
	BackBufferToTex(tx)
	CameraViewport cam,0,0,800,600
	ShowEntity overlay
	RenderWorld()
	Flip()
Until KeyHit(KEY_ESCAPE)
End

Function quick_blur(w:Int,h:Int,passes:Int=1)
	If passes<1 Then passes=1
	passes=passes-1
	Local x:Int
	Local y:Int
	Local i:Int
	Local pos:Int=0
	
	Local p:Int
	
	For i=0 To passes
		For y=0 To h-1
			For x=0 To w-1
				SetColor(Rnd(255),Rnd(255),Rnd(255))
				Plot(x,y)
			Next
		Next
	Next
	
End Function


Sveinung

For everyone is arrived here this is the solution!
...
BackBufferToTex(tx)
EntityTexture obj,tx
...