-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GLFW tag 3.3-stable @ glfw/glfw@e4e9581 * Fix C Include & address GLFW v3.3 removals * Glfw moved away from posix_tls.c to posix_thread.c (this reflects that they now contain more than TLS) * Glfw moved away from win32_tls.c to win32_thread.c (same as above) * Glfw removed wayland-.*-unstable-v1-client-protocol.c * Glfw added wl_platform.h * Glfw removed GLFW_USE_RETINA, _GLFW_USE_CHDIR and _GLFW_USE_MENUBAR compile-time macros * Glfw removed support for MIR * Address deprecations of glfw 3.3 * Glfw deprecate glfwSetCharModsCallback * Glfw deprecate the window parameter of glfwGetClipboardString and glfwSetClipboardString, NULL can be used as the window argument * Add glfw.SetClipboardString(string) and glfw.GetClipboardString() function (no Window type required) * Use casting and clang-format c code * Use casting instead of callback in C helpers (same as #219) * Update travis * Fix Darwin build tag Fixes: #245, #255, #240, #230, #170
- Loading branch information
Showing
107 changed files
with
81,406 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
# Please keep the list sorted. | ||
|
||
Champion Pierre | ||
Coşku Baş | ||
Dmitri Shuralyov | ||
Geert-Johan Riemer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
e4e9581557826bd522158ab9159859e20e10700e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package glfw | ||
|
||
/* | ||
// Windows Build Tags | ||
// ---------------- | ||
// GLFW Options: | ||
#cgo windows CFLAGS: -D_GLFW_WIN32 -Iglfw/deps/mingw | ||
// Linker Options: | ||
#cgo windows LDFLAGS: -lopengl32 -lgdi32 | ||
// Darwin Build Tags | ||
// ---------------- | ||
// GLFW Options: | ||
#cgo darwin CFLAGS: -D_GLFW_COCOA -Wno-deprecated-declarations | ||
// Linker Options: | ||
#cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo | ||
// Linux Build Tags | ||
// ---------------- | ||
// GLFW Options: | ||
#cgo linux,!wayland CFLAGS: -D_GLFW_X11 -D_GNU_SOURCE | ||
#cgo linux,wayland CFLAGS: -D_GLFW_WAYLAND -D_GNU_SOURCE | ||
// Linker Options: | ||
#cgo linux,!gles1,!gles2,!gles3,!vulkan LDFLAGS: -lGL | ||
#cgo linux,gles1 LDFLAGS: -lGLESv1 | ||
#cgo linux,gles2 LDFLAGS: -lGLESv2 | ||
#cgo linux,gles3 LDFLAGS: -lGLESv3 | ||
#cgo linux,vulkan LDFLAGS: -lvulkan | ||
#cgo linux,!wayland LDFLAGS: -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama -ldl -lrt | ||
#cgo linux,wayland LDFLAGS: -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon -lm -ldl -lrt | ||
// FreeBSD Build Tags | ||
// ---------------- | ||
// GLFW Options: | ||
#cgo freebsd pkg-config: glfw3 | ||
#cgo freebsd CFLAGS: -D_GLFW_HAS_DLOPEN | ||
#cgo freebsd,!wayland CFLAGS: -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB | ||
#cgo freebsd,wayland CFLAGS: -D_GLFW_WAYLAND | ||
// Linker Options: | ||
#cgo freebsd,!wayland LDFLAGS: -lm -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lXinerama | ||
#cgo freebsd,wayland LDFLAGS: -lm -lGL -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon | ||
*/ | ||
import "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package glfw | ||
|
||
/* | ||
#include "glfw/src/context.c" | ||
#include "glfw/src/init.c" | ||
#include "glfw/src/input.c" | ||
#include "glfw/src/monitor.c" | ||
#include "glfw/src/vulkan.c" | ||
#include "glfw/src/window.c" | ||
#include "glfw/src/osmesa_context.c" | ||
*/ | ||
import "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package glfw | ||
|
||
/* | ||
#cgo CFLAGS: -x objective-c | ||
#include "glfw/src/cocoa_init.m" | ||
#include "glfw/src/cocoa_joystick.m" | ||
#include "glfw/src/cocoa_monitor.m" | ||
#include "glfw/src/cocoa_window.m" | ||
#include "glfw/src/cocoa_time.c" | ||
#include "glfw/src/posix_thread.c" | ||
#include "glfw/src/nsgl_context.m" | ||
#include "glfw/src/egl_context.c" | ||
*/ | ||
import "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// +build linux freebsd | ||
|
||
package glfw | ||
|
||
/* | ||
#ifdef _GLFW_WAYLAND | ||
#include "glfw/src/wl_init.c" | ||
#include "glfw/src/wl_monitor.c" | ||
#include "glfw/src/wl_window.c" | ||
#include "glfw/src/wl_platform.h" | ||
#endif | ||
#ifdef _GLFW_X11 | ||
#include "glfw/src/x11_init.c" | ||
#include "glfw/src/x11_monitor.c" | ||
#include "glfw/src/x11_window.c" | ||
#include "glfw/src/glx_context.c" | ||
#endif | ||
#include "glfw/src/linux_joystick.c" | ||
#include "glfw/src/posix_time.c" | ||
#include "glfw/src/posix_thread.c" | ||
#include "glfw/src/xkb_unicode.c" | ||
#include "glfw/src/egl_context.c" | ||
*/ | ||
import "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package glfw | ||
|
||
/* | ||
#include "glfw/src/win32_init.c" | ||
#include "glfw/src/win32_joystick.c" | ||
#include "glfw/src/win32_monitor.c" | ||
#include "glfw/src/win32_time.c" | ||
#include "glfw/src/win32_thread.c" | ||
#include "glfw/src/win32_window.c" | ||
#include "glfw/src/wgl_context.c" | ||
#include "glfw/src/egl_context.c" | ||
*/ | ||
import "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package glfw | ||
|
||
//#include <stdlib.h> | ||
//#define GLFW_INCLUDE_NONE | ||
//#include "glfw/include/GLFW/glfw3.h" | ||
import "C" | ||
|
||
import ( | ||
"unsafe" | ||
) | ||
|
||
// MakeContextCurrent makes the context of the window current. | ||
// Originally GLFW 3 passes a null pointer to detach the context. | ||
// But since we're using receievers, DetachCurrentContext should | ||
// be used instead. | ||
func (w *Window) MakeContextCurrent() { | ||
C.glfwMakeContextCurrent(w.data) | ||
panicError() | ||
} | ||
|
||
// DetachCurrentContext detaches the current context. | ||
func DetachCurrentContext() { | ||
C.glfwMakeContextCurrent(nil) | ||
panicError() | ||
} | ||
|
||
// GetCurrentContext returns the window whose context is current. | ||
func GetCurrentContext() *Window { | ||
w := C.glfwGetCurrentContext() | ||
panicError() | ||
if w == nil { | ||
return nil | ||
} | ||
return windows.get(w) | ||
} | ||
|
||
// 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. | ||
func (w *Window) SwapBuffers() { | ||
C.glfwSwapBuffers(w.data) | ||
panicError() | ||
} | ||
|
||
// 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 SwapInterval(interval int) { | ||
C.glfwSwapInterval(C.int(interval)) | ||
panicError() | ||
} | ||
|
||
// 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 ExtensionSupported(extension string) bool { | ||
e := C.CString(extension) | ||
defer C.free(unsafe.Pointer(e)) | ||
ret := glfwbool(C.glfwExtensionSupported(e)) | ||
panicError() | ||
return ret | ||
} | ||
|
||
// 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 GetProcAddress(procname string) unsafe.Pointer { | ||
p := C.CString(procname) | ||
defer C.free(unsafe.Pointer(p)) | ||
ret := unsafe.Pointer(C.glfwGetProcAddress(p)) | ||
panicError() | ||
return ret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "_cgo_export.h" | ||
|
||
void glfwSetErrorCallbackCB() { glfwSetErrorCallback((GLFWerrorfun)goErrorCB); } |
Oops, something went wrong.