Documentation ¶
Index ¶
- Constants
- func DefaultWindowHints() error
- func DetachCurrentContext() error
- func ExtensionSupported(extension string) (bool, error)
- func GetClipboardString() (string, error)
- func GetKeyName(key Key, scancode int) (string, error)
- func GetKeyScancode(key Key) int
- func GetProcAddress(procname string) (unsafe.Pointer, error)
- func GetVersion() (major, minor, revision int)
- func GetVersionString() string
- func GetX11Display() (*C.Display, error)
- func GetX11SelectionString() string
- func Init() error
- func InitHint(hint Hint, value int)
- func PollEvents() error
- func PostEmptyEvent() error
- func RawMouseMotionSupported() bool
- func SetClipboardString(str string) error
- func SetX11SelectionString(str string)
- func SwapInterval(interval int) error
- func Terminate() error
- func WaitEvents() error
- func WaitEventsTimeout(timeout float64) error
- func WindowHint(target Hint, hint int) error
- func WindowHintString(hint Hint, value string)
- type Action
- type CharCallback
- type CharModsCallback
- type CloseCallback
- type ContentScaleCallback
- type Cursor
- type CursorEnterCallback
- type CursorPosCallback
- type DropCallback
- type ErrorCode
- type FocusCallback
- type FramebufferSizeCallback
- type GammaRamp
- type Hint
- type IconifyCallback
- type Image
- type InputMode
- type Key
- type KeyCallback
- type MaximizeCallback
- type ModifierKey
- type Monitor
- func (m *Monitor) GetContentScale() (float32, float32, error)
- func (m *Monitor) GetGammaRamp() (*GammaRamp, error)
- func (m *Monitor) GetName() (string, error)
- func (m *Monitor) GetPhysicalSize() (width, height int, err error)
- func (m *Monitor) GetPos() (x, y int, err error)
- func (m *Monitor) GetUserPointer() unsafe.Pointer
- func (m *Monitor) GetVideoMode() (*VidMode, error)
- func (m *Monitor) GetVideoModes() ([]*VidMode, error)
- func (m *Monitor) GetWorkarea() (x, y, width, height int)
- func (m *Monitor) GetX11Adapter() (C.RRCrtc, error)
- func (m *Monitor) GetX11Monitor() (C.RROutput, error)
- func (m *Monitor) SetGamma(gamma float32) error
- func (m *Monitor) SetGammaRamp(ramp *GammaRamp) error
- func (m *Monitor) SetUserPointer(pointer unsafe.Pointer)
- type MonitorCallback
- type MouseButton
- type MouseButtonCallback
- type PeripheralEvent
- type PosCallback
- type RefreshCallback
- type ScrollCallback
- type SizeCallback
- type StandardCursor
- type VidMode
- type Window
- func (w *Window) Destroy() error
- func (w *Window) Focus() error
- func (w *Window) GetAttrib(attrib Hint) (int, error)
- func (w *Window) GetClipboardString() (string, error)
- func (w *Window) GetContentScale() (float32, float32)
- func (w *Window) GetCursorPos() (x, y float64, err error)
- func (w *Window) GetFrameSize() (left, top, right, bottom int, err error)
- func (w *Window) GetFramebufferSize() (width, height int, err error)
- func (w *Window) GetGLXContext() (C.GLXContext, error)
- func (w *Window) GetGLXWindow() (C.GLXWindow, error)
- func (w *Window) GetInputMode(mode InputMode) (int, error)
- func (w *Window) GetKey(key Key) (Action, error)
- func (w *Window) GetMonitor() (*Monitor, error)
- func (w *Window) GetMouseButton(button MouseButton) (Action, error)
- func (w *Window) GetOpacity() float32
- func (w *Window) GetPos() (x, y int, err error)
- func (w *Window) GetSize() (width, height int, err error)
- func (w *Window) GetUserPointer() (unsafe.Pointer, error)
- func (w *Window) GetX11Window() (C.Window, error)
- func (w *Window) Handle() unsafe.Pointer
- func (w *Window) Hide() error
- func (w *Window) Iconify() error
- func (w *Window) MakeContextCurrent() error
- func (w *Window) Maximize() error
- func (w *Window) RequestAttention()
- func (w *Window) Restore() error
- func (w *Window) SetAspectRatio(numer, denom int) error
- func (w *Window) SetAttrib(attrib Hint, value int) error
- func (w *Window) SetCharCallback(cbfun CharCallback) (previous CharCallback, err error)
- func (w *Window) SetCharModsCallback(cbfun CharModsCallback) (previous CharModsCallback, err error)deprecated
- func (w *Window) SetClipboardString(str string) error
- func (w *Window) SetCloseCallback(cbfun CloseCallback) (previous CloseCallback, err error)
- func (w *Window) SetContentScaleCallback(cbfun ContentScaleCallback) (ContentScaleCallback, error)
- func (w *Window) SetCursor(c *Cursor) error
- func (w *Window) SetCursorEnterCallback(cbfun CursorEnterCallback) (previous CursorEnterCallback, err error)
- func (w *Window) SetCursorPos(xpos, ypos float64) error
- func (w *Window) SetCursorPosCallback(cbfun CursorPosCallback) (previous CursorPosCallback, err error)
- func (w *Window) SetDropCallback(cbfun DropCallback) (previous DropCallback, err error)
- func (w *Window) SetFocusCallback(cbfun FocusCallback) (previous FocusCallback, err error)
- func (w *Window) SetFramebufferSizeCallback(cbfun FramebufferSizeCallback) (previous FramebufferSizeCallback, err error)
- func (w *Window) SetIcon(images []image.Image) error
- func (w *Window) SetIconifyCallback(cbfun IconifyCallback) (previous IconifyCallback, err error)
- func (w *Window) SetInputMode(mode InputMode, value int) error
- func (w *Window) SetKeyCallback(cbfun KeyCallback) (previous KeyCallback, err error)
- func (w *Window) SetMaximizeCallback(cbfun MaximizeCallback) MaximizeCallback
- func (w *Window) SetMonitor(monitor *Monitor, xpos, ypos, width, height, refreshRate int) error
- func (w *Window) SetMouseButtonCallback(cbfun MouseButtonCallback) (previous MouseButtonCallback, err error)
- func (w *Window) SetOpacity(opacity float32)
- func (w *Window) SetPos(xpos, ypos int) error
- func (w *Window) SetPosCallback(cbfun PosCallback) (previous PosCallback, err error)
- func (w *Window) SetRefreshCallback(cbfun RefreshCallback) (previous RefreshCallback, err error)
- func (w *Window) SetScrollCallback(cbfun ScrollCallback) (previous ScrollCallback, err error)
- func (w *Window) SetShouldClose(value bool) error
- func (w *Window) SetSize(width, height int) error
- func (w *Window) SetSizeCallback(cbfun SizeCallback) (previous SizeCallback, err error)
- func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) error
- func (w *Window) SetTitle(title string) error
- func (w *Window) SetUserPointer(pointer unsafe.Pointer) error
- func (w *Window) ShouldClose() (bool, error)
- func (w *Window) Show() error
- func (w *Window) SwapBuffers() error
Constants ¶
const ( DontCare = -1 False = 0 True = 1 )
const ( Release = Action(0) Press = Action(1) Repeat = Action(2) )
const ( ModAlt = ModifierKey(0x0004) ModCapsLock = ModifierKey(0x0010) ModControl = ModifierKey(0x0002) ModNumLock = ModifierKey(0x0020) ModShift = ModifierKey(0x0001) ModSuper = ModifierKey(0x0008) )
const ( MouseButton1 = MouseButton(0) MouseButton2 = MouseButton(1) MouseButton3 = MouseButton(2) MouseButton4 = MouseButton(3) MouseButton5 = MouseButton(4) MouseButton6 = MouseButton(5) MouseButton7 = MouseButton(6) MouseButton8 = MouseButton(7) MouseButtonLast = MouseButton8 MouseButtonLeft = MouseButton1 MouseButtonRight = MouseButton2 MouseButtonMiddle = MouseButton3 )
const ( AccumAlphaBits = Hint(0x0002100A) AccumBlueBits = Hint(0x00021009) AccumGreenBits = Hint(0x00021008) AccumRedBits = Hint(0x00021007) AlphaBits = Hint(0x00021004) AutoIconify = Hint(0x00020006) AuxBuffers = Hint(0x0002100B) BlueBits = Hint(0x00021003) CenterCursor = Hint(0x00020009) ClientAPI = Hint(0x00022001) ContextCreationAPI = Hint(0x0002200B) ContextNoError = Hint(0x0002200A) ContextReleaseBehavior = Hint(0x00022009) ContextRevision = Hint(0x00022004) ContextRobustness = Hint(0x00022005) ContextVersionMajor = Hint(0x00022002) ContextVersionMinor = Hint(0x00022003) Decorated = Hint(0x00020005) DepthBits = Hint(0x00021005) DoubleBuffer = Hint(0x00021010) Floating = Hint(0x00020007) Focused = Hint(0x00020001) FocusOnShow = Hint(0x0002000C) GreenBits = Hint(0x00021002) Hovered = Hint(0x0002000B) Iconified = Hint(0x00020002) Maximized = Hint(0x00020008) MousePassthrough = Hint(0x0002000D) OpenGLDebugContext = Hint(0x00022007) OpenGLForwardCompat = Hint(0x00022006) OpenGLProfile = Hint(0x00022008) RedBits = Hint(0x00021001) RefreshRate = Hint(0x0002100F) Resizable = Hint(0x00020003) Samples = Hint(0x0002100D) ScaleToMonitor = Hint(0x0002200C) SRGBCapable = Hint(0x0002100E) StencilBits = Hint(0x00021006) Stereo = Hint(0x0002100C) TransparentFramebuffer = Hint(0x0002000A) Visible = Hint(0x00020004) )
const ( CursorMode = InputMode(0x00033001) LockKeyMods = InputMode(0x00033004) RawMouseMotion = InputMode(0x00033005) StickyKeysMode = InputMode(0x00033002) StickyMouseButtonsMode = InputMode(0x00033003) )
const ( AnyReleaseBehavior = 0 CursorDisabled = 0x00034003 CursorHidden = 0x00034002 CursorNormal = 0x00034001 EGLContextAPI = 0x00036002 LoseContextOnReset = 0x00031002 NativeContextAPI = 0x00036001 NoAPI = 0 NoResetNotification = 0x00031001 NoRobustness = 0 OpenGLAPI = 0x00030001 OpenGLAnyProfile = 0 OpenGLCompatProfile = 0x00032002 OpenGLCoreProfile = 0x00032001 OpenGLESAPI = 0x00030002 OSMesaContextAPI = 0x00036003 ReleaseBehaviorFlush = 0x00035001 ReleaseBehaviorNone = 0x00035002 )
const ( NotInitialized = ErrorCode(0x00010001) NoCurrentContext = ErrorCode(0x00010002) InvalidEnum = ErrorCode(0x00010003) InvalidValue = ErrorCode(0x00010004) OutOfMemory = ErrorCode(0x00010005) PlatformError = ErrorCode(0x00010008) NoWindowContext = ErrorCode(0x0001000A) )
const ( Connected = PeripheralEvent(0x00040001) Disconnected = PeripheralEvent(0x00040002) )
const ( ArrowCursor = StandardCursor(0x00036001) IBeamCursor = StandardCursor(0x00036002) CrosshairCursor = StandardCursor(0x00036003) HandCursor = StandardCursor(0x00036004) HResizeCursor = StandardCursor(0x00036005) VResizeCursor = StandardCursor(0x00036006) // v3.4 ResizeNWSECursor = StandardCursor(0x00036007) ResizeNESWCursor = StandardCursor(0x00036008) ResizeAllCursor = StandardCursor(0x00036009) NotAllowedCursor = StandardCursor(0x0003600A) )
const ( VersionMajor = C.GLFW_VERSION_MAJOR // This is incremented when the API is changed in non-compatible ways. VersionMinor = C.GLFW_VERSION_MINOR // This is incremented when features are added to the API but it remains backward-compatible. VersionRevision = C.GLFW_VERSION_REVISION // This is incremented when a bug fix release is made that does not contain any API changes. )
Version constants.
const ( Key0 = Key(48) Key1 = Key(49) Key2 = Key(50) Key3 = Key(51) Key4 = Key(52) Key5 = Key(53) Key6 = Key(54) Key7 = Key(55) Key8 = Key(56) Key9 = Key(57) KeyA = Key(65) KeyApostrophe = Key(39) KeyB = Key(66) KeyBackslash = Key(92) KeyBackspace = Key(259) KeyC = Key(67) KeyCapsLock = Key(280) KeyComma = Key(44) KeyD = Key(68) KeyDelete = Key(261) KeyDown = Key(264) KeyE = Key(69) KeyEnd = Key(269) KeyEnter = Key(257) KeyEqual = Key(61) KeyEscape = Key(256) KeyF = Key(70) KeyF1 = Key(290) KeyF10 = Key(299) KeyF11 = Key(300) KeyF12 = Key(301) KeyF13 = Key(302) KeyF14 = Key(303) KeyF15 = Key(304) KeyF16 = Key(305) KeyF17 = Key(306) KeyF18 = Key(307) KeyF19 = Key(308) KeyF2 = Key(291) KeyF20 = Key(309) KeyF21 = Key(310) KeyF22 = Key(311) KeyF23 = Key(312) KeyF24 = Key(313) KeyF3 = Key(292) KeyF4 = Key(293) KeyF5 = Key(294) KeyF6 = Key(295) KeyF7 = Key(296) KeyF8 = Key(297) KeyF9 = Key(298) KeyG = Key(71) KeyGraveAccent = Key(96) KeyH = Key(72) KeyHome = Key(268) KeyI = Key(73) KeyInsert = Key(260) KeyJ = Key(74) KeyK = Key(75) KeyKP0 = Key(320) KeyKP1 = Key(321) KeyKP2 = Key(322) KeyKP3 = Key(323) KeyKP4 = Key(324) KeyKP5 = Key(325) KeyKP6 = Key(326) KeyKP7 = Key(327) KeyKP8 = Key(328) KeyKP9 = Key(329) KeyKPAdd = Key(334) KeyKPDecimal = Key(330) KeyKPDivide = Key(331) KeyKPEnter = Key(335) KeyKPEqual = Key(336) KeyKPMultiply = Key(332) KeyKPSubtract = Key(333) KeyL = Key(76) KeyLast = Key(348) KeyLeft = Key(263) KeyLeftAlt = Key(342) KeyLeftBracket = Key(91) KeyLeftControl = Key(341) KeyLeftShift = Key(340) KeyLeftSuper = Key(343) KeyM = Key(77) KeyMenu = Key(348) KeyMinus = Key(45) KeyN = Key(78) KeyNumLock = Key(282) KeyO = Key(79) KeyP = Key(80) KeyPageDown = Key(267) KeyPageUp = Key(266) KeyPause = Key(284) KeyPeriod = Key(46) KeyPrintScreen = Key(283) KeyQ = Key(81) KeyR = Key(82) KeyRight = Key(262) KeyRightAlt = Key(346) KeyRightBracket = Key(93) KeyRightControl = Key(345) KeyRightShift = Key(344) KeyRightSuper = Key(347) KeyS = Key(83) KeyScrollLock = Key(281) KeySemicolon = Key(59) KeySlash = Key(47) KeySpace = Key(32) KeyT = Key(84) KeyTab = Key(258) KeyU = Key(85) KeyUnknown = Key(-1) KeyUp = Key(265) KeyV = Key(86) KeyW = Key(87) KeyWorld1 = Key(161) KeyWorld2 = Key(162) KeyX = Key(88) KeyY = Key(89) KeyZ = Key(90) )
Variables ¶
This section is empty.
Functions ¶
func DefaultWindowHints ¶ added in v2.7.0
func DefaultWindowHints() error
DefaultWindowHints resets all window hints to their default values.
This function may only be called from the main thread.
func DetachCurrentContext ¶ added in v2.7.0
func DetachCurrentContext() error
DetachCurrentContext detaches the current context.
func ExtensionSupported ¶ added in v2.7.0
ExtensionSupported reports whether the specified OpenGL or context creation API extension is supported by the current context. For example, on Windows both the OpenGL and WGL extension strings are checked.
As this functions searches one or more extension strings on each call, it is recommended that you cache its results if it's going to be used frequently. The extension strings will not change during the lifetime of a context, so there is no danger in doing this.
func GetClipboardString ¶ added in v2.7.0
GetClipboardString returns the contents of the system clipboard, if it contains or is convertible to a UTF-8 encoded string.
This function may only be called from the main thread.
func GetKeyName ¶ added in v2.5.0
GetKeyName returns the localized name of the specified printable key.
If the key is glfw.KeyUnknown, the scancode is used, otherwise the scancode is ignored.
func GetKeyScancode ¶ added in v2.7.0
GetKeyScancode function returns the platform-specific scancode of the specified key.
If the key is KeyUnknown or does not exist on the keyboard this method will return -1.
func GetProcAddress ¶ added in v2.7.0
GetProcAddress returns the address of the specified OpenGL or OpenGL ES core or extension function, if it is supported by the current context.
A context must be current on the calling thread. Calling this function without a current context will cause a GLFW_NO_CURRENT_CONTEXT error.
This function is used to provide GL proc resolving capabilities to an external C library.
func GetVersion ¶ added in v2.7.0
func GetVersion() (major, minor, revision int)
GetVersion retrieves the major, minor and revision numbers of the GLFW library. It is intended for when you are using GLFW as a shared library and want to ensure that you are using the minimum required version.
This function may be called before Init.
func GetVersionString ¶ added in v2.7.0
func GetVersionString() string
GetVersionString returns a static string generated at compile-time according to which configuration macros were defined. This is intended for use when submitting bug reports, to allow developers to see which code paths are enabled in a binary.
This function may be called before Init.
func GetX11Display ¶ added in v2.7.0
func GetX11SelectionString ¶ added in v2.7.0
func GetX11SelectionString() string
GetX11SelectionString gets the X11 selection string.
func Init ¶
func Init() error
Init initializes the GLFW library. Before most GLFW functions can be used, GLFW must be initialized, and before a program terminates GLFW should be terminated in order to free any resources allocated during or after initialization.
If this function fails, it calls Terminate before returning. If it succeeds, you should call Terminate before the program exits.
Additional calls to this function after successful initialization but before termination will succeed but will do nothing.
This function may take several seconds to complete on some systems, while on other systems it may take only a fraction of a second to complete.
On Mac OS X, this function will change the current directory of the application to the Contents/Resources subdirectory of the application's bundle, if present.
This function may only be called from the main thread.
func InitHint ¶ added in v2.7.0
InitHint function sets hints for the next initialization of GLFW.
The values you set hints to are never reset by GLFW, but they only take effect during initialization. Once GLFW has been initialized, any values you set will be ignored until the library is terminated and initialized again.
Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.
This function must only be called from the main thread.
func PollEvents ¶
func PollEvents() error
PollEvents processes only those events that have already been received and then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.
This function is not required for joystick input to work.
This function may not be called from a callback.
This function may only be called from the main thread.
func PostEmptyEvent ¶ added in v2.2.0
func PostEmptyEvent() error
PostEmptyEvent posts an empty event from the current thread to the main thread event queue, causing WaitEvents to return.
If no windows exist, this function returns immediately. For synchronization of threads in applications that do not create windows, use native Go primitives.
This function may be called from secondary threads.
func RawMouseMotionSupported ¶ added in v2.7.0
func RawMouseMotionSupported() bool
RawMouseMotionSupported returns whether raw mouse motion is supported on the current system. This status does not change after GLFW has been initialized so you only need to check this once. If you attempt to enable raw motion on a system that does not support it, PlatformError will be emitted.
Raw mouse motion is closer to the actual motion of the mouse across a surface. It is not affected by the scaling and acceleration applied to the motion of the desktop cursor. That processing is suitable for a cursor while raw motion is better for controlling for example a 3D camera. Because of this, raw mouse motion is only provided when the cursor is disabled.
This function must only be called from the main thread.
func SetClipboardString ¶ added in v2.7.0
SetClipboardString sets the system clipboard to the specified UTF-8 encoded string.
This function may only be called from the main thread.
func SetX11SelectionString ¶ added in v2.7.0
func SetX11SelectionString(str string)
SetX11SelectionString sets the X11 selection string.
func SwapInterval ¶
SwapInterval sets the swap interval for the current context, i.e. the number of screen updates to wait before swapping the buffers of a window and returning from SwapBuffers. This is sometimes called 'vertical synchronization', 'vertical retrace synchronization' or 'vsync'.
Contexts that support either of the WGL_EXT_swap_control_tear and GLX_EXT_swap_control_tear extensions also accept negative swap intervals, which allow the driver to swap even if a frame arrives a little bit late. You can check for the presence of these extensions using ExtensionSupported. For more information about swap tearing, see the extension specifications.
Some GPU drivers do not honor the requested swap interval, either because of user settings that override the request or due to bugs in the driver.
func Terminate ¶
func Terminate() error
Terminate destroys all remaining windows, frees any allocated resources and sets the library to an uninitialized state. Once this is called, you must again call Init successfully before you will be able to use most GLFW functions.
If GLFW has been successfully initialized, this function should be called before the program exits. If initialization fails, there is no need to call this function, as it is called by Init before it returns failure.
This function may only be called from the main thread.
func WaitEvents ¶ added in v2.2.0
func WaitEvents() error
WaitEvents puts the calling thread to sleep until at least one event has been received. Once one or more events have been recevied, it behaves as if PollEvents was called, i.e. the events are processed and the function then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.
Since not all events are associated with callbacks, this function may return without a callback having been called even if you are monitoring all callbacks.
This function may not be called from a callback.
This function may only be called from the main thread.
func WaitEventsTimeout ¶ added in v2.2.0
WaitEventsTimeout puts the calling thread to sleep until at least one event is available in the event queue, or until the specified timeout is reached. If one or more events are available, it behaves exactly like PollEvents, i.e. the events in the queue are processed and the function then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.
The timeout value must be a positive finite number.
Since not all events are associated with callbacks, this function may return without a callback having been called even if you are monitoring all callbacks.
On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.
On some platforms, certain callbacks may be called outside of a call to one of the event processing functions.
If no windows exist, this function returns immediately. For synchronization of threads in applications that do not create windows, use native Go primitives.
Event processing is not required for joystick input to work.
func WindowHint ¶
WindowHint sets hints for the next call to CreateWindow. The hints, once set, retain their values until changed by a call to WindowHint or DefaultWindowHints, or until the library is terminated with Terminate.
This function may only be called from the main thread.
func WindowHintString ¶ added in v2.7.0
WindowHintString sets hints for the next call to CreateWindow. The hints, once set, retain their values until changed by a call to this function or DefaultWindowHints, or until the library is terminated.
Only string type hints can be set with this function. Integer value hints are set with WindowHint.
This function does not check whether the specified hint values are valid. If you set hints to invalid values this will instead be reported by the next call to CreateWindow.
Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.
This function must only be called from the main thread.
Types ¶
type CharCallback ¶ added in v2.7.0
CharCallback is the character callback.
type CharModsCallback ¶
type CharModsCallback func(w *Window, char rune, mods ModifierKey)
CharModsCallback is the character with modifiers callback.
type CloseCallback ¶ added in v2.2.0
type CloseCallback func(w *Window)
CloseCallback is the window close callback.
type ContentScaleCallback ¶ added in v2.7.0
ContentScaleCallback is the function signature for window content scale callback functions.
type Cursor ¶ added in v2.1.0
type Cursor struct {
// contains filtered or unexported fields
}
Cursor represents a cursor.
func CreateCursor ¶ added in v2.7.0
CreateCursor creates a new custom cursor image that can be set for a window with SetCursor. The cursor can be destroyed with Destroy. Any remaining cursors are destroyed by Terminate.
The image is ideally provided in the form of *image.NRGBA. The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner. If the image type is not *image.NRGBA, it will be converted to it.
The cursor hotspot is specified in pixels, relative to the upper-left corner of the cursor image. Like all other coordinate systems in GLFW, the X-axis points to the right and the Y-axis points down.
func CreateStandardCursor ¶ added in v2.1.0
func CreateStandardCursor(shape StandardCursor) (*Cursor, error)
CreateStandardCursor returns a cursor with a standard shape, that can be set for a window with SetCursor.
type CursorEnterCallback ¶ added in v2.7.0
CursorEnterCallback is the cursor boundary crossing callback.
type CursorPosCallback ¶ added in v2.7.0
CursorPosCallback the cursor position callback.
type DropCallback ¶ added in v2.5.0
DropCallback is the drop callback.
type FocusCallback ¶ added in v2.7.0
FocusCallback is the window focus callback.
type FramebufferSizeCallback ¶
FramebufferSizeCallback is the framebuffer size callback.
type GammaRamp ¶ added in v2.7.0
type GammaRamp struct { Red []uint16 // A slice of value describing the response of the red channel. Green []uint16 // A slice of value describing the response of the green channel. Blue []uint16 // A slice of value describing the response of the blue channel. }
GammaRamp describes the gamma ramp for a monitor.
type IconifyCallback ¶ added in v2.7.0
IconifyCallback is the window iconification callback.
type KeyCallback ¶ added in v2.7.0
type KeyCallback func(w *Window, key Key, scancode int, action Action, mods ModifierKey)
KeyCallback is the key callback.
type MaximizeCallback ¶ added in v2.7.0
MaximizeCallback is the function signature for window maximize callback functions.
type ModifierKey ¶
type ModifierKey int
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor represents a monitor.
func GetMonitors ¶
GetMonitors returns a slice of handles for all currently connected monitors.
func GetPrimaryMonitor ¶
GetPrimaryMonitor returns the primary monitor. This is usually the monitor where elements like the Windows task bar or the OS X menu bar is located.
func (*Monitor) GetContentScale ¶
GetContentScale function retrieves the content scale for the specified monitor. The content scale is the ratio between the current DPI and the platform's default DPI. If you scale all pixel dimensions by this scale then your content should appear at an appropriate size. This is especially important for text and any UI elements.
This function must only be called from the main thread.
func (*Monitor) GetGammaRamp ¶ added in v2.7.0
GetGammaRamp retrieves the current gamma ramp of the monitor.
func (*Monitor) GetName ¶ added in v2.6.0
GetName returns a human-readable name of the monitor, encoded as UTF-8.
func (*Monitor) GetPhysicalSize ¶ added in v2.7.0
GetPhysicalSize returns the size, in millimetres, of the display area of the monitor.
Note: Some operating systems do not provide accurate information, either because the monitor's EDID data is incorrect, or because the driver does not report it accurately.
func (*Monitor) GetPos ¶
GetPos returns the position, in screen coordinates, of the upper-left corner of the monitor.
func (*Monitor) GetUserPointer ¶ added in v2.7.0
GetUserPointer returns the current value of the user-defined pointer of the monitor. The initial value is nil.
This function may be called from the monitor callback, even for a monitor that is being disconnected.
This function may be called from any thread. Access is not synchronized.
func (*Monitor) GetVideoMode ¶
GetVideoMode returns the current video mode of the monitor. If you are using a full screen window, the return value will therefore depend on whether it is focused.
func (*Monitor) GetVideoModes ¶ added in v2.7.0
GetVideoModes returns an array of all video modes supported by the monitor. The returned array is sorted in ascending order, first by color bit depth (the sum of all channel depths) and then by resolution area (the product of width and height).
func (*Monitor) GetWorkarea ¶ added in v2.7.0
GetWorkarea returns the position, in screen coordinates, of the upper-left corner of the work area of the specified monitor along with the work area size in screen coordinates. The work area is defined as the area of the monitor not occluded by the operating system task bar where present. If no task bar exists then the work area is the monitor resolution in screen coordinates.
This function must only be called from the main thread.
func (*Monitor) GetX11Adapter ¶ added in v2.7.0
GetX11Adapter returns the RRCrtc of the monitor.
func (*Monitor) GetX11Monitor ¶ added in v2.7.0
GetX11Monitor returns the RROutput of the monitor.
func (*Monitor) SetGamma ¶ added in v2.7.0
SetGamma generates a 256-element gamma ramp from the specified exponent and then calls SetGamma with it.
func (*Monitor) SetGammaRamp ¶ added in v2.7.0
SetGammaRamp sets the current gamma ramp for the monitor.
func (*Monitor) SetUserPointer ¶ added in v2.7.0
SetUserPointer sets the user-defined pointer of the monitor. The current value is retained until the monitor is disconnected. The initial value is nil.
This function may be called from the monitor callback, even for a monitor that is being disconnected.
This function may be called from any thread. Access is not synchronized.
type MonitorCallback ¶ added in v2.4.0
type MonitorCallback func(monitor *Monitor, event PeripheralEvent)
MonitorCallback is the signature for monitor configuration callback functions.
func SetMonitorCallback ¶
func SetMonitorCallback(cbfun MonitorCallback) (MonitorCallback, error)
SetMonitorCallback sets the monitor configuration callback, or removes the currently set callback. This is called when a monitor is connected to or disconnected from the system.
This function must only be called from the main thread.
type MouseButton ¶
type MouseButton int
type MouseButtonCallback ¶ added in v2.7.0
type MouseButtonCallback func(w *Window, button MouseButton, action Action, mods ModifierKey)
MouseButtonCallback is the mouse button callback.
type PeripheralEvent ¶
type PeripheralEvent int
type PosCallback ¶ added in v2.7.0
PosCallback is the window position callback.
type RefreshCallback ¶ added in v2.7.0
type RefreshCallback func(w *Window)
RefreshCallback is the window refresh callback.
type ScrollCallback ¶
ScrollCallback is the scroll callback.
type SizeCallback ¶
SizeCallback is the window size callback.
type StandardCursor ¶ added in v2.1.0
type StandardCursor int
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window represents a window.
func CreateWindow ¶
func CreateWindow(width, height int, title string, monitor *Monitor, share *Window) (*Window, error)
CreateWindow creates a window and its associated context. Most of the options controlling how the window and its context should be created are specified through Hint.
Successful creation does not change which context is current. Before you can use the newly created context, you need to make it current using MakeContextCurrent.
Note that the created window and context may differ from what you requested, as not all parameters and hints are hard constraints. This includes the size of the window, especially for full screen windows. To retrieve the actual attributes of the created window and context, use queries like Window.GetAttrib and Window.GetSize.
To create the window at a specific position, make it initially invisible using the Visible window hint, set its position and then show it.
If a fullscreen window is active, the screensaver is prohibited from starting.
Windows: If the executable has an icon resource named GLFW_ICON, it will be set as the icon for the window. If no such icon is present, the IDI_WINLOGO icon will be used instead.
Mac OS X: The GLFW window has no icon, as it is not a document window, but the dock icon will be the same as the application bundle's icon. Also, the first time a window is opened the menu bar is populated with common commands like Hide, Quit and About. The (minimal) about dialog uses information from the application's bundle. For more information on bundles, see the Bundle Programming Guide provided by Apple.
This function may only be called from the main thread.
func GetCurrentContext ¶ added in v2.7.0
GetCurrentContext returns the window whose context is current.
func GoWindow ¶ added in v2.7.0
GoWindow creates a Window from a *C.GLFWwindow reference. Used when an external C library is calling your Go handlers.
func (*Window) Destroy ¶
Destroy destroys the specified window and its context. On calling this function, no further callbacks will be called for that window.
This function may only be called from the main thread.
func (*Window) Focus ¶ added in v2.4.0
Focus brings the specified window to front and sets input focus. The window should already be visible and not iconified.
By default, both windowed and full screen mode windows are focused when initially created. Set the glfw.Focused to disable this behavior.
Do not use this function to steal focus from other applications unless you are certain that is what the user wants. Focus stealing can be extremely disruptive.
func (*Window) GetAttrib ¶
GetAttrib returns an attribute of the window. There are many attributes, some related to the window and others to its context.
func (*Window) GetClipboardString ¶ added in v2.7.0
GetClipboardString returns the contents of the system clipboard, if it contains or is convertible to a UTF-8 encoded string.
Ownership to the Window is no longer necessary, see glfw.GetClipboardString()
This function may only be called from the main thread.
func (*Window) GetContentScale ¶ added in v2.7.0
GetContentScale function retrieves the content scale for the specified window. The content scale is the ratio between the current DPI and the platform's default DPI. If you scale all pixel dimensions by this scale then your content should appear at an appropriate size. This is especially important for text and any UI elements.
This function may only be called from the main thread.
func (*Window) GetCursorPos ¶
GetCursorPos returns the last reported position of the cursor.
If the cursor is disabled (with CursorDisabled) then the cursor position is unbounded and limited only by the minimum and maximum values of a double.
The coordinate can be converted to their integer equivalents with the floor function. Casting directly to an integer type works for positive coordinates, but fails for negative ones.
func (*Window) GetFrameSize ¶ added in v2.7.0
GetFrameSize retrieves the size, in screen coordinates, of each edge of the frame of the specified window. This size includes the title bar, if the window has one. The size of the frame may vary depending on the window-related hints used to create it.
Because this function retrieves the size of each window frame edge and not the offset along a particular coordinate axis, the retrieved values will always be zero or positive.
func (*Window) GetFramebufferSize ¶ added in v2.7.0
GetFramebufferSize retrieves the size, in pixels, of the framebuffer of the specified window.
func (*Window) GetGLXContext ¶ added in v2.7.0
func (w *Window) GetGLXContext() (C.GLXContext, error)
GetGLXContext returns the GLXContext of the window.
func (*Window) GetGLXWindow ¶ added in v2.7.0
GetGLXWindow returns the GLXWindow of the window.
func (*Window) GetInputMode ¶
GetInputMode returns the value of an input option of the window.
func (*Window) GetKey ¶
GetKey returns the last reported state of a keyboard key. The returned state is one of Press or Release. The higher-level state Repeat is only reported to the key callback.
If the StickyKeys input mode is enabled, this function returns Press the first time you call this function after a key has been pressed, even if the key has already been released.
The key functions deal with physical keys, with key tokens named after their use on the standard US keyboard layout. If you want to input text, use the Unicode character callback instead.
func (*Window) GetMonitor ¶
GetMonitor returns the handle of the monitor that the window is in fullscreen on.
Returns nil if the window is in windowed mode.
func (*Window) GetMouseButton ¶
func (w *Window) GetMouseButton(button MouseButton) (Action, error)
GetMouseButton returns the last state reported for the specified mouse button.
If the StickyMouseButtons input mode is enabled, this function returns Press the first time you call this function after a mouse button has been pressed, even if the mouse button has already been released.
func (*Window) GetOpacity ¶ added in v2.7.0
GetOpacity function returns the opacity of the window, including any decorations.
The opacity (or alpha) value is a positive finite number between zero and one, where zero is fully transparent and one is fully opaque. If the system does not support whole window transparency, this function always returns one.
The initial opacity value for newly created windows is one.
This function may only be called from the main thread.
func (*Window) GetPos ¶
GetPos returns the position, in screen coordinates, of the upper-left corner of the client area of the window.
func (*Window) GetSize ¶
GetSize returns the size, in screen coordinates, of the client area of the specified window.
func (*Window) GetUserPointer ¶ added in v2.7.0
GetUserPointer returns the current value of the user-defined pointer of the window. The initial value is nil.
func (*Window) GetX11Window ¶ added in v2.7.0
GetX11Window returns the Window of the window.
func (*Window) Handle ¶ added in v2.7.0
Handle returns a *C.GLFWwindow reference (i.e. the GLFW window itself). This can be used for passing the GLFW window handle to external libraries like vulkan-go.
func (*Window) Hide ¶ added in v2.2.0
Hide hides the window, if it was previously visible. If the window is already hidden or is in full screen mode, this function does nothing.
This function may only be called from the main thread.
func (*Window) Iconify ¶
Iconify iconifies/minimizes the window, if it was previously restored. If it is a full screen window, the original monitor resolution is restored until the window is restored. If the window is already iconified, this function does nothing.
This function may only be called from the main thread.
func (*Window) MakeContextCurrent ¶
MakeContextCurrent makes the context of the window current. Originally GLFW 3 passes a null pointer to detach the context. But since we're using receivers, DetachCurrentContext should be used instead.
func (*Window) Maximize ¶
Maximize maximizes the specified window if it was previously not maximized. If the window is already maximized, this function does nothing.
If the specified window is a full screen window, this function does nothing.
func (*Window) RequestAttention ¶ added in v2.7.0
func (w *Window) RequestAttention()
RequestWindowAttention funciton requests user attention to the specified window. On platforms where this is not supported, attention is requested to the application as a whole.
Once the user has given attention, usually by focusing the window or application, the system will end the request automatically.
This function must only be called from the main thread.
func (*Window) Restore ¶
Restore restores the window, if it was previously iconified/minimized. If it is a full screen window, the resolution chosen for the window is restored on the selected monitor. If the window is already restored, this function does nothing.
This function may only be called from the main thread.
func (*Window) SetAspectRatio ¶ added in v2.3.0
SetAspectRatio sets the required aspect ratio of the client area of the specified window. If the window is full screen or not resizable, this function does nothing.
The aspect ratio is specified as a numerator and a denominator and both values must be greater than zero. For example, the common 16:9 aspect ratio is specified as 16 and 9, respectively.
If the numerator and denominator is set to glfw.DontCare then the aspect ratio limit is disabled.
The aspect ratio is applied immediately and may cause the window to be resized.
func (*Window) SetAttrib ¶
SetAttrib function sets the value of an attribute of the specified window.
The supported attributes are Decorated, Resizeable, Floating and AutoIconify.
Some of these attributes are ignored for full screen windows. The new value will take effect if the window is later made windowed.
Some of these attributes are ignored for windowed mode windows. The new value will take effect if the window is later made full screen.
This function may only be called from the main thread.
func (*Window) SetCharCallback ¶ added in v2.7.0
func (w *Window) SetCharCallback(cbfun CharCallback) (previous CharCallback, err error)
SetCharCallback sets the character callback which is called when a Unicode character is input.
The character callback is intended for Unicode text input. As it deals with characters, it is keyboard layout dependent, whereas the key callback is not. Characters do not map 1:1 to physical keys, as a key may produce zero, one or more characters. If you want to know whether a specific physical key was pressed or released, see the key callback instead.
The character callback behaves as system text input normally does and will not be called if modifier keys are held down that would prevent normal text input on that platform, for example a Super (Command) key on OS X or Alt key on Windows. There is a character with modifiers callback that receives these events.
func (*Window) SetCharModsCallback
deprecated
func (w *Window) SetCharModsCallback(cbfun CharModsCallback) (previous CharModsCallback, err error)
SetCharModsCallback sets the character with modifiers callback which is called when a Unicode character is input regardless of what modifier keys are used.
Deprecated: Scheduled for removal in version 4.0.
The character with modifiers callback is intended for implementing custom Unicode character input. For regular Unicode text input, see the character callback. Like the character callback, the character with modifiers callback deals with characters and is keyboard layout dependent. Characters do not map 1:1 to physical keys, as a key may produce zero, one or more characters. If you want to know whether a specific physical key was pressed or released, see the key callback instead.
func (*Window) SetClipboardString ¶ added in v2.7.0
SetClipboardString sets the system clipboard to the specified UTF-8 encoded string.
Ownership to the Window is no longer necessary, see glfw.SetClipboardString(string)
This function may only be called from the main thread.
func (*Window) SetCloseCallback ¶ added in v2.2.0
func (w *Window) SetCloseCallback(cbfun CloseCallback) (previous CloseCallback, err error)
SetCloseCallback sets the close callback of the window, which is called when the user attempts to close the window, for example by clicking the close widget in the title bar.
The close flag is set before this callback is called, but you can modify it at any time with SetShouldClose.
Mac OS X: Selecting Quit from the application menu will trigger the close callback for all windows.
func (*Window) SetContentScaleCallback ¶ added in v2.7.0
func (w *Window) SetContentScaleCallback(cbfun ContentScaleCallback) (ContentScaleCallback, error)
SetContentScaleCallback function sets the window content scale callback of the specified window, which is called when the content scale of the specified window changes.
This function must only be called from the main thread.
func (*Window) SetCursor ¶ added in v2.1.0
SetCursor sets the cursor image to be used when the cursor is over the client area of the specified window. The set cursor will only be visible when the cursor mode of the window is CursorNormal.
On some platforms, the set cursor may not be visible unless the window also has input focus.
func (*Window) SetCursorEnterCallback ¶ added in v2.7.0
func (w *Window) SetCursorEnterCallback(cbfun CursorEnterCallback) (previous CursorEnterCallback, err error)
SetCursorEnterCallback the cursor boundary crossing callback which is called when the cursor enters or leaves the client area of the window.
func (*Window) SetCursorPos ¶ added in v2.6.0
SetCursorPos sets the position of the cursor. The specified window must be focused. If the window does not have focus when this function is called, it fails silently.
If the cursor is disabled (with CursorDisabled) then the cursor position is unbounded and limited only by the minimum and maximum values of a double.
func (*Window) SetCursorPosCallback ¶ added in v2.7.0
func (w *Window) SetCursorPosCallback(cbfun CursorPosCallback) (previous CursorPosCallback, err error)
SetCursorPosCallback sets the cursor position callback which is called when the cursor is moved. The callback is provided with the position relative to the upper-left corner of the client area of the window.
func (*Window) SetDropCallback ¶ added in v2.5.0
func (w *Window) SetDropCallback(cbfun DropCallback) (previous DropCallback, err error)
SetDropCallback sets the drop callback which is called when an object is dropped over the window.
func (*Window) SetFocusCallback ¶ added in v2.7.0
func (w *Window) SetFocusCallback(cbfun FocusCallback) (previous FocusCallback, err error)
SetFocusCallback sets the focus callback of the window, which is called when the window gains or loses focus.
After the focus callback is called for a window that lost focus, synthetic key and mouse button release events will be generated for all such that had been pressed. For more information, see SetKeyCallback and SetMouseButtonCallback.
func (*Window) SetFramebufferSizeCallback ¶
func (w *Window) SetFramebufferSizeCallback(cbfun FramebufferSizeCallback) (previous FramebufferSizeCallback, err error)
SetFramebufferSizeCallback sets the framebuffer resize callback of the specified window, which is called when the framebuffer of the specified window is resized.
func (*Window) SetIcon ¶
SetIcon sets the icon of the specified window. If passed an array of candidate images, those of or closest to the sizes desired by the system are selected. If no images are specified, the window reverts to its default icon.
The image is ideally provided in the form of *image.NRGBA. The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner. If the image type is not *image.NRGBA, it will be converted to it.
The desired image sizes varies depending on platform and system settings. The selected images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.
func (*Window) SetIconifyCallback ¶ added in v2.7.0
func (w *Window) SetIconifyCallback(cbfun IconifyCallback) (previous IconifyCallback, err error)
SetIconifyCallback sets the iconification callback of the window, which is called when the window is iconified or restored.
func (*Window) SetInputMode ¶
SetInputMode sets an input option for the window.
func (*Window) SetKeyCallback ¶ added in v2.7.0
func (w *Window) SetKeyCallback(cbfun KeyCallback) (previous KeyCallback, err error)
SetKeyCallback sets the key callback which is called when a key is pressed, repeated or released.
The key functions deal with physical keys, with layout independent key tokens named after their values in the standard US keyboard layout. If you want to input text, use the SetCharCallback instead.
When a window loses focus, it will generate synthetic key release events for all pressed keys. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the window has lost focus, i.e. Focused will be false and the focus callback will have already been called.
func (*Window) SetMaximizeCallback ¶ added in v2.7.0
func (w *Window) SetMaximizeCallback(cbfun MaximizeCallback) MaximizeCallback
SetMaximizeCallback sets the maximization callback of the specified window, which is called when the window is maximized or restored.
This function must only be called from the main thread.
func (*Window) SetMonitor ¶
SetMonitor sets the monitor that the window uses for full screen mode or, if the monitor is NULL, makes it windowed mode.
When setting a monitor, this function updates the width, height and refresh rate of the desired video mode and switches to the video mode closest to it. The window position is ignored when setting a monitor.
When the monitor is NULL, the position, width and height are used to place the window client area. The refresh rate is ignored when no monitor is specified. If you only wish to update the resolution of a full screen window or the size of a windowed mode window, see window.SetSize.
When a window transitions from full screen to windowed mode, this function restores any previous window settings such as whether it is decorated, floating, resizable, has size or aspect ratio limits, etc..
func (*Window) SetMouseButtonCallback ¶ added in v2.7.0
func (w *Window) SetMouseButtonCallback(cbfun MouseButtonCallback) (previous MouseButtonCallback, err error)
SetMouseButtonCallback sets the mouse button callback which is called when a mouse button is pressed or released.
When a window loses focus, it will generate synthetic mouse button release events for all pressed mouse buttons. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the window has lost focus, i.e. Focused will be false and the focus callback will have already been called.
func (*Window) SetOpacity ¶ added in v2.7.0
SetOpacity function sets the opacity of the window, including any decorations. The opacity (or alpha) value is a positive finite number between zero and one, where zero is fully transparent and one is fully opaque.
The initial opacity value for newly created windows is one.
A window created with framebuffer transparency may not use whole window transparency. The results of doing this are undefined.
This function may only be called from the main thread.
func (*Window) SetPos ¶
SetPos sets the position, in screen coordinates, of the upper-left corner of the client area of the window.
If it is a full screen window, this function does nothing.
If you wish to set an initial window position you should create a hidden window (using Hint and Visible), set its position and then show it.
It is very rarely a good idea to move an already visible window, as it will confuse and annoy the user.
The window manager may put limits on what positions are allowed.
This function may only be called from the main thread.
func (*Window) SetPosCallback ¶ added in v2.7.0
func (w *Window) SetPosCallback(cbfun PosCallback) (previous PosCallback, err error)
SetPosCallback sets the position callback of the window, which is called when the window is moved. The callback is provided with the screen position of the upper-left corner of the client area of the window.
func (*Window) SetRefreshCallback ¶ added in v2.7.0
func (w *Window) SetRefreshCallback(cbfun RefreshCallback) (previous RefreshCallback, err error)
SetRefreshCallback sets the refresh callback of the window, which is called when the client area of the window needs to be redrawn, for example if the window has been exposed after having been covered by another window.
On compositing window systems such as Aero, Compiz or Aqua, where the window contents are saved off-screen, this callback may be called only very infrequently or never at all.
func (*Window) SetScrollCallback ¶
func (w *Window) SetScrollCallback(cbfun ScrollCallback) (previous ScrollCallback, err error)
SetScrollCallback sets the scroll callback which is called when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.
func (*Window) SetShouldClose ¶ added in v2.2.0
SetShouldClose sets the value of the close flag of the window. This can be used to override the user's attempt to close the window, or to signal that it should be closed.
func (*Window) SetSize ¶
SetSize sets the size, in screen coordinates, of the client area of the window.
For full screen windows, this function selects and switches to the resolution closest to the specified size, without affecting the window's context. As the context is unaffected, the bit depths of the framebuffer remain unchanged.
The window manager may put limits on what window sizes are allowed.
This function may only be called from the main thread.
func (*Window) SetSizeCallback ¶
func (w *Window) SetSizeCallback(cbfun SizeCallback) (previous SizeCallback, err error)
SetSizeCallback sets the size callback of the window, which is called when the window is resized. The callback is provided with the size, in screen coordinates, of the client area of the window.
func (*Window) SetSizeLimits ¶ added in v2.1.0
SetSizeLimits sets the size limits of the client area of the specified window. If the window is full screen or not resizable, this function does nothing.
The size limits are applied immediately and may cause the window to be resized.
func (*Window) SetTitle ¶
SetTitle sets the window title, encoded as UTF-8, of the window.
This function may only be called from the main thread.
func (*Window) SetUserPointer ¶ added in v2.7.0
SetUserPointer sets the user-defined pointer of the window. The current value is retained until the window is destroyed. The initial value is nil.
func (*Window) ShouldClose ¶
ShouldClose reports the value of the close flag of the specified window.
func (*Window) Show ¶
Show makes the window visible, if it was previously hidden. If the window is already visible or is in full screen mode, this function does nothing.
This function may only be called from the main thread.
func (*Window) SwapBuffers ¶
SwapBuffers swaps the front and back buffers of the window. If the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before swapping the buffers.