Future of Blitz3D

Blitz3D Forums/Blitz3D Programming/Future of Blitz3D

; Code example to show workaround for CreateTexture using flag 4

Graphics3D 800,600,32,2
ClearTextureFilters

SetBuffer BackBuffer()

Global tex

Global cube=CreateCube()
EntityColor cube,0,255,0

camera=CreateCamera()
PositionEntity camera,0,0,-10

light=CreateLight()
PositionEntity light,0,50,0

plane=CreatePlane()
EntityColor plane,77,77,77
PositionEntity plane,0,-1,0

doTexture()

While Not KeyHit(1)
If KeyDown(200) MoveEntity camera,0,0,.1
If KeyDown(208) MoveEntity camera,0,0,-.1

TurnEntity cube,0,1,0

UpdateWorld
RenderWorld
Flip
Delay 10
Wend
End

Function doTexture()
tex=CreateTexture(64,64,4)
SetBuffer TextureBuffer(tex)
ClsColor 0,0,0
Cls
Color 0,255,0
For x=1 To 63 Step 5
	For y=1 To 63 Step 5
		Plot x,y
	Next
Next
SaveBuffer(TextureBuffer(tex),"temp.bmp")
FreeTexture tex
tex=LoadTexture("temp.bmp",4)
EntityTexture cube,tex
SetBuffer BackBuffer()
End Function


Try this snippet...
@markd - you're very welcome :)
***EDIT**** Updated version of code example including freeing of texture and clearing of texture filters