Questions tagged [lwjgl]

The Lightweight Java Game Library (LWJGL) allows access to high performance crossplatform libraries such as OpenGL, OpenCL and OpenAL to write state of the art 2D and 3D applications with Java.

The Lightweight Java Game Library (LWJGL) is an open source Java software library for computer game developers. In particular, it provides an interface for accessing OpenGL, OpenCL, OpenAL and GLFW functionality.

3245 questions
1
vote
1 answer

StateBased Java Game - How to tell if the mouse button is released?

i'm creating a statebased game using slick 2d, and lwjgl. I currently am using if statements to check whether the mouse is inside the area of the button, and another if statement to check whether the mouse button is down (the button is just a…
Gratin
  • 113
  • 3
  • 15
1
vote
1 answer

GL11 Texture rendering wrong

I'm trying to render an image on a basic quad, I took a look at the Space Invaders Example Game for the code, and implemented that code into mine. The image gets renderer on screen, with the right colors, but the image seems shifted. This is the…
Rheel
  • 410
  • 4
  • 19
1
vote
1 answer

Averaging normals results in zero-length vector

I have four normals which I am attempting to average by adding the x, y, and z values, then normalizing the result. However, when I add the different axis values, the resulting vector has a length of zero. I get the feeling that this issue is very…
Max Roncace
  • 1,277
  • 2
  • 15
  • 40
1
vote
1 answer

LWJGL - OpenGL - Camera rotation

i tried to create a first person camera. I took a piece of code of my XNA project and tried to convert it into java (LWJGL). Matrix4f mx = Matrix4f.rotate(pitch, new Vector3f(1, 0, 0), new Matrix4f(), null); Matrix4f my =…
user2246718
  • 63
  • 2
  • 5
1
vote
1 answer

How to package native libraries eclipse

I'm trying to export a slick2d project from eclipse and I have to use the lwjgl libary including its natives, which I'm having a problem with. I've tried exporting the project and it does not put the natives into the .jar, and i tried programming…
hubbardh
  • 41
  • 6
1
vote
1 answer

Textured Sphere in LWJGL

I want to draw a GLU Sphere,which works, but now I dont know how I can texture it. There is no point where a glTexCoord2f could go.
DealerJoe
  • 95
  • 2
  • 12
1
vote
1 answer

Gravity algorithm help needed

I'm using Slick2D and I was wondering if anyone knew how to tell if the player collided with the ground or a wall. So far I have it where it checks if the player hit something solid and if so it stops. What do people normally do?
user2223779
  • 47
  • 1
  • 3
1
vote
2 answers

Pushing and popping matrix

So I have a few different objects in my opengl game. If I load a texture or color a vertex, all my other objects in the game are given that texture or their vertices are colored. So, for example. I have a bunch of cubes that I apply texture 'a' to.…
user1650305
1
vote
0 answers

LWJGL Texture blending not working

I'm trying to draw a gradient and then draw a transparent texture ontop of it. This is the code I'm using right now: GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); // Draw the gradient GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0.0f, 0.0f); …
user2102293
  • 53
  • 1
  • 7
1
vote
1 answer

opengl only drawing final quad out of a list of many in java

I'm making a simple 2D game with LWJGL and OpenGl in Java and I can't seem to render more than one quad. I have an arraylist of Squares in my main class and if I have more than one Square in the list it only renders the last one in the list, failing…
Jake Gabb
  • 385
  • 1
  • 5
  • 15
1
vote
1 answer

How to use camera look direction as z- direction with lwjgl

I wrote this camera last week everything works fine, accept for the fact that I don't how to use the look position as Z-position. If you try it you'll see for youself. import static java.lang.Math.cos; import static java.lang.Math.sin; import static…
Maarten
  • 635
  • 1
  • 9
  • 29
1
vote
1 answer

LWJGL Confusing Texture Mappings

I've been working on a very simple game, and I've decided to include some basic textures. I was experimenting with the code, and for some reason, I have no idea why, I cannot get the textures to map correctly. Right now, I am simply trying to map a…
gratsby
  • 3,107
  • 4
  • 20
  • 20
1
vote
1 answer

Filling a square with tiles

I have a 2D tile game that I am trying to create brush sizes for. Currently, my code looks like this: if (isMouseClicked0) { int grid_x = Math.round(mouseX / blockSize); int grid_y = Math.round(mouseY / blockSize); for (int x = 0; x <…
user1650305
1
vote
1 answer

Modern GLSL basics

I'm trying to learn the modern GLSL but i cant even display my a cube... This is how i create VBO: glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle); glBufferData(GL_ARRAY_BUFFER, vertexData, GL_STATIC_DRAW); glVertexPointer(3, GL_FLOAT, 0,…
Qualphey
  • 1,244
  • 1
  • 19
  • 44
1
vote
1 answer

OpenGL shader getting incorrect data even though it seems correct

I just started learning how to use OpenGL 3.2, and right now I am trying to put together a utility for loading geometry data. When I look at the code for loading in the vertices, everything looks correct, and the debug output I put in even seems to…
Freezerburn
  • 1,013
  • 3
  • 11
  • 29