Main example on Getting Started page broken?

Started by xixer, August 21, 2015, 00:58:31

Previous topic - Next topic

xixer

I used to use LWJGL 2 a lot for OpenGL game projects a while back, but haven't used it in 2 or 3 years or so. I figured I'd give 3.0 a try for a new 3d application I have planned, but getting started has been a little tricky so far. I think the first hurdle is that the documentation at http://www.lwjgl.org/guide is not correct (or maybe out of date?). The first, obvious, issue is that line 95:
        GL.createCapabilities();

seems to require a boolean. However, setting it to true or false doesn't seem to change anything. You'll get an exception that looks like:
Exception in thread "main" java.lang.IllegalStateException: There is no OpenGL context current in the current thread.
	at org.lwjgl.opengl.GL.getCapabilities(GL.java:164)
	at org.lwjgl.opengl.GL11.getInstance(GL11.java:1390)
	at org.lwjgl.opengl.GL11.glClearColor(GL11.java:1830)
	at com.grimfox.dpm.HelloWorld.loop(HelloWorld.java:98)
	at com.grimfox.dpm.HelloWorld.run(HelloWorld.java:28)
	at com.grimfox.dpm.HelloWorld.main(HelloWorld.java:114)

either way. After importing sources and debugging through the code it seems that the issue is that at line 162 in GL.java currentContext is null. It also seems that createCapabilites doesn't really do anything necessary or useful at the place it's called. If I replace the createCapabilities line with the following:
//        GL.createCapabilities(true);
        GL.setCurrent(GLContext.createFromCurrent());

it seems to work (I get a red window). I'm now wondering if there is a better place to go to than the main documentation to find docs and examples about LWJGL that are more current or reliable. Is there some other place I should be looking for help and guidance? I'm not sure if changing this line was the right thing to do, or just me debugging until I found the issue and poking at it until it worked. Is there some place that explains what this is actually doing and why?

xixer

Ahhh sorry. I just realized this isn't released yet, and we are in alpha or beta or something. Probably what the 'a' in 3.0.0a means (doh!). The documentation could be for the "Stable" or "Bleeding Edge" yellow or red builds. That wasn't exactly clear from the big green button that said "Release". I assumed, from the title and button, that it wasn't in beta or alpha or anything. I'll come back when it settles down.

xixer

I have a friendly suggestion. If you want to avoid other confused people bugging you about documentation that doesn't work, when you are obviously busy trying to finish the product which is changing rapidly, you could change a couple brief things on the site to avoid confusion. It doesn't say the word "alpha" anywhere on the main page, the getting started page, or the download page. You could avoid future confusion by labeling the top bar as "LWJGL 3 alpha" (or pre-alpha or preview even), title the download page as "Download LWJGL 3 alpha" with the link saying "Latest alpha release". People expect documentation to be in flux and things to not work perfectly when they know they are using a pre-release.

Anyhow, I eagerly anticipate the official release with GLFW 3.1 in. One of the main reasons I am interested in LWJGL 3 is for HiDPI/4k support in mixed pixel density multi-monitor setups. Good luck!

spasi

Thanks, we'll do some changes to the site to reflect the current status.

Please note that all builds since 3.0a include GLFW 3.1.1 or newer builds. HiDPI resolutions are fully supported.

If you're just starting now, using the latest nightly build is highly recommended. It will be promoted to stable today or tomorrow.

spasi

Done, these are the changes.

Note to anyone reading this: if you think anything can be improved on the site, the source code is available in lwjgl3-www. It's mostly plain HTML, feel free to submit a pull request. Also, let me know if you'd like push access to lwjgl3-wiki.

xixer

Thank you so much for the reply! Great to hear that GLFW 3.1.1 is already in. I'm chomping at the bit to get started on my project. Thanks for the advice, I'll start using the nightly build right away. Cheers!