Result = OpenScreen(Width, Height, Depth, Title$ [, FlipMode [, RefreshRate]])
Opens a new screen according to the specified 'Width', 'Height' and 'Depth'. InitSprite() has to be called successfully before using this command. The opened screen is created with 2 video buffers to allow double buffering, especially useful for games. The buffers can be manipulated with the FlipBuffers() function.


Width, Height The screen resolution, in pixels. The specified resolution has to be supported or the screen won't be created. ExamineScreenModes() can be used to get a full list of supported resolution.
Depth It can be one the following values:
  16: 65000 colors, fixed palette
  24: 16 Mo colors, fixed palette
  32: 16 Mo colors, faster than 24-bit mode, allows alpha blending
Title$ The title for the application which will be displayed when switching back to the desktop. (Windows only). It will be displayed in the taskbar, so it's recommended to use a title related to the application name.
FlipMode (optional) Sets the screen synchronization methods used when flipping buffers (also known as 'Vertical blank synchronization'). It can have one of the following values:
   #PB_Screen_NoSynchronization   : disable synchronization 
   #PB_Screen_WaitSynchronization : enable synchronization (default value)
   #PB_Screen_SmartSynchronization: enable synchronization, with a CPU saver routine when the program doesn't consume
                                    all the CPU time (full screen mode only)
Waiting for the screen synchronization allows the flip to be perfect (no 'tearing' or other visible artifacts) because the flip is performed when the screen has been fully drawn (and when the screen spot is outside of visible screen area). This also link the flip frequence to the actual screen refresh, ie: for 60Hz screen it could have at most 60 flip per seconds, etc.
RefreshRate (optional) Set the refresh rate (in Hz) for the new screen. If it can't be handled, then OpenScreen() will fail. ExamineScreenModes() can be used to get a full list of supported refresh rates.
Note: on Windows, the refresh rate could be locked or forced by the video card drivers, so it could be inaccurate.

Return value

Nonzero if the screen has been successfully opened, zero otherwise.


The Requester functions cannot be used on screens created with OpenScreen.

To open a screen area on a regular window, see OpenWindowedScreen().

See Also

OpenWindowedScreen(), FlipBuffers()

Supported OS


<- NextScreenMode() - Screen Index - OpenWindowedScreen() ->