lwjgl

GLFW Window Crashing Even With “-XstartOnFirstThread” In VM Arguments

隐身守侯 提交于 2019-12-08 08:28:38
问题 I have "-XstartOnFirstThread" in my VM arguments, however I am still getting the error message: Exception in thread "Thread-0" java.lang.ExceptionInInitializerError at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1248) at Main.init(Main.java:33) at Main.run(Main.java:56) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalStateException: GLFW windows may only be created on the main thread. at org.lwjgl.glfw.EventLoop$OffScreen.<clinit>(EventLoop.java:39) ... 4 more My Code:

GLFW Window Crashing Even With “-XstartOnFirstThread” In VM Arguments

巧了我就是萌 提交于 2019-12-08 06:18:25
I have "-XstartOnFirstThread" in my VM arguments, however I am still getting the error message: Exception in thread "Thread-0" java.lang.ExceptionInInitializerError at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1248) at Main.init(Main.java:33) at Main.run(Main.java:56) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalStateException: GLFW windows may only be created on the main thread. at org.lwjgl.glfw.EventLoop$OffScreen.<clinit>(EventLoop.java:39) ... 4 more My Code: import static org.lwjgl.glfw.GLFW.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl

Empty texture when using glTexImage2D with ByteBuffer in LWJGL

大憨熊 提交于 2019-12-08 04:55:15
问题 I just got a test texture working in my LWJGL code using an array of float s. Now, though, I need to load an image from a file and store it in the texture. I have gotten the image loaded and the data into a ByteBuffer object, but when I use glTexImage2D like so: GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 4, 4, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, buffer); the texture is empty and will render as completely black. I've looked at how other people do this but nothing seems to be

FBO lwjgl bigger than Screen Size - What I'm doing wrong?

吃可爱长大的小学妹 提交于 2019-12-08 04:00:23
问题 I need your help again. I wanna use Frame Buffer Object bigger than the Screen size. When I do it as below FBO size 1024 x 1024 is cut off from the top in resolution 1024 x 768. I couldn't find the solution on my own - that's why I'm asking. First part of code is the way I create FBO, I do the rendering between activate, and deactivate. Later I use texture. What am I doing wrong? What is the fastest way to clear Frame Buffer Object for reuse? public FrameBufferObject(int width, int height) {

Converting C++ OpenGl to Java(LWJGL), glBufferData();

情到浓时终转凉″ 提交于 2019-12-08 03:47:41
问题 I've been messing around with LWJGL trying to create a .obj parser that will convert files exported from blender into OpenGL render code. I followed a tutorial similar to what i was doing, but it was written in c++, which i can hardly comprehend. I've managed to get everything working with the parser(I think) but when the time comes to actually render to model, i'm having a hard time creating a java equivalent of the c++ code. The tutorial uses this line of code: glBufferData(GL_ARRAY_BUFFER,

Java Creating Instance of BufferedImage Freezes Program

随声附和 提交于 2019-12-08 03:22:12
问题 I'm experiencing something really strange, and I don't know what's causing it at all. This is the problematic line of code: BufferedImage out = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB); Upon calling this, all threads freeze and everything stops. I've tried putting this in its own thread and the main thread, the same thing occurs. I am using LWJGL3, so that might be an issue, but I don't see how it could be. Edit: Does not occur in a blank project without LWJGL in or out of

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

梦想与她 提交于 2019-12-08 00:12:14
问题 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 回答1: 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

Drawing normals in LWJGL messes with lighting

不问归期 提交于 2019-12-07 23:59:40
问题 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

OpenGL: Managing and editing large amounts of line strips

泄露秘密 提交于 2019-12-07 16:31:26
问题 I am currently working on a small 2D game with LWJGL. I use line strips to draw randomly generated grass. Each of the blades consists of 6 points and has a random green color. The problem I face: To fill the ground with a gapless layer of grass, I need approx. 400 line strips... In addition, every line strip has to be shifted, when the player moves around and should (optionally) wave in the wind. Therefore I need to change the data of 400 vbos every frame. Is there any way to accelerate these

FBO lwjgl bigger than Screen Size - What I'm doing wrong?

旧时模样 提交于 2019-12-07 13:15:28
I need your help again. I wanna use Frame Buffer Object bigger than the Screen size. When I do it as below FBO size 1024 x 1024 is cut off from the top in resolution 1024 x 768. I couldn't find the solution on my own - that's why I'm asking. First part of code is the way I create FBO, I do the rendering between activate, and deactivate. Later I use texture. What am I doing wrong? What is the fastest way to clear Frame Buffer Object for reuse? public FrameBufferObject(int width, int height) { this.width = width; this.height = height; texture = glGenTextures(); frameBufferObject = GL30