I guess I should use FrameBuffer.getPixels2 to get the buffer data, but timer after time, it always gets nothing. The byte array is still all zero.
This is my simple code - It clear the screen with the red color, then the buffer data should not be all 0.
This is my simple code - It clear the screen with the red color, then the buffer data should not be all 0.
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
Dim FrameBuffer As JpctFrameBuffer
Dim World As JpctWorld
Dim back As JpctRGBColor
End Sub
Sub Globals
Dim Jpct As JpctSurface
Private Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Jpct.Initialize("Jpct", 1, Jpct.RENDER_CONTINUOUSLY)
Activity.AddView(Jpct,0,0,Activity.width,Activity.height)
Button1.Initialize("Button1")
Activity.AddView(Button1,20%x,0,60%x,80dip)
Button1.Text="test"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Jpct_SurfaceChanged(Width As Int, Height As Int)
FrameBuffer.Initialize1(Jpct.glContext, Width, Height)
World.Initialize
World.setAmbientLight(120, 120, 120)
End Sub
Sub Jpct_SurfaceDraw
back.Initialize2(255, 0, 0)
FrameBuffer.clear2(back)
World.renderScene(FrameBuffer)
World.draw(FrameBuffer)
FrameBuffer.display
End Sub
Sub Button1_Click
Dim bye(FrameBuffer.Width*FrameBuffer.Height) As Int
FrameBuffer.getPixels2(bye)
Dim i As Int
For i=1000 To 1100
Log(bye(i)) 'always =0
Next
End Sub