java - LWJGL 3.0.0 does not produce a window after upgrading from 3.0.0-SNAPSHOT -
it seem lwjgl 3.0.0-snapshot available anymore, had go lwjgl 3.0.0. however, me looks mac binaries broken.
i have downloaded natives using following script, have been working in past. line has changed is:
<lwjgl.version>3.0.0snapshot</lwjgl.version> -> <lwjgl.version>3.0.0</lwjgl.version>
pom.xml:
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>meltdown</groupid> <artifactid>bitflip</artifactid> <version>1.0-snapshot</version> <packaging>jar</packaging> <name>bitflip</name> <properties> <lwjgl.version>3.0.0</lwjgl.version> <!--<lwjgl.version>3.0.0-snapshot</lwjgl.version>--> <swt.version>4.5.1</swt.version> <joml.version>1.8.0</joml.version> <class>game.spacegame</class> <source>1.8</source> <target>1.8</target> <project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties> <profiles> <profile> <id>mac</id> <activation> <os> <family>mac</family> </os> </activation> <dependencies> <dependency> <groupid>org.lwjgl</groupid> <artifactid>lwjgl-platform</artifactid> <version>${lwjgl.version}</version> <classifier>natives-osx</classifier> </dependency> <dependency> <groupid>org.eclipse.swt</groupid> <artifactid>org.eclipse.swt.cocoa.macosx.x86_64</artifactid> <version>${swt.version}</version> </dependency> </dependencies> </profile> </profiles> <build> <sourcedirectory>src</sourcedirectory> <resources> <resource> <directory>res</directory> </resource> </resources> <plugins> <plugin> <artifactid>maven-compiler-plugin</artifactid> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-shade-plugin</artifactid> <version>2.4.3</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.manifestresourcetransformer"> <mainclass>org.lwjgl.demo.${class}</mainclass> </transformer> </transformers> <finalname>lwjgl3-demos</finalname> </configuration> </execution> </executions> </plugin> </plugins> </build> <repositories> <repository> <id>oss.sonatype.org</id> <url>https://oss.sonatype.org/content/repositories/snapshots/</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>swt-repo</id> <url>http://maven-eclipse.github.io/maven</url> </repository> </repositories> <dependencies> <dependency> <groupid>org.joml</groupid> <artifactid>joml</artifactid> <version>${joml.version}</version> </dependency> <dependency> <groupid>org.lwjgl</groupid> <artifactid>lwjgl</artifactid> <version>${lwjgl.version}</version> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>release</version> </dependency> </dependencies> </project>
to sure made test running example code lwjgl's web page: link src
package org.gooeybits.meltdown.alt; import org.lwjgl.version; import org.lwjgl.glfw.*; import org.lwjgl.opengl.*; import static org.lwjgl.glfw.callbacks.*; import static org.lwjgl.glfw.glfw.*; import static org.lwjgl.opengl.gl11.*; import static org.lwjgl.system.memoryutil.*; public class test { // window handle private long window; public void run() { system.out.println("hello lwjgl " + version.getversion() + "!"); try { init(); loop(); // free window callbacks , destroy window glfwfreecallbacks(window); glfwdestroywindow(window); } { // terminate glfw , free error callback glfwterminate(); glfwseterrorcallback(null).free(); } } private void init() { // setup error callback. default implementation // print error message in system.err. glfwerrorcallback.createprint(system.err).set(); // initialize glfw. glfw functions not work before doing this. if (!glfwinit()) throw new illegalstateexception("unable initialize glfw"); // configure our window glfwdefaultwindowhints(); // optional, current window hints default glfwwindowhint(glfw_visible, glfw_false); // window stay hidden after creation glfwwindowhint(glfw_resizable, glfw_true); // window resizable int width = 300; int height = 300; // create window window = glfwcreatewindow(width, height, "hello world!", null, null); if (window == null) throw new runtimeexception("failed create glfw window"); // setup key callback. called every time key pressed, repeated or released. glfwsetkeycallback(window, (window, key, scancode, action, mods) -> { if (key == glfw_key_escape && action == glfw_release) glfwsetwindowshouldclose(window, true); // detect in our rendering loop }); // resolution of primary monitor glfwvidmode vidmode = glfwgetvideomode(glfwgetprimarymonitor()); // center our window glfwsetwindowpos( window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2 ); // make opengl context current glfwmakecontextcurrent(window); // enable v-sync glfwswapinterval(1); // make window visible glfwshowwindow(window); } private void loop() { // line critical lwjgl's interoperation glfw's // opengl context, or context managed externally. // lwjgl detects context current in current thread, // creates glcapabilities instance , makes opengl // bindings available use. gl.createcapabilities(); // set clear color glclearcolor(1.0f, 0.0f, 0.0f, 0.0f); // run rendering loop until user has attempted close // window or has pressed escape key. while (!glfwwindowshouldclose(window)) { glclear(gl_color_buffer_bit | gl_depth_buffer_bit); // clear framebuffer glfwswapbuffers(window); // swap color buffers // poll window events. key callback above // invoked during call. glfwpollevents(); } } public static void main(string[] args) { new test().run(); } }
i have set following vm options:
-xstartonfirstthread -djava.awt.headless=true
the following native binaries downloaded (maven):
libglfw.dylib libjemalloc.dylib liblwjgl.dylib libopenal.dylib
when compiling , running project, executes no warnings/errors or exceptions. thing missing window. have tried both fullscreen , stand alone. nothing.
my question can see weird i'm doing or have had similar happening?
update: call never returns.
window = glfwcreatewindow(width, height, "hello world!", null, null);
solved.
i uninstalled cuda drivers , jdk. rebooted , installed java 8 build 91, instead of build 92.
and worked. still not know if wrong cuda installation, or if jdk.
but if have similar problems, please give try.
java -cp .:./jar/*:./native -djava.library.path=./native/ -dorg.lwjgl.util.debug=true -xstartonfirstthread helloworld hello lwjgl 3.0.0 build 90! [lwjgl] version: 3.0.0 build 90 [lwjgl] os: mac os x v10.11.5 [lwjgl] jre: 1.8.0_91 x86_64 [lwjgl] jvm: java hotspot(tm) 64-bit server vm v25.91-b14 oracle corporation [lwjgl] loading library (system): lwjgl [lwjgl] loaded java.library.path: ./native/liblwjgl.dylib [lwjgl] threadlocalutil state: unsafestate [lwjgl] memoryutil accessor: memoryaccessorunsafe [lwjgl] loading library: glfw [lwjgl] loaded java.library.path: ./native/libglfw.dylib [lwjgl] loading library: objc [lwjgl] loaded java.library.path: ./native/libobjc.dylib [lwjgl] loading library: /system/library/frameworks/opengl.framework [lwjgl] success
Comments
Post a Comment