[PB6.02] ScreenID() allways null

Just starting out? Need help? Post your questions and find answers here.
User avatar
Regenduft
Enthusiast
Enthusiast
Posts: 121
Joined: Mon Mar 02, 2009 9:20 pm
Location: Germany

[PB6.02] ScreenID() allways null

Post by Regenduft »

PureBasic 6.02 LTS on Windows 11

With OpenGL (default subsystem) ScreenID() always returns null.
But ScreenID() works fine with subsystems DirectX9 and DirectX11.
( x64 and x86; ASM and C backend )

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Sprite example file (slightly modified)
;
;    (c) Fantaisie Software
;
; ------------------------------------------------------------
;


;#########################################################################################################
; With OpenGL (default subsystem) ScreenID() always returns null.
; But ScreenID() works fine with subsystems DirectX9 and DirectX11.
; ( x64 and x86; ASM and C backend )
;#########################################################################################################
;DirectX9
;DirectX11


If InitSprite() = 0 Or InitKeyboard() = 0
  MessageRequester("Error", "Sprite system can't be initialized", 0)
  End
EndIf

If ExamineDesktops() = 0
  MessageRequester("Error", "ExamineDesktops() = 0", 0)
  End
EndIf
sw = DesktopWidth(0)
sh = DesktopHeight(0)
sd = DesktopDepth(0)

If OpenScreen(sw, sh, sd, "Sprite")

  ; Load our 16 bit sprite (which is a 24 bit picture in fact, as BMP doesn't support 16 bit format)
  ;
  LoadSprite(0, #PB_Compiler_Home + "examples/sources/Data/PureBasic.bmp")
  CopySprite(0, 1, 0)
  
  Repeat
    
    ; Inverse the buffers (the back become the front (visible)... And we can do the rendering on the back)
    
    FlipBuffers()
    
    ClearScreen(RGB(0,0,0))
    
    ; Draw our sprite

    ClipSprite(0, 0, 0, x, x/8)
     
    DisplaySprite(0, x, 100)
    DisplaySprite(1, x, x)
    DisplaySprite(0, 600-x, x)
    
    ;#####################################################################################################
    ; Draw ScreenID (upper left screen corner)
    ;#####################################################################################################
    If StartDrawing(ScreenOutput())
      DrawText(0, 0, "ScreenID = "+Str(ScreenID()))
      StopDrawing()
    EndIf
    
    x+1
    
    ExamineKeyboard()
  Until KeyboardPushed(#PB_Key_Escape)
  
Else
  MessageRequester("Error", "Can't open a "+sw+"*"+sh+" - "+sd+" bit screen !", 0)
EndIf
User avatar
Demivec
Addict
Addict
Posts: 4085
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: [PB6.02] ScreenID() allways null

Post by Demivec »

Help for ScreenID() wrote:Supported OS

Windows (DirectX), Linux (SDL)
User avatar
Regenduft
Enthusiast
Enthusiast
Posts: 121
Joined: Mon Mar 02, 2009 9:20 pm
Location: Germany

Re: [PB6.02] ScreenID() allways null

Post by Regenduft »

Thank you, I overlooked that piece of information!

So... since Engine3D is OpenGL only and PlayMovie() needs a WindowID (or ScreenID)... that means you can't play movies anymore when using Engine3D? That would be quite dissapointing...
Post Reply