Page 1 of 1

Blank sprite in OpenGL full screen

Posted: Wed Jan 23, 2019 12:48 pm
by troy
I see a different result on this code. A sprite on the top left is showing fine with default D3D subsystem, and as blank white w/o texture when OpenGL subsystem is specified. Can anyone confirm that?

Code: Select all

#CameraSpeed = 0.04

Enumeration
  #MainWindow
EndEnumeration

Define.f KeyX, KeyY, MouseX, MouseY, RatioX, RatioY

InitEngine3D()

  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Models", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Scripts", #PB_3DArchive_FileSystem)
  Parse3DScripts()
 
  InitSprite()
  InitKeyboard()
  InitMouse()
 
  w.l = 1920 ;800
  h.l = 1080 ;600
  ratio.f = w/h
  
  OpenScreen(w, h, 32, "sprite in 3d", #PB_Screen_SmartSynchronization)
  ;OpenWindow(0, 0, 0, w, h, "sprite in 3d", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
  ;OpenWindowedScreen(WindowID(0), 0, 0, w, h, 0, 0, 0)
  AmbientColor(RGB(255, 255, 255))
  
  ;- Camera
  factor.f = 0.935
  distance.l = 20
  CreateCamera(0, 0, 0, 100, 100)
  CameraFOV(0, 50)
  MoveCamera(0, 0, 0, distance, #PB_Absolute)
  CameraLookAt(0,0,0,0)
  CameraBackColor(0, RGB(0, 255, 0))
 
  ; Background
  sizeZ.f = distance * factor
  sizeX.f = sizeZ * ratio
  CreateMaterial(0, LoadTexture(0, "ground_diffuse.png"))
  CreatePlane(0, sizeX, sizeZ, 1, 1, 1, 1)
  CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, 0)
  RotateEntity(0, 90, 0, 0)
  
  ; Sprite
  LoadSprite(0, #PB_Compiler_Home + "examples/sources/Data/PureBasic.bmp")
  
  ; Robot
  ;CreateMaterial(1, LoadTexture(1, "r2skin.jpg"))
  LoadMesh(1, "robot.mesh")
  CreateEntity(1, MeshID(1), #PB_Material_None, 0, 0, 10)
  ScaleEntity(1, 0.02, 0.02, 0.02)
  StartEntityAnimation(1, "Walk", #PB_EntityAnimation_Average)
   
  Repeat
      
    ;Event = WindowEvent()
    
    ExamineKeyboard()    
    
    RenderWorld()
      
    DisplayTransparentSprite(0, 100, 100)
       
    FlipBuffers()
      
  Until KeyboardPushed(#PB_Key_Escape) Or Event = #PB_Event_CloseWindow

End

Re: Blank sprite in OpenGL full screen

Posted: Sat Jan 26, 2019 1:37 pm
by DK_PETER
Edit
(Try) Load as image instead of sprite, create a new sprite and draw the image to the newly created sprite.