本文整理汇总了Java中org.lwjgl.glfw.GLFW.glfwInit方法的典型用法代码示例。如果您正苦于以下问题:Java GLFW.glfwInit方法的具体用法?Java GLFW.glfwInit怎么用?Java GLFW.glfwInit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.glfw.GLFW
的用法示例。
在下文中一共展示了GLFW.glfwInit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.lwjgl.glfw.GLFW; //导入方法依赖的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;
}
示例2: initGLFW
import org.lwjgl.glfw.GLFW; //导入方法依赖的package包/类
/**
* Initialize GLFW. Stops application if error occurs
*/
private void initGLFW() throws IllegalStateException {
// If there is an error in initialization
if(GLFW.glfwInit() == 0) {
throw new IllegalStateException("GLFW failed to initialize");
}
}
示例3: initializeGLFW
import org.lwjgl.glfw.GLFW; //导入方法依赖的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");
}
}
示例4: createWindow
import org.lwjgl.glfw.GLFW; //导入方法依赖的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);
}