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


Java GLFWErrorCallback.createPrint方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: setErrorCallbackToPrintToSterr

import org.lwjgl.glfw.GLFWErrorCallback; //導入方法依賴的package包/類
/** Convenience method to print a message out to System.err when an error occurs */
public static void setErrorCallbackToPrintToSterr() {
	GLFWErrorCallback tmp = GLFWErrorCallback.createPrint(System.err);
	GLFW.glfwSetErrorCallback(tmp);
	errorCallback = tmp;
}
 
開發者ID:surgeplay,項目名稱:glow,代碼行數:7,代碼來源:Display.java

示例4: GLFWPlatform

import org.lwjgl.glfw.GLFWErrorCallback; //導入方法依賴的package包/類
protected GLFWPlatform(IImageSupport imageSupport) {
	this.errorCallback = GLFWErrorCallback.createPrint(System.err);
	this.imageSupport = imageSupport;
	this.mainThread = Thread.currentThread();
}
 
開發者ID:arisona,項目名稱:ether,代碼行數:6,代碼來源:GLFWPlatform.java

示例5: finishInitialization

import org.lwjgl.glfw.GLFWErrorCallback; //導入方法依賴的package包/類
@RequiresNonNull("this.mav")
@EnsuresNonNull("this.canvas")
@UIEffect
private void finishInitialization(boolean es) {
	GLFWErrorCallback ecb = GLFWErrorCallback.createPrint(System.err);
	mav.keepAlive(ecb);
	glfwSetErrorCallback(ecb);
	
	GLFWWindowSizeCallback scb = GLFWWindowSizeCallback.create(this::updateWindowSize);
	mav.keepAlive(scb);
	glfwSetWindowSizeCallback(window, scb);
	
	updateWindowSize(window, DEFAULT_WIDTH, DEFAULT_HEIGHT);
	
	String version = getGLVersion(es);
	int major = version.charAt(0)-'0';
	int minor = version.charAt(2)-'0';
	
	if (es) {
		if (major >= 3) {
			log.info("Using OpenGL ES 3 rendering");
			canvas = new NanoVGGLES3Canvas(mav);
		} else if (major >= 2) {
			log.info("Using OpenGL ES 2 rendering");
			canvas = new NanoVGGLES2Canvas(mav);
		} else {
			throw new Panic("panic.noSuitableContext", I18n.get("panic.noSuitableContext.onlyGlEs", version));
		}
	} else {
		if (major >= 3) {
			log.info("Using OpenGL 3 rendering");
			canvas = new NanoVGGL3Canvas(mav);
		} else if (major >= 2) {
			log.info("Using OpenGL 2 rendering");
			canvas = new NanoVGGL2Canvas(mav);
		} else {
			throw new Panic("panic.noSuitableContext", I18n.get("panic.noSuitableContext.onlyGl", version));
		}
	}
	
	glfwShowWindow(window);
	
	if (glfwExtensionSupported("WGL_EXT_swap_control_tear") || glfwExtensionSupported("GLX_EXT_swap_control_tear")) {
		log.info("Using tearing prevention");
		glfwSwapInterval(-1);
	} else {
		glfwSwapInterval(1);
	}
}
 
開發者ID:mav-assistant,項目名稱:Mavkit,代碼行數:50,代碼來源:Display.java


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