Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/glfwPublic

Go bindings for GLFW 3

License

NotificationsYou must be signed in to change notification settings

go-gl/glfw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TestsStatic AnalysisGoDoc

GLFW 3.3 for Go

Installation

  • GLFW C library source is included and built automatically as part of the Go package. But you need to make sure you have dependencies of GLFW:
    • On macOS, you need Xcode or Command Line Tools for Xcode (xcode-select --install) for required headers and libraries.
    • On Ubuntu/Debian-like Linux distributions, you needlibgl1-mesa-dev andxorg-dev packages.
    • On CentOS/Fedora-like Linux distributions, you needlibX11-devel libXcursor-devel libXrandr-devel libXinerama-devel mesa-libGL-devel libXi-devel libXxf86vm-devel packages.
    • On FreeBSD, you need the packagepkgconf. To build for X, you also need the packagexorg; and to build for Wayland, you need the packagewayland.
    • On NetBSD, to build for X, you need the X11 sets installed. These are included in all graphical installs, and can be added to the system withsysinst(8) on non-graphical systems. Wayland support is incomplete, due to missing wscons support in upstream GLFW. To attempt to build for Wayland, you need to install thewayland libepoll-shim packages and set the environment variablePKG_CONFIG_PATH=/usr/pkg/libdata/pkgconfig.
    • On OpenBSD, you need the X11 sets. These are installed by default, and can be added from the ramdisk kernel at any time.
    • Seehere for full details.
  • Go 1.4+ is required on Windows (otherwise you must use MinGW v4.8.1 exactly, seeGo issue 8811).
go get -u github.com/go-gl/glfw/v3.3/glfw

OpenGL ES

If your target system only provides an OpenGL ES implementation (true for some ARM boards), you need to link against that implementation.You do this by defining the appropriate build tags, e.g.

go get -u -tags=gles2 github.com/go-gl/glfw/v3.3/glfw

Supported tags aregles1,gles2,gles3 andvulkan.Note that required packages might differ from those listed above; consult your hardware's documentation.

Usage

