當前位置: 首頁>>代碼示例>>Java>>正文


Java GLFWErrorCallback類代碼示例

本文整理匯總了Java中org.lwjgl.glfw.GLFWErrorCallback的典型用法代碼示例。如果您正苦於以下問題:Java GLFWErrorCallback類的具體用法?Java GLFWErrorCallback怎麽用?Java GLFWErrorCallback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GLFWErrorCallback類屬於org.lwjgl.glfw包,在下文中一共展示了GLFWErrorCallback類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initialize

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
@Override
public boolean initialize()
{
	System.out.println("OS " + System.getProperty("os.name"));
	System.out.println("JAVA " + System.getProperty("java.version"));
	System.out.println("LWJGL " + Version.getVersion());
	System.out.println("GLFW " + GLFW.glfwGetVersionString());
	System.out.println("JOML 1.9.2");

	// Setup an error callback. The default implementation
	// will print the error message in System.err.
	GLFWErrorCallback.createPrint(System.err).set();

	// Initialize GLFW. Most GLFW functions will not work before doing this.
	if (!GLFW.glfwInit())
	{
		throw new IllegalStateException("Unable to initialize GLFW");
	}

	return true;
}
 
開發者ID:andykuo1,項目名稱:candlelight,代碼行數:22,代碼來源:GLEngine.java

示例2: init

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
public void init(){
	WIDTH = 1920;
	HEIGHT = 1080;

	Window.setErrorCallback(GLFWErrorCallback.createPrint(System.err));
	w = new Window(WIDTH, HEIGHT, "gl3DGE", true, 4, 0);
	w.setKeyCallback(new GLFWKeyCallback(){

		@Override
		public void invoke(long window, int key, int scancode, int action, int mods) {
			// TODO Auto-generated method stub
			if (key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE)
				glfwSetWindowShouldClose(window, true);
		}

	});

	w.setCursorPos((double) WIDTH / 2, (double) HEIGHT / 2);

	AudioEngine.initAudioEngine();

	Resource.setGameObjectDir("/mesh/");
	Resource.setOBJDir("/obj/");
	Resource.setTexDir("/tex/");
	Resource.setShaderDir("/shaders/");
}
 
開發者ID:jason-yang31415,項目名稱:gl3DGE,代碼行數:27,代碼來源:LightingDemo.java

示例3: init

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
/**
 * Initializes the game.
 */
public void init() {
    /* Set error callback */
    errorCallback = GLFWErrorCallback.createPrint();
    glfwSetErrorCallback(errorCallback);

    /* Initialize GLFW */
    if (!glfwInit()) {
        throw new IllegalStateException("Unable to initialize GLFW!");
    }

    /* Create GLFW window */
    window = new Window(640, 480, "Simple Game - Pong", true);

    /* Initialize timer */
    timer.init();

    /* Initialize renderer */
    renderer.init();

    /* Initialize states */
    initStates();

    /* Initializing done, set running to true */
    running = true;
}
 
開發者ID:SilverTiger,項目名稱:lwjgl3-tutorial,代碼行數:29,代碼來源:Game.java

