Help debugging GL_VERSION error in a Java3d application

倾然丶 夕夏残阳落幕 提交于 2019-12-24 02:09:31

问题


I'm working on a 3d globe application written in java using java3d for the rendering. I've got a windows installer that basically copies files from a development snapshot to the program files directory. It runs fine from the devel snapshot, but when running after an install it does this:

Java 3D ERROR : OpenGL 1.2 or better is required (GL_VERSION=1.1)  
javax.media.j3d.IllegalRenderingStateException: GL_VERSION  
    at javax.media.j3d.NativePipeline.createNewContext(Native Method)  
    at javax.media.j3d.NativePipeline.createNewContext(NativePipeline.java:2736)  
    at javax.media.j3d.Canvas3D.createNewContext(Canvas3D.java:4895)  
    at javax.media.j3d.Canvas3D.createNewContext(Canvas3D.java:2421)  
    at javax.media.j3d.Renderer.doWork(Renderer.java:895)  
    at javax.media.j3d.J3dThread.run(J3dThread.java:256)  

I've compared the all the libraries and jars in the development directories and the files are all exactly the same and none are missing. It's the weirdest thing. I've updated my graphics drivers (though they're clearly sufficient since things run fine from a devel snapshot). I've written a simple java3d app that is able to make a Canvas3D and add a ColorCube to it. It runs fine. P.s. our development snapshot includes all the dlls, jars, and the jre things run from. We log all the library and jvm versions and they're exactly the same in logs generated from the devel snapshot and the installed application. We run using an explicit path to java.exe (..\jre\bin\java.exe), so the PATH variable isn't in play.

I'm looking for ideas to debug this. I'd like to write a simple java app that prints all the GL attributes, especially GL_VERSION, to try to demonstrate some quantifiable difference between the two set ups. The java3d docs don't cover that, and all internet searches for GL_VERSION problems just tell you to update your drivers.

Oh, I've got Nvidia Quadro FX 3800 cards. Two of 'em actually.

In summary...
Q1: How do you print GL_VERSION for your java3d application?
Q2: What the heck is going on?


回答1:


After typing about my two graphics cards, I started thinking about how I recently switched from using four monitors to just three, so I could use the fourth for my new laptop. Turns our our application had saved some properties in my home folder that had our application starting up on the fourth, now non-existent monitor. It appears that java3d didn't find opengl sufficiently supported in non-existent screen space, and threw the above exception. Starting the application with valid screen coordinates solved the issue.




回答2:


to check GL_VERSION use queryProperties() method on your Canvas3D.

String glVersion = (String)getCanvas3D().queryProperties().get("native.version");

But this error does not display the accurate version of OpenGL, using the code above you will likely see that you're GL_VERSION is not 1.1 like in the stacktrace (I had same error with OpenGL 1.5 installed).



来源:https://stackoverflow.com/questions/1827514/help-debugging-gl-version-error-in-a-java3d-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!