package mainimport ("runtime""github.com/go-gl/glfw/v3.3/glfw")funcinit() {// This is needed to arrange that main() runs on main thread.// See documentation for functions that are only allowed to be called from the main thread.runtime.LockOSThread()}funcmain() {err:=glfw.Init()iferr!=nil {panic(err)}deferglfw.Terminate()window,err:=glfw.CreateWindow(640,480,"Testing",nil,nil)iferr!=nil {panic(err)}window.MakeContextCurrent()for!window.ShouldClose() {// Do OpenGL stuff.window.SwapBuffers()glfw.PollEvents()}}

Changelog

GLFW 3.3 Specific Changes

  • Joystick functions now uses receivers instead of passing the joystick ID as argument.
  • Vulkan methods are intentionally not implemented.Window.Handle can be used to create a Vulkan surface via thethis package.
  • RenamedWindow.GLFWWindow toWindow.Handle
  • Added functionWindow.SetAttrib.
  • Added functionWindow.RequestAttention.
  • Added functionWindow.GetContentScale.
  • Added functionWindow.GetOpacity.
  • Added functionWindow.SetOpacity.
  • Added functionWindow.SetMaximizeCallback.
  • Added functionWindow.SetContentScaleCallback.
  • Added functionMonitor.GetWorkarea.
  • Added functionMonitor.GetContentScale.
  • Added functionMonitor.SetUserPointer.
  • Added functionMonitor.GetUserPointer.
  • Added functionInitHint.
  • Added functionRawMouseMotionSupported
  • Added functionGetKeyScancode.
  • Added functionWindowHintString.
  • Added functionGetClipboardString.
  • Added functionSetClipboardString.
  • Added functionJoystick.GetHats.
  • Added functionJoystick.IsGamepad.
  • Added functionJoystick.GetGUID.
  • Added functionJoystick.GetGamepadName.
  • Added functionJoystick.GetGamepadState.
  • Added functionJoystick.SetUserPointer.
  • Added functionJoystick.GetUserPointer.
  • Added functionUpdateGamepadMappings.
  • Added functionSetX11SelectionString.
  • Added functionGetX11SelectionString.
  • Added gamepad button IDs.
  • Added gamepad axis IDs.
  • Added joystick hat state IDs.
  • Added ModifierKeyModCapsLock.
  • Added ModifierKeyModNumLock
  • Added InputModeLockKeyMods.
  • Added InputModeRawMouseMotion.
  • Added hintHovered.
  • Added hintCenterCursor.
  • Added hintTransparentFramebuffer.
  • Added hintFocusOnShow.
  • Added hintScaleToMonitor.
  • Added hintJoystickHatButtons.
  • Added hintCocoaChdirResources.
  • Added hintCocoaMenubar.
  • Added hintTransparentFramebuffer.
  • Added hint valueOSMesaContextAPI.
  • Added hint valueCocoaGraphicsSwitching.
  • Added hint valueCocoaRetinaFramebuffer.
  • Added string hint valueCocoaFrameNAME.
  • Added string hint valueX11ClassName.
  • Added string hint valueX11InstanceName.
  • MonitorEvent renamed toPeripheralEvent for reuse with joystick events.
  • Joystick.GetButtons Returns[]Action instead of[]byte.
  • SetMonitorCallback ReturnsMonitorCallback.
  • Focus No longer returns an error.
  • Iconify No longer returns an error.
  • Maximize No longer returns an error.
  • Restore No longer returns an error.
  • GetClipboardString No longer returns an error.

GLFW 3.2 Specfic Changes

  • Easygo get installation. GLFW source code is now included in-repo and compiled in so you don't have to build GLFW on your own and distribute shared libraries. The revision of GLFW C library used is listed inGLFW_C_REVISION.txt file.
  • The error callback is now set internally. Functions return an error with corresponding code and description (do a type assertion to glfw3.Error for accessing the variables) if the error is recoverable. If not a panic will occur.
  • Added functionWindow.SetSizeLimits.
  • Added functionWindow.SetAspectRatio.
  • Added functionWindow.SetMonitor.
  • Added functionWindow.Maximize.
  • Added functionWindow.SetIcon.
  • Added functionWindow.Focus.
  • Added functionGetKeyName.
  • Added functionVulkanSupported.
  • Added functionGetTimerValue.
  • Added functionGetTimerFrequency.
  • Added functionWaitEventsTimeout.
  • Added functionSetJoystickCallback.
  • Added window hintMaximized.
  • Added hintNoAPI.
  • Added hintNativeContextAPI.
  • Added hintEGLContextAPI.

GLFW 3.1 Specfic Changes

  • Added typeCursor.
  • Added functionWindow.SetDropCallback.
  • Added functionWindow.SetCharModsCallback.
  • Added functionPostEmptyEvent.
  • Added functionCreateCursor.
  • Added functionCreateStandardCursor.
  • Added functionCursor.Destroy.
  • Added functionWindow.SetCursor.
  • Added functionWindow.GetFrameSize.
  • Added window hintFloating.
  • Added window hintAutoIconify.
  • Added window hintContextReleaseBehavior.
  • Added window hintDoubleBuffer.
  • Added hint valueAnyReleaseBehavior.
  • Added hint valueReleaseBehaviorFlush.
  • Added hint valueReleaseBehaviorNone.
  • Added hint valueDontCare.

API changes

  • Window.Iconify Returns an error.
  • Window.Restore Returns an error.
  • Init Returns an error instead ofbool.
  • GetJoystickAxes No longer returns an error.
  • GetJoystickButtons No longer returns an error.
  • GetJoystickName No longer returns an error.
  • GetMonitors No longer returns an error.
  • GetPrimaryMonitor No longer returns an error.
  • Monitor.GetGammaRamp No longer returns an error.
  • Monitor.GetVideoMode No longer returns an error.
  • Monitor.GetVideoModes No longer returns an error.
  • GetCurrentContext No longer returns an error.
  • Window.SetCharCallback Acceptsrune instead ofuint.
  • Added typeError.
  • RemovedSetErrorCallback.
  • Removed error codeNotInitialized.
  • Removed error codeNoCurrentContext.
  • Removed error codeInvalidEnum.
  • Removed error codeInvalidValue.
  • Removed error codeOutOfMemory.
  • Removed error codePlatformError.
  • RemovedKeyBracket.
  • RenamedWindow.SetCharacterCallback toWindow.SetCharCallback.
  • RenamedWindow.GetCursorPosition toGetCursorPos.
  • RenamedWindow.SetCursorPosition toSetCursorPos.
  • RenamedCursorPositionCallback toCursorPosCallback.
  • RenamedWindow.SetCursorPositionCallback toSetCursorPosCallback.
  • RenamedVideoMode toVidMode.
  • RenamedMonitor.GetPosition toMonitor.GetPos.
  • RenamedWindow.GetPosition toWindow.GetPos.
  • RenamedWindow.SetPosition toWindow.SetPos.
  • RenamedWindow.GetAttribute toWindow.GetAttrib.
  • RenamedWindow.SetPositionCallback toWindow.SetPosCallback.
  • RenamedPositionCallback toPosCallback.
  • RanamedCursor toCursorMode.
  • RenamedStickyKeys toStickyKeysMode.
  • RenamedStickyMouseButtons toStickyMouseButtonsMode.
  • RenamedApiUnavailable toAPIUnavailable.
  • RenamedClientApi toClientAPI.
  • RenamedOpenglForwardCompatible toOpenGLForwardCompatible.
  • RenamedOpenglDebugContext toOpenGLDebugContext.
  • RenamedOpenglProfile toOpenGLProfile.
  • RenamedSrgbCapable toSRGBCapable.
  • RenamedOpenglApi toOpenGLAPI.
  • RenamedOpenglEsApi toOpenGLESAPI.
  • RenamedOpenglAnyProfile toOpenGLAnyProfile.
  • RenamedOpenglCoreProfile toOpenGLCoreProfile.
  • RenamedOpenglCompatProfile toOpenGLCompatProfile.
  • RenamedKeyKp... toKeyKP....

[8]ページ先頭

©2009-2025 Movatter.jp