示例4: glfwInit

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
public static boolean glfwInit() {
    boolean ret;
    if (Properties.VALIDATE.enabled) {
        debug("Registering GLFWErrorCallback");
        /* Set a GLFW error callback first and remember any possibly current callback to delegate to */
        errorCallback = new GLFWErrorCallback() {
            private final Map<Integer, String> ERROR_CODES = APIUtil.apiClassTokens((field, value) -> 0x10000 < value && value < 0x20000, null, org.lwjgl.glfw.GLFW.class);

            public void invoke(int error, long description) {
                String msg = getDescription(description);
                System.err.printf("[LWJGL] %s error\n", ERROR_CODES.get(error));
                System.err.println("\tDescription : " + msg);
                System.err.println("\tStacktrace  :");
                StackTraceElement[] stack = Thread.currentThread().getStackTrace();
                for (int i = 4; i < stack.length; i++) {
                    System.err.print("\t\t");
                    System.err.println(stack[i].toString());
                }
                if (userCallback != null) {
                    userCallback.invoke(error, description);
                }
            }
        };
        userCallback = org.lwjgl.glfw.GLFW.glfwSetErrorCallback(errorCallback);
        ret = org.lwjgl.glfw.GLFW.glfwInit();
        if (!ret) {
            error("glfwInit returned false");
        }
    } else {
        ret = org.lwjgl.glfw.GLFW.glfwInit();
    }
    RT.glfwInitialized = ret;
    return ret;
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:35,代碼來源:GLFW.java

示例5: initializeGLFW

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
public static void initializeGLFW()
{
	if (initGLFW)
	{
		return;
	}
	else
	{
		initGLFW = true;
	}

	System.out.println("OS " + System.getProperty("os.name"));
	System.out.println("JAVA " + System.getProperty("java.version"));
	System.out.println("LWJGL " + Version.getVersion());
	System.out.println("GLFW " + GLFW.glfwGetVersionString());
	System.out.println("JOML 1.9.2");

	// Setup an error callback. The default implementation
	// will print the error message in System.err.
	GLFWErrorCallback.createPrint(System.err).set();

	// Initialize GLFW. Most GLFW functions will not work before doing this.
	if (!GLFW.glfwInit())
	{
		throw new IllegalStateException("Unable to initialize GLFW");
	}
}
 
開發者ID:andykuo1,項目名稱:candlelight,代碼行數:28,代碼來源:Window.java

示例6: createWindow

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
public static Window createWindow(Scene scene, String title) {
	if (!GLFW.glfwInit()) {
		throw new IllegalStateException();
	}
	
	errorCallback = new GLFWErrorCallback() {
		public void invoke(int error, long description) {
			System.err.println("["+ error + "] " + description);
		}
	};
	GLFW.glfwSetErrorCallback(errorCallback);

	long window = GLFW.glfwCreateWindow(scene.getWidth(), scene.getHeight(), title, MemoryUtil.NULL, MemoryUtil.NULL);

	if (window == MemoryUtil.NULL) {
		System.err.println("Window returned NULL");
		System.exit(-1);
	}

	GLFW.glfwMakeContextCurrent(window);

	GLFW.glfwShowWindow(window);
	GL.createCapabilities();
	GLFW.glfwSwapInterval(1);

	scene.setGLinitilized();
	return new Window(window);
}
 
開發者ID:ComunityEngine,項目名稱:CommunityEngine-Java,代碼行數:29,代碼來源:Window.java

示例7: ensureGlfwLoaded

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
private static void ensureGlfwLoaded() {
	if(!glfwLoaded) {
		GLFWErrorCallback.createPrint(System.err).set();
		if (!glfwInit()) {
            throw new IllegalStateException("Error initializing GLFW");
        }
		
		glfwLoaded = true;
	}
}
 
開發者ID:urstruktur,項目名稱:zierfisch,代碼行數:11,代碼來源:Application.java

示例8: create

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
public static void create()
{
	LoggerInternal.log("Initializing GLFW");
	
	glfwSetErrorCallback(GLFWErrorCallback.createPrint(System.err));
	
	if(!glfwInit())
	{
		throw new RuntimeException("Unable to initialize GLFW");
	}
	
	LoggerInternal.log("GLFW Version: " + glfwGetVersionString());
}
 
開發者ID:Snakybo,項目名稱:TorchEngine,代碼行數:14,代碼來源:GLFW.java

示例9: init

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
/**
 * Creates and sets the GLFW error callback to {@link System.err}.
 * Initializes the GLFW library.
 * 
 * <b>This is required before the graphicslab windowing system is able to be
 * used.</b>
 *
 * Returns true if successful or throws {@link IllegalStateException} in
 * case GLFW failed to initialize.
 */
protected static boolean init() {
	if (isActive()) {
		return true;
	}

	errorCallback = GLFWErrorCallback.createPrint(System.err);
	errorCallback.set();

	if (!(isActive = glfwInit())) {
		throw new IllegalStateException("Unable to initialize GLFW.");
	}

	return true;
}
 
開發者ID:MBHS-Computer-Science-Association,項目名稱:graphicslab,代碼行數:25,代碼來源:GraphicsSystem.java

示例10: terminate

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
/**
 * Destroys any remaining windows or cursors. Frees the error callback. Once
 * this function is called, you must call init() again to use any of the
 * windowing functions.
 * 
 * Precondition:  none
 * Postcondition: the glfw callback will be freed
 * 				  the callback field will be set to null
 *                the glfw system will be terminated
 *                the variable will be set to inactive
 */
protected static void terminate() {
	glfwTerminate();

	GLFWErrorCallback previousCallback = glfwSetErrorCallback(null);
	if (previousCallback != null) {
		previousCallback.free();
	}

	errorCallback = null;
	isActive = false;
}
 
開發者ID:MBHS-Computer-Science-Association,項目名稱:graphicslab,代碼行數:23,代碼來源:GraphicsSystem.java

示例11: initGlfwLib

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
public static void initGlfwLib() {
    // Setup an error callback. The default implementation
    // will print the error message in System.err.
    GLFWErrorCallback.createPrint(System.err).set();

    // Initialize GLFW. Most GLFW functions will not work before doing this.
    if (!glfwInit())
        throw new IllegalStateException("Unable to initialize GLFW");

    // Configure glfw
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
}
 
開發者ID:dwbrite,項目名稱:polvo,代碼行數:16,代碼來源:MainThread.java

示例12: setErrorCallback

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
public static void setErrorCallback(Consumer<String> consumer) {
	GLFWErrorCallback tmp = GLFWErrorCallback.createString(
			(int err,String str) -> consumer.accept(""+err+": "+str)
	);
	GLFW.glfwSetErrorCallback(tmp);
	errorCallback = tmp;
}
 
開發者ID:surgeplay,項目名稱:glow,代碼行數:8,代碼來源:Display.java

示例13: setErrorCallbackToThrowExceptions

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
/** Convenience method to throw an IllegalStateException when an error occurs. */
public static void setErrorCallbackToThrowExceptions() {
	//Temporary variable ensures no race conditions occur with GC for the old callback
	GLFWErrorCallback tmp = GLFWErrorCallback.createThrow();
	GLFW.glfwSetErrorCallback(tmp);
	errorCallback = tmp;
}
 
開發者ID:surgeplay,項目名稱:glow,代碼行數:8,代碼來源:Display.java

示例14: setErrorCallbackToLog

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
/** Convenience method to print a message out to System.err when an error occurs */
public static void setErrorCallbackToLog(Logger log) {
	GLFWErrorCallback tmp = GLFWErrorCallback.createString(
			(int err,String str) -> log.error(""+err+": "+str)
	);
	GLFW.glfwSetErrorCallback(tmp);
	errorCallback = tmp;
}
 
開發者ID:surgeplay,項目名稱:glow,代碼行數:9,代碼來源:Display.java

示例15: init

import org.lwjgl.glfw.GLFWErrorCallback; //導入依賴的package包/類
public void init(){
	
	glfwSetErrorCallback(errorCallback = GLFWErrorCallback.createPrint(System.err));
	
	if (!glfwInit())
		throw new IllegalStateException("Unable to initialize GLFW");
	
	window.create();
	input.create(window.getId());
	scenegraph.getCamera().init();
	renderEngine.init();
}
 
開發者ID:oreonengine,項目名稱:oreon-engine,代碼行數:13,代碼來源:CoreSystem.java


注:本文中的org.lwjgl.glfw.GLFWErrorCallback類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。