本文整理了Java中org.lwjgl.glfw.GLFW.glfwSetErrorCallback()
方法的一些代码示例,展示了GLFW.glfwSetErrorCallback()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GLFW.glfwSetErrorCallback()
方法的具体详情如下:
包路径:org.lwjgl.glfw.GLFW
类名称:GLFW
方法名:glfwSetErrorCallback
[英]Sets the error callback, which is called with an error code and a human-readable description each time a GLFW error occurs.
The error code is set before the callback is called. Calling #glfwGetError from the error callback will return the same value as the error code argument.
The error callback is called on the thread where the error occurred. If you are using GLFW from multiple threads, your error callback needs to be written accordingly.
Because the description string may have been generated specifically for that error, it is not guaranteed to be valid after the callback has returned. If you wish to use it after the callback returns, you need to make a copy.
Once set, the error callback remains set even after the library has been terminated.
代码示例来源:origin: libgdx/libgdx
static void initializeGlfw() {
if (errorCallback == null) {
Lwjgl3NativesLoader.load();
errorCallback = GLFWErrorCallback.createPrint(System.err);
GLFW.glfwSetErrorCallback(errorCallback);
GLFW.glfwInitHint(GLFW.GLFW_JOYSTICK_HAT_BUTTONS, GLFW.GLFW_FALSE);
if (!GLFW.glfwInit()) {
throw new GdxRuntimeException("Unable to initialize GLFW");
}
}
}
代码示例来源:origin: libgdx/libgdx
static void initializeGlfw() {
if (errorCallback == null) {
Lwjgl3NativesLoader.load();
errorCallback = GLFWErrorCallback.createPrint(System.err);
GLFW.glfwSetErrorCallback(errorCallback);
GLFW.glfwInitHint(GLFW.GLFW_JOYSTICK_HAT_BUTTONS, GLFW.GLFW_FALSE);
if (!GLFW.glfwInit()) {
throw new GdxRuntimeException("Unable to initialize GLFW");
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
glfwSetErrorCallback(null);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
glfwSetErrorCallback(errorCallback = new GLFWErrorCallback() {
@Override
public void invoke(int error, long description) {
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
glfwSetErrorCallback(errorCallback = new GLFWErrorCallback() {
@Override
public void invoke(int error, long description) {
代码示例来源:origin: org.lwjgl.osgi/org.lwjgl.glfw
/** See {@link GLFW#glfwSetErrorCallback SetErrorCallback}. */
public GLFWErrorCallback set() {
glfwSetErrorCallback(this);
return this;
}
代码示例来源:origin: WarmfulDevelopment/LWJGL-3-Tutorial
public static void setCallbacks() {
glfwSetErrorCallback(new GLFWErrorCallbackI() {
@Override
public void invoke(int error, long description) {
throw new IllegalStateException(GLFWErrorCallback.getDescription(description));
}
});
}
代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl3
static void initializeGlfw() {
if (errorCallback == null) {
Lwjgl3NativesLoader.load();
errorCallback = GLFWErrorCallback.createPrint(System.err);
GLFW.glfwSetErrorCallback(errorCallback);
GLFW.glfwInitHint(GLFW.GLFW_JOYSTICK_HAT_BUTTONS, GLFW.GLFW_FALSE);
if (!GLFW.glfwInit()) {
throw new GdxRuntimeException("Unable to initialize GLFW");
}
}
}
代码示例来源:origin: jsettlers/settlers-remake
public void async_init() {
if(debug) {
ec = GLFWErrorCallback.createPrint(System.err);
GLFW.glfwSetErrorCallback(ec);
}
if(!GLFW.glfwInit()) throw new Error("glfwInit() failed!");
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_DEBUG_CONTEXT, debug ? GLFW.GLFW_TRUE : GLFW.GLFW_DONT_CARE);
GLFW.glfwWindowHint(GLFW.GLFW_STENCIL_BITS, 1);
glfw_wnd = GLFW.glfwCreateWindow(width + 1, width + 1, "lwjgl-offscreen", 0, 0);
GLFW.glfwMakeContextCurrent(glfw_wnd);
GLFW.glfwSwapInterval(0);
event_converter.registerCallbacks();
}
代码示例来源:origin: Renanse/Ardor3D
@Override
public void init() {
if (_inited) {
return;
}
GLFWErrorCallback.createPrint(System.err).set();
if (!GLFW.glfwInit()) {
throw new IllegalStateException("Unable to initialize GLFW");
}
try {
GLFW.glfwDefaultWindowHints();
GLFW.glfwWindowHint(GLFW.GLFW_RESIZABLE, GL11C.GL_FALSE);
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GL11C.GL_FALSE);
GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, 3);
GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, 3);
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_DEBUG_CONTEXT, GLFW.GLFW_TRUE);
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE);
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, GLFW.GLFW_TRUE);
GLFW.glfwSetErrorCallback(_errorCallback = GLFWErrorCallback.createPrint(System.err));
_windowId = GLFW.glfwCreateWindow(_settings.getWidth(), _settings.getHeight(), "Ardor3D", 0, 0);
} catch (final Exception e) {
logger.severe("Cannot create window");
logger.logp(Level.SEVERE, this.getClass().toString(), "initDisplay()", "Exception", e);
throw new Ardor3dException("Cannot create window: " + e.getMessage());
}
_canvasRenderer.init(_settings, true); // true - do swap in renderer.
_inited = true;
}
代码示例来源:origin: Renanse/Ardor3D
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE);
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, GLFW.GLFW_TRUE);
GLFW.glfwSetErrorCallback(_errorCallback = GLFWErrorCallback.createPrint(System.err));
if (_settings.isFullScreen()) {
代码示例来源:origin: badlogic/lwjgl3-maven-gradle
private void init() {
glfwSetErrorCallback(errorCallback = errorCallbackPrint(System.err));
代码示例来源:origin: sriharshachilakapati/SilenceEngine
/**
* Initializes the GLFW3 library. If you are not using the built-in Game class of the SilenceEngine, you should call
* this method as soon as you can after loading the LWJGL3 natives.
*
* @return True if initialised successful, or else False.
*/
public static boolean init()
{
if (isInitialized())
return true;
boolean state = glfwInit();
// Return immediately in case of error
if (!state)
return initialized = false;
// Error callback that does nothing
setErrorCallback(null);
glfwErrorCallback = GLFWErrorCallback.create((error, description) ->
errorCallback.invoke(error, MemoryUtil.memUTF8(description)));
// Joystick callback that does nothing
setJoystickCallback(null);
glfwJoystickCallback = GLFWJoystickCallback.create((joy, event) ->
joystickCallback.invoke(joy, event == GLFW_CONNECTED));
// Register the callback
glfwSetErrorCallback(glfwErrorCallback);
return initialized = true;
}
代码示例来源:origin: badlogic/lwjgl3-maven-gradle
private void init() {
glfwSetErrorCallback(errorCallback = errorCallbackPrint(System.err));
代码示例来源:origin: playn/playn
glfwSetErrorCallback(errorCallback = new GLFWErrorCallback() {
@Override public void invoke(int error, long description) {
log().error("GL Error (" + error + "):" + getDescription(description));
代码示例来源:origin: FedUni/caliko
glfwSetErrorCallback(errorCallback = GLFWErrorCallback.createPrint(System.err));
代码示例来源:origin: org.jmonkeyengine/jme3-lwjgl3
glfwSetErrorCallback(errorCallback = new GLFWErrorCallback() {
@Override
public void invoke(int error, long description) {
内容来源于网络,如有侵权,请联系作者删除!