Old 1.14 question concerning Display error

Started by MickeyB, February 09, 2016, 17:21:03

Previous topic - Next topic

MickeyB

Have 2 pc's, both windows 7, both java 1.8.  Same exact code runs on laptop, but throws cannot create Display on setDisplay call.  Anyone remember seeing this kind of stuff back in the day?   Would like to get code working locally before migrating to lwjgl3.
M

bobjob

Wanted the same thing when I got back into LWJGL, and had to migrate from version 2.

One problem I ran into in regards to the display was that I could not find a proper Display mode on my mac due to refresh rates not working the same way as on Windows.

But because you are on Windows already I doubt that is the issue. One thing to consider is the version of windows 7. Is it 32 or 64 bit? If it is working on one and not the other, maybe you are not loading the correct natives. Also are you trying to run a display mode that only your laptop can run?

MickeyB

Thought that too, but nope.   

This is the old fashion line that dies on the desktop:
DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(width, height, -1, -1, -1, -1, 60, 60);


I am letting lwjgl determine for me... it then throws this:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.opengl.Display


too dang funny
M

kappa

as mentioned in my previous post, do ensure that you add LWJGL2's lwjgl_util.jar to the classpath in addition to lwjgl.jar. There were actually two Display classes in LWJGL2 one in the opengl package (lwjgl.jar) and one in the util package (lwjgl_util.jar).

MickeyB

Yep, have the 1.1.4 package and have all 5 jars mapped.   
jinput.jar
lwjgl.jar
lwjgl_tes.jar
lwjgl_util.jar
lwjgl_util_applet.jar

;D
M

kappa

oh, thought you were updating to LWJGL2 jars.

MickeyB

Not yet.. Want to get it running this way first, then make the big move to 3.   
M

MickeyB

Update:  This happens on both gaming and deb rigs at home.  Both desktops with high end components and robust graphics cards.  Laptop is the onboard graphics.   Could this be it?
M

Kai

I'd stop wasting time trying to get an LWJGL version working which is over eight years old now.
Instead migrate to LWJGL 3 now. It will make lots of things easier for you.
Because if you never modified your own code again after it worked, and now that code stopped working on some systems, trying to poke around will not lead you anywhere. And even if any issue you might find is indeed on LWJGL 1.1.4, it will not be fixed (unless you do it yourself, of course).

MickeyB

You are probably right.  Was hoping to show some people, run a few tests and just have some fun.  Just odd how it is acting between systems. 

3 is going to be a bit daunting as I haven't been in things for a long time.  Might as well give it a go, though.

Kids want me to use Unity, but I just like being in the nuts and bolts and have always been a fan of LWJGL.
M

Kai

Yes, OpenGL programming is much more fun than using a game engine, I agree. :)
Regarding the move from 1 to 3,... well. It is just OpenGL after all.
So if you are comfortable with OpenGL, then using LWJGL 1 or 2 or 3 will not matter at all.
Just typing in an OpenGL function/method name on a GLxx class and hitting Ctrl+Space in your IDE of choice will then give you the right method (with or without the suffixes) for any LWJGL version you use.
And as kappa mentioned on the other thread the biggest hurdle will be to use GLFW now instead of the limited Display class.
But it is really easy, and there are now alot of tutorials/examples/demos on how to do it.
Just have a peek over the demos in the lwjgl3 repository and the demos in the lwjgl3-demos repository.
They all are using GLFW.

MickeyB

Ok, so I have migrated to 3.   Runs on my old laptop (though my camera is horrible) but when I move to my desktop... no love.

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.glfw.GLFW

I have verified the natives are mapped.

at this line, the very first in init....straight from tuts.
glfwSetErrorCallback(errorCallback = GLFWErrorCallback.createPrint(System.err));
M

Hydroque

Determine it yourself?

You could also set the context before this using ContextAttribs so that you can focus on which version you are using.

Check your version you are using, make context attribs point to which version you want to use.

System.out.println("Using OpenGL Version: " + GL11.glGetString(GL11.GL_VERSION));


try {

final DisplayMode[] dms = Display.getAvailableDisplayModes();

for (final DisplayMode dm : modes) {
if(dm.getWidth() == width && dm.getHeight() == height && dm.isFullscreenCapable()) {
Display.setDisplayMode(dm);
break;
}
}

Display.create();

} catch (LWJGLException e) {
e.printStackTrace();
)

Cornix

Quote from: MickeyB on February 14, 2016, 22:09:03
Runs on my old laptop (though my camera is horrible) but when I move to my desktop... no love.
Do you use different operating systems on your laptop and desktop? If both have the same OS, might it be that one is 32bit and the other is 64bit?
In either case make sure to have the natives for both OSs available.

MickeyB

Yeah, thought it might be. both Windows 7 64bit.
 
M