phr00t / jMonkeyVR

Easy, free & universal VR development solution: jMonkeyEngine + OpenVR/OSVR = develop on any operating system, for any operating system, for any VR device (Rift, Vive, FOVE, StarVR, OSVR etc.). Supports SteamVR & rendering via instancing, which can greatly improve performance!
http://www.phr00t.com/
98 stars 18 forks source link

Failed to initialized OpenGL context #1

Closed bluenote10 closed 9 years ago

bluenote10 commented 9 years ago

I was just trying to run your recent JME demo you posted on reddit. I hope that this is the right place to report issues (though I'm not sure if it's an issue with the demo or the engine itself). I'm currently stuck with the issue that the OpenGL context cannot be created.

$ ~/bin/jdk1.8.0_51/bin/java -jar MonkeyVR.jar

Using breakpad crash handler
Setting breakpad minidump AppID = 250820
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
OpenVR initialized & VR connected.
OpenGL pipeline enabled for default config on screen 1
Could not enable OpenGL pipeline for default config on screen 0
Jul 16, 2015 9:52:01 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.1.0 (snapshot-github)
 * Branch: master
 * Git Hash: b82caff
 * Build Date: 2015-07-14
Jul 16, 2015 9:52:01 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: GeForce GTX 670/PCIe/SSE2
 * OpenGL Version: 4.4.0 NVIDIA 331.113
 * GLSL Version: 4.40 NVIDIA via Cg compiler
 * Profile: Compatibility
Jul 16, 2015 9:52:01 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.3 context running on thread jME3 Main
 * Graphics Adapter: null
 * Driver Version: null
 * Scaling Factor: 1
Jul 16, 2015 9:52:02 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.MeshLoader
Jul 16, 2015 9:52:02 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.SkeletonLoader
Jul 16, 2015 9:52:02 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.MaterialLoader
Jul 16, 2015 9:52:02 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.SceneLoader
Jul 16, 2015 9:52:02 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
Jul 16, 2015 9:52:02 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.fbx.SceneLoader
Jul 16, 2015 9:52:02 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.fbx.SceneWithAnimationLoader
Jul 16, 2015 9:52:02 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Device: OpenAL Soft
Jul 16, 2015 9:52:02 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Vendor: OpenAL Community
Jul 16, 2015 9:52:02 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer: OpenAL Soft
Jul 16, 2015 9:52:02 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Version: 1.1 ALSOFT 1.15.1
Jul 16, 2015 9:52:02 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
Jul 16, 2015 9:52:02 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
Jul 16, 2015 9:52:02 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: AudioRenderer supports 64 channels
Jul 16, 2015 9:52:02 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
Jul 16, 2015 9:52:02 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Jul 16, 2015 9:52:02 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxilary sends: 4
Skipping SteamVR compositor!
Jul 16, 2015 9:52:02 PM com.jme3.material.Material checkSetParam
WARNING: Material parameter being set: Texture with type Texture2D doesn't match definition types TextureCubeMap
Jul 16, 2015 9:52:03 PM com.jme3.app.Application handleError
SEVERE: Failed to initialize OpenGL context
org.lwjgl.LWJGLException: X Error - disp: 0x7efecc030dd0 serial: 51 error: BadMatch (invalid parameter attributes) request_code: 1 minor_code: 0
    at org.lwjgl.opengl.LinuxDisplay.globalErrorHandler(LinuxDisplay.java:320)
    at org.lwjgl.opengl.LinuxDisplay.nCreateWindow(Native Method)
    at org.lwjgl.opengl.LinuxDisplay.createWindow(LinuxDisplay.java:495)
    at org.lwjgl.opengl.Display.createWindow(Display.java:306)
    at org.lwjgl.opengl.Display.create(Display.java:848)
    at org.lwjgl.opengl.Display.create(Display.java:757)
    at com.jme3.system.lwjgl.LwjglCanvas.createContext(LwjglCanvas.java:469)
    at com.jme3.system.lwjgl.LwjglCanvas.restoreCanvas(LwjglCanvas.java:267)
    at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:196)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:233)
    at java.lang.Thread.run(Thread.java:745)

Jul 16, 2015 9:52:03 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.IllegalStateException: Keyboard must be created before you can poll the device
    at org.lwjgl.input.Keyboard.poll(Keyboard.java:386)
    at com.jme3.input.lwjgl.LwjglKeyInput.update(LwjglKeyInput.java:79)
    at com.jme3.input.InputManager.update(InputManager.java:897)
    at com.jme3.app.Application.update(Application.java:696)
    at com.jme3.app.SimpleApplication.update(SimpleApplication.java:236)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:152)
    at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:229)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:233)
    at java.lang.Thread.run(Thread.java:745)

Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "jME3 Main"

I get a popup window which reports the java.lang.IllegalStateException: Keyboard must be created before you can poll the device but I guess the actual cause is a problem with the OpenGL context itself. I have no idea what could be wrong -- all other OpenGL stuff is running fine on my system (Ubuntu 14.04, GeForce GTX 670).

phr00t commented 9 years ago

Looks like this is the first crash:

org.lwjgl.LWJGLException: X Error - disp: 0x7efecc030dd0 serial: 51 error: BadMatch (invalid parameter attributes) request_code: 1 minor_code: 0

Once that crashes, stuff apparently still tries to run like Keyboard initialization, which fails.

"X Error" I suspect means "X" as in "X Windows", and it is having trouble creating an X window that is suppose to be the JFrame where jMonkeyEngine will be rendering stuff. I'll post this question to the main jME3 team & see if they have any ideas.

phr00t commented 9 years ago

Posted question here:

http://hub.jmonkeyengine.org/t/failed-to-init-opengl-context-ubuntu-canvas-mode/33204

phr00t commented 9 years ago

Looking a little more into this... I bet a display mode is trying to be set for the Rift, but failing. Do you have your Rift plugged in, or any other external display device? It shouldn't try setting any display mode that isn't listed as an available one, so this is rather odd...

phr00t commented 9 years ago

Can you use the source, instead of the JMonkeyVR.jar file, and step through the problem? Perhaps you can see what DisplayMode is trying to be set inside VRApplication...

bluenote10 commented 9 years ago

I managed to get it to run. The problem was caused by my xorg configuration: I was running two separate screens, one for the Desktop and one for the Rift (because this gave me better performance in some cases). It looks like this configuration does not work currently. I now switched back to a regular twin mode and now it works. Unfortunately, I have exactly the same massive judder I get with JOVR. I take it that by default you have timewarp enabled, right?

phr00t commented 9 years ago

Timewarp isn't implemented in OpenVR. However, it isn't that useful when you are hitting your target frame rate (which is a must, in my opinion).

I suspect the judder you are seeing is because of refresh rate problems. I bet your "twin" screen wants to refresh at the same rate as your primary monitor. You are not trying to use an Optimus NVidia/Intel HD setup, are you?

phr00t commented 9 years ago

I made a new commit -- looks like display configuration might not have been initialized right. Can you give this another try? Here is the commit:

https://github.com/phr00t/jmonkeyengine-virtual-reality/commit/3bbadb0c9d349359f5ace047af58e5897fd1083a