hi, I was currently checking out the BackbuffertoTex Function and realized that this doesn't work on any PC I was testing.
The curious is CubemapRender works perfectly and other r2t codes from others works also but somehow minib3ds version doesn't work.
Here is my code:
Am i doing something wrong? I really have to find out why this doesn't work as I need the function to establish shader based posteffects etc. .
thx for the help
The curious is CubemapRender works perfectly and other r2t codes from others works also but somehow minib3ds version doesn't work.
Here is my code:
Import "../MiniB3D.bmx" Strict Local width=640,height=480,depth=16,mode=0 Graphics3D width,height,depth,mode Local cam:TCamera=CreateCamera() CameraClsColor(Cam,255,0,0) Local light:TLight=CreateLight() Local ent1:TMesh=CreateCube() Local tex:TTexture=LoadTexture("media/test.png") EntityTexture ent1,tex Local ent2:TMesh=TMesh(CopyEntity(ent1)) Local ent3:TMesh=TMesh(CopyEntity(ent1)) Local ent4:TMesh=TMesh(CopyEntity(ent1)) Local ent5:TMesh=TMesh(CopyEntity(ent1)) Local ent6:TMesh=TMesh(CopyEntity(ent1)) PositionEntity ent1,0,0,10 PositionEntity ent2,0,0,5 PositionEntity ent3,0,0,20 PositionEntity ent4,0,0,15 PositionEntity ent5,0,0,30 PositionEntity ent6,0,0,25 EntityAlpha ent2,0.5 EntityAlpha ent4,0.5 ' used by camera code Local mxs#=0 Local mys#=0 Local move#=0.5 MouseXSpeed() ' flush MouseYSpeed() ' flush ' used by fps code Local old_ms=MilliSecs() Local renders Local fps Local Sprite:TMesh = CreateCube() PositionEntity(Sprite,-4,0,5) Local STex:TTexture = TTexture.CreateScreenTexture(256) EntityTexture Sprite,STex While Not KeyDown(KEY_ESCAPE) If KeyHit(KEY_ENTER) Then DebugStop '' control camera ' mouse look mxs#=mxs#+(MouseXSpeed()/5.0) mys#=mys#+(MouseYSpeed()/5.0) RotateEntity cam,mys#,-mxs#,0 MoveMouse width/2,height/2 MouseXSpeed() ' flush MouseYSpeed() ' flush ' move camera forwards/backwards/left/right with cursor keys If KeyDown(KEY_UP)=True Then MoveEntity cam,0,0,move# ' move camera forward If KeyDown(KEY_DOWN)=True Then MoveEntity cam,0,0,-move# ' move camera back If KeyDown(KEY_LEFT)=True Then MoveEntity cam,-move#,0,0 ' move camera left If KeyDown(KEY_RIGHT)=True Then MoveEntity cam,move#,0,0 ' move camera right '' If Renders Mod 1 = 0 Then Mirror(Cam,STex,Sprite) RenderWorld renders=renders+1 ' calculate fps If MilliSecs()-old_ms>=1000 old_ms=MilliSecs() fps=renders renders=0 EndIf Text 0,0,"FPS: "+String(fps) Flip Wend End Function Mirror(Cam:TCamera,STEx:TTexture,Sprite:TEntity) CameraViewport(Cam,0,0,256,256) CameraClsMode(Cam,False,True) HideEntity Sprite RenderWorld 'Flip BackBufferToTex(STex) ShowEntity(Sprite) CameraViewport(Cam,0,0,640,480) CameraClsMode(Cam,True,True) End Function
Am i doing something wrong? I really have to find out why this doesn't work as I need the function to establish shader based posteffects etc. .
thx for the help