lwjgl

Texture repeating on quads OpenGL

人盡茶涼 提交于 2019-12-10 18:53:51
问题 I am writing a voxel engine and at the moment I am working on the Chunk-Rendering-System but I have a problem. It seems that the textures were repeated on the quads. There is this green line at the bottom of the grass blocks and I don't know why. This is the OpenGL-Render-Code: Texture texture = TextureManager.getTexture(block.getTextureNameForSide(Direction.UP)); texture.bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2d(0, 0); GL11.glVertex3f(0, 1, 0); GL11.glTexCoord2d(1, 0); GL11

LWJGL: glfwCreateWindow return null

怎甘沉沦 提交于 2019-12-10 15:57:14
问题 I was trying LWJGL library in Java seeing the tutorial, but the creation of the window I will return null. This is the code: import static org.lwjgl.glfw.GLFW.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.system.MemoryUtil.*; import java.nio.ByteBuffer; import org.lwjgl.glfw.GLFWvidmode; public class Main implements Runnable { private int height = 720, width = height / 9 * 16; private String title = "Game"; private Thread thread; private boolean running = false; private

Lwjgl 3, How to get OpenGL context current in the current thread?

此生再无相见时 提交于 2019-12-10 13:14:23
问题 I am using OpenGL in LWJGL 3 and I get the following error; Exception in thread "main" java.lang.IllegalStateException: There is no OpenGL context current in the current thread. at org.lwjgl.opengl.GL.getCapabilities(GL.java:157) at org.lwjgl.opengl.GL11.getInstance(GL11.java:1390) at org.lwjgl.opengl.GL11.glClearColor(GL11.java:1842) at com.base.engine.RenderUtil.initGraphics(RenderUtil.java:13) at com.base.engine.Main.<init>(Main.java:14) at com.base.engine.Main.main(Main.java:24) This is

How can i use the lwjgl in bluej?

落花浮王杯 提交于 2019-12-10 12:09:57
问题 The lwjgl consists of two parts. I set up the java part by copying the "lwjgl.jar" into the "...\BlueJ\lib\userlib" folder and that worked. For the native part I have to point the java.library.path at the two DLLs "lwjgl.dll" and "OpenAL32.dll" . How do I do that? 回答1: LWJGL looks in a special variable to find its native libs. I don't know how blueJ works but you should do something like: System.setProperty("org.lwjgl.librarypath", new File("pathToNatives").getAbsolutePath()); More info and

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

坚强是说给别人听的谎言 提交于 2019-12-10 11:27:08
问题 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

Enable anti-aliasing with lwjgl

不想你离开。 提交于 2019-12-10 10:10:55
问题 I'm running this lwjgl application: Display.setDisplayMode(new DisplayMode(500, 500)); Display.create(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-5, 5, -5, 5, -10, 5); glMatrixMode(GL_MODELVIEW); float x = 0; while (!Display.isCloseRequested()) { Display.update(); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glColor3f(1, 0, 0); x += 0.01f; glRotatef(x, x, 3 * x, 0.5f * x); glBegin(GL_QUADS); drawCube(); glEnd(); glLoadIdentity(); } Display

Camera Pitch/Yaw to Direction Vector

孤街醉人 提交于 2019-12-10 02:36:53
问题 What I'm trying to do is cast a ray from my camera. I know the camera's x, y and z coordinates, as well as its pitch and yaw. I need to calculate its direction vector so I can pass it to my raytracing algorithm. The camera's up vector is (0, 1, 0). "Pitch", from the perspective of the camera, is looking up and down. (I would prefer to not use matrices, but I will if I have to) 回答1: Assuming that your coordinate system is set up such that the following conditions are met: (pitch, yaw) -> (x, y

How do I load an image for use as an openGL texture with LWJGL?

谁说我不能喝 提交于 2019-12-09 18:05:18
问题 I am trying to load an image as a texture for openGL using the LWJGL library. From what I found out so far, I need to pass the texture as a ByteBuffer to openGL. What I have right now is some code that correctly loads an image, and stores it in a BufferedImage object. The thing is, I have no clue how to get from a BufferedImage to a ByteBuffer that contains data in the right format for use with openGL (as input for the function GL11.glTexImage2D()). Help is greatly appreciated! 回答1: Here's a

Java error no lwjgl64 in path?

岁酱吖の 提交于 2019-12-09 13:50:09
问题 I'm trying to make a game and it runs fine in eclipse, but I get this error when I export and run it as a jar file. Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl64 in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at org.lwjgl.Sys$1.run(Sys.java:72) at java.security.AccessController.doPrivileged(Native Method) at org.lwjgl.Sys.doLoadLibrary(Sys.java

Java Creating Instance of BufferedImage Freezes Program

偶尔善良 提交于 2019-12-08 08:30:33
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 -XstartOnFirstThread Ok! I found the solution. Turns out, all it takes is the following JVM argument: