Android Question glSurfaceView Background Color?

mmieher

Active Member
Licensed User
Longtime User
How to set the color of the area behind the rotating cube? gls1.color sets the color of the entire view, so you cannot see the cube.

B4X:
Private Sub DisplaySplash As ResumableSub
    LogColor("DisplaySplash", Colors.Blue)
    
    Facelist.Initialize
    'add 6 images to (List) facelist - one for each of the faces of the cube
    mbm(0).Initialize(File.DirAssets,"rcYellow.png")
    Facelist.Add(mbm(0))
    mbm(1).Initialize(File.DirAssets,"rcRed.png")
    Facelist.Add(mbm(1))
    mbm(2).Initialize(File.DirAssets,"rcBlue.png")
    Facelist.Add(mbm(2))
    mbm(3).Initialize(File.DirAssets,"rcGreen.png")
    Facelist.Add(mbm(3))
    mbm(4).Initialize(File.DirAssets,"rcWhite.png")
    Facelist.Add(mbm(4))
    mbm(5).Initialize(File.DirAssets,"rcOrange.png")
    Facelist.Add(mbm(5))
    
    GLS1.Color = Colors.Transparent    '    does not work
    'pass (List) facelist on to the wrapper
    GLS1.SixFaces = Facelist
    
    'this has to be set AFTER the LIST has been passed to the wrapper
    GLS1.ZoomInOut = True                       'it will make the cube zoom In/Out while spinning anround the below defined RotationPlane
    'GLS1.CubeSpeed = 3.0                        'A negative value will reverse the direction of the spin
    GLS1.CubeSpeed = 1.0                        'A negative value will reverse the direction of the spin
    GLS1.RotationPlane(1.0, -1.0, 0.0)          'Keep these values between 0.0 and 1.0 (you can also apply negative values)
    
    Return 0
    
End Sub
 

Johan Schoeman

Expert
Licensed User
Longtime User
How to set the color of the area behind the rotating cube? gls1.color sets the color of the entire view, so you cannot see the cube.

B4X:
Private Sub DisplaySplash As ResumableSub
    LogColor("DisplaySplash", Colors.Blue)
   
    Facelist.Initialize
    'add 6 images to (List) facelist - one for each of the faces of the cube
    mbm(0).Initialize(File.DirAssets,"rcYellow.png")
    Facelist.Add(mbm(0))
    mbm(1).Initialize(File.DirAssets,"rcRed.png")
    Facelist.Add(mbm(1))
    mbm(2).Initialize(File.DirAssets,"rcBlue.png")
    Facelist.Add(mbm(2))
    mbm(3).Initialize(File.DirAssets,"rcGreen.png")
    Facelist.Add(mbm(3))
    mbm(4).Initialize(File.DirAssets,"rcWhite.png")
    Facelist.Add(mbm(4))
    mbm(5).Initialize(File.DirAssets,"rcOrange.png")
    Facelist.Add(mbm(5))
   
    GLS1.Color = Colors.Transparent    '    does not work
    'pass (List) facelist on to the wrapper
    GLS1.SixFaces = Facelist
   
    'this has to be set AFTER the LIST has been passed to the wrapper
    GLS1.ZoomInOut = True                       'it will make the cube zoom In/Out while spinning anround the below defined RotationPlane
    'GLS1.CubeSpeed = 3.0                        'A negative value will reverse the direction of the spin
    GLS1.CubeSpeed = 1.0                        'A negative value will reverse the direction of the spin
    GLS1.RotationPlane(1.0, -1.0, 0.0)          'Keep these values between 0.0 and 1.0 (you can also apply negative values)
   
    Return 0
   
End Sub
Go here

 
Upvote 0
Top