lwjgl

LWJGL grabbed mouse - debug if application hangs or when breakpoint hits with grabbed mouse

若如初见. 提交于 2019-12-07 07:25:16
问题 I have a LWJGL program (LWJGL 2.9.0) that sometimes randomly hangs. The problem with debugging it is that mouse is always grabbed. On Windows it's possible to get mouse back without any issues, but on linux (I use linux Kubuntu) the only way I know to get mouse back is to stop the application. The same issue happens when a breakpoint hits when mouse is grabbed. Using netbeans debug mode I can pause application and get some information at any time, but when the application hangs mouse no

Why does glValidateProgram fail when no VAO is bound?

孤街浪徒 提交于 2019-12-07 05:59:34
问题 I have a problem validating my shader program in LWJGL/OpenGL 3. I read the documentation, but I can't seem to find a reason why a VAO is needed when calling glValidateProgram. int program = glCreateProgram(); int vertexShader = glCreateShader(...); int fragmentShader = glCreateShader(...); // ... vertex and fragment shader loading, compiling, errorchecking ... glAttachShader(program, vertexShader); glAttachShader(program, fragmentShader); glBindAttribLocation(program, 0, "position");

Convert yaw, pitch AND roll to x,y,z vector in world coordinates

半城伤御伤魂 提交于 2019-12-07 05:09:51
问题 I'm working on some simple 3d graphics in OpenGL (java LWGJL), and I'm trying to figure out how to convert yaw, pitch and roll to the x, y and z components of my movement Vector. I know how to do this with just pitch and yaw (as explained here), but I haven't found anything the explains how to integrate roll into this formula. I am aware that yaw and pitch are all that is needed to define a vector in 3d space, but I also need roll in this instance. I have keys bound to different movements

How to attach opengl display to a JFrame and dispose of it properly?

不想你离开。 提交于 2019-12-07 04:48:23
问题 How can i attach the OpenGl display to a JFrame and so that when i close the JFrame is destroys the display? Here is my code so far: package test.core; import java.awt.BorderLayout; import java.awt.Canvas; import java.awt.Color; import java.awt.Component; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JButton; import javax.swing.JFrame; import

OpenGL GLSL 3.30 in Ubuntu 14.10 mesa 10.1.3

浪尽此生 提交于 2019-12-06 21:05:46
when I try to compile a glsl shader with OpenGL in Ubuntu I get the following error: - 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, and 1.00 ES But when I do a "glxinfo | grep OpenGL" it says: OpenGL vendor string: X.Org OpenGL renderer string: Gallium 0.4 on AMD JUNIPER OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.1.3 OpenGL core profile shading language version string: 3.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.0 Mesa 10.1.3

White Pixels With GL_POLYGON_SMOOTH

岁酱吖の 提交于 2019-12-06 16:01:42
I had a problem where white pixels appeared randomly (sort of) on objects in OpenGL. This is an example of what was going on. While searching Stack Overflow for other people who may have had this problem, I found that GL_POLYGON_SMOOTH wasn't worth enabling. I disabled it, and the spots disappeared (this was lucky of me). This was very lucky, but I still don't understand why enabling GL_POLYGON_SMOOTH creates these artifact-thingies. Can someone explain why they appear? Also note I had glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) going on. GL_POLYGON_SMOOTH is selective anti-aliasing, as

java.lang.UnsatisfiedLinkError: no lwjgl in java.libary.path at java run

僤鯓⒐⒋嵵緔 提交于 2019-12-06 12:10:34
I'm trying to run my java program with 2 external libraries ( lwjgl.jar and slick-util.jar ) compiling worked fine but when i run with the following command: java -cp bin;.;lib/lwjgl.jar;lib/slick-util.jar; Game I get the following Exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path Okay my current command is: java -cp bin;.;lib/lwjgl.jar;lib/slick-util.jar; -Djava.library.path="D:\dev\LWJGL\lwjgl-2.9.0\native\windows\lwjgl.dll" Change that to: java -cp bin;.;lib/lwjgl.jar;lib/slick-util.jar; -Djava.library.path="D:\dev\LWJGL\lwjgl-2.9.0\native

OpenGL perspective distorting scene much more than expected along z axis

浪子不回头ぞ 提交于 2019-12-06 10:44:36
问题 I'm working in LWJGL and have been struggling for a while to write a program that allows for simple 3d viewing of a scene. The major issue that I'm running into is that whenever I apply perspective, my scene is stretched very, very far in the z axis. The square in the middle is a cube drawn with orthographic projection (here cube means "all sides are equal"). The shape trailing from the bottom left to the center is also a cube, but drawn with perspective projection! Obviously, this does not

OpenGL: Are VAOs and VBOs practical for large polygon rendering tasks?

六眼飞鱼酱① 提交于 2019-12-06 08:38:00
If you wanted to render a large landscape with thousands of polygons in the viewing frustum at a time as well as the user's viewpoint changing constantly, is it practical to use VAOs or VBOs? I mean, every time the player's position or camera rotation changed, you would have to recompute the vertex data in order to properly cull any vertices or scenes which are no longer seen in order to keep a good FPS count. But in doing this, your FPS count would go down because you are, well, repacking all the buffers constantly. So is it still beneficial to use these two methods over immediate mode? My

Drawing normals in LWJGL messes with lighting

青春壹個敷衍的年華 提交于 2019-12-06 07:07:18
My issue is fairly straightforward: Drawing normals in LWJGL causes the light source to only apply to the model until it is manually updated after initialization. Here's the lighting initialization: static Vector3f lightPosition = new Vector3f(-500f, -100f, 500f); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, asFloatBuffer(new float[]{0.05f, 0.05f, 0.05f, 1f})); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, asFloatBuffer(new float[]{1.5f, 1.5f, 1.5f, 1f})); And here's my code for drawing the normals (loaded from the Standford