The Lightweight Java Game Library (LWJGL) provides access to high performance, cross-platform libraries OpenGL and OpenAL. Additionally LWJGL provides access to controllers such as Gamepads, Steering wheel and Joysticks.

learn more… | top users | synonyms

12
votes
1answer
935 views

OpenGL - white edges on cubes

In a minecraft-like game I'm making, I get white edges on my cubes: It is much more noticeable in darker textures. The textures are being setup like this: glTexParameteri(GL_TEXTURE_2D, ...
12
votes
1answer
9k views

Making a HUD/GUI with OpenGL (LWJGL)

I'm at the stage in my game development where I need to make a HUD or GUI. I've never gotten to this part, so I don't know how its done. I tried rendering a simple quad at a fixed position on the ...
12
votes
4answers
10k views

How to load 3D models into Java?

Using LWJGL what is the easiest way to load a 3D model to be drawn on screen? I know LWJGL doesn't have built in loading support so I am looking for a small library that would help to load ...
10
votes
3answers
9k views

How can I make OpenGL textures scale without becoming blurry?

I'm using OpenGL through LWJGL. I have a 16x16 textured quad rendering at 16x16. When I change it's scale amount, the quad grows, then becomes blurrier as it gets larger. How can I make it scale ...
9
votes
5answers
625 views

Increasing the probability for similar tiles to generate next to each other

I'm working on a tile map system, which insofar looks like this (green is grass, air is white, stone is grey, and blue is water): It uses a simple random number generator so that there's a 45% ...
8
votes
2answers
580 views

What is the primary use of Vertex Buffer Objects?

From what I've read, it seems VBOs are purely for performance. I'm working on a very rudimentary learning project in lwjgl and I'm just trying to figure out what more advanced features of the library ...
7
votes
3answers
2k views

Rendering only what is on the screen

I am fairly new to this world, so bear with me. I have a grid of blocks in a top-down, 2d game written using Slick. The best way to think of it is the Pokemon world. Right now, I am rendering all ...
7
votes
1answer
6k views

OpenGL: Resizing Display and glOrtho/glViewport

I have researched this question from several sources and have yet to find a firm answer saying that "yes that is correct thinking" or "no, here is how it's done." I am trying to ensure resolution ...
7
votes
2answers
1k views

What causes some computers to have no or slow OpenGL, and how to fix it?

I am using Java with JOGL to create OpenGL enhanced 2D graphics. The graphics operations I use are nothing fancy, and should be supported by almost any recent graphics card. For example, my game ...
6
votes
3answers
930 views

Understanding how to create/use textures for games when limited by power of two sizes

I have some questions about the creating graphics for a game. As an example. I want to create a motorbike. (1pixel = 1centimeter) So my motorbike will have 200 width and 150 height. (200x150) But the ...
6
votes
2answers
6k views

How do you determine which object/surface the user's pointing at with lwjgl?

Title pretty much says it all. I'm working on a simple 'lets get used to lwjgl' project involving manipulation of a rubik's cube, and I can't figure out how to tell which side/square the user's ...
6
votes
2answers
851 views

How are dynamic blending shadows like this created?

I would like to know, how dynamic shadows, that 'blend' onto other objects, are created.
6
votes
1answer
311 views

2D Polygon Triangulation

I am creating a game engine using the JBox2D physics engine. It only allows you to create polygon fixtures up to 8 vertices, To create a body with more than 8 vertices, you need to create multiple ...
6
votes
2answers
533 views

An odd performance problem rendering a simple scene (less than 14k vertices) in OpenGL using two vbos with LWJGL

Problem I have been having a strange degrading performance issue rendering a simple scene containing two "chunks" of 4x4x4 cubes each. Video of problem This is a screen capture showing my console ...
6
votes
3answers
3k views

How do I render a PNG with transparency in LibGDX?

I'm building a simple tic-tac-toe example with LibGDX. I have simple images: cross, circle and board, all pngs created with GIMP with a transparent background. How can I render them as a Texture with ...
5
votes
3answers
1k views

How Do Day Night Cycles Work?

I know that this is a vage question, but how do day night cycles work in video games? How do I get started programming one? I have researched for a while, but the only thing I saw was "unity 3-d day ...
5
votes
5answers
2k views

Is there a cross-platform special directory I can use for game save files?

I'm developing with LWJGL and Java on a Windows 7 laptop. I've successfully set up saving to the %appdata%\gamename\saves\ or long form c:\users\user\appdata\roaming\gamename\saves\ folder by using ...
5
votes
1answer
2k views

GLSL Light (Attenuation, Color and intensity) formula

I'm implementing point lights in my Voxel engine, and I'm really struggling to get a good flow of light, from 100% near the light source to 0% at the light radius. I have 5 arguments for the ...
5
votes
2answers
711 views

3D models on 2D tilemap perspective when scrolling

I am creating a small top-down game, where the player traverses a 2D tilemap, with an illusion of depth provided by 3D models for things like buildings or trees. Having gotten to the point where I ...
5
votes
2answers
866 views

Disadvantages of using multiple versions of OpenGL in LWJGL?

So, I'm trying to figure out LWJGL, and my goal is to use OpenGL 3.2 (because pretty shaders are pretty). But in every tutorial I can find for LWJGL, they import a bunch of different OpenGL versions ...
5
votes
5answers
1k views

How to get more than one window in Java LWJGL

I'm trying to write a game in Java LWJGL. And I need more than one (multiple) display window. By default I've got one display window where I can draw everything. But I'd like to split some data to ...
5
votes
2answers
353 views

How does this snippet of code create a ray direction vector?

In the Minecraft source code, this code is used to create a direction vector for a ray from pitch and yaw:' float f1 = MathHelper.cos(-rotationYaw * 0.01745329F - 3.141593F); float f3 = ...
5
votes
2answers
295 views

Are display lists faster than VBOs?

I'm making a voxel rendering engine. My "chunks" are 32 * 32 * 256 blocks and I can render a 16 * 16 square of them (which corresponds to Minecraft's maximal render distance). I'm using VBOs holding ...
5
votes
1answer
296 views

Implementing Vehicles in your game

In the game i am creating as an hobby (learning is the primal goal of it all) i plan to implement a space ship that the player can enter and use to explore it. I tried to search the internet for the ...
5
votes
1answer
1k views

What's the best way of drawing a glowing 3d line using LWJGL?

Sort of like a strip-light effect; not actually a light source, but just a polygon with glowing edges. Can this be done easily? Right now I'm contemplating drawing a line more than once with varying ...
4
votes
3answers
731 views

Voxel engine artifacts

There are white little dots between blocks at random places, mainly at very near blocks. They disappear when I move the mouse and change the view direction. I use Vertex Arrays with ...
4
votes
3answers
991 views

How can I change this isometric engine to make it so that you could distinguish between blocks that are on different planes?

I have been working on an isometric minecraft-esque game engine for a strategy game I plan on making. As you can see, it really needs some sort of shading. It is difficult to distinguish between ...
4
votes
2answers
4k views

Texture antialiasing?

In my Minecraft-clone style game, blocks are textured with a border that is lighter then the block color. See picture below: To achieve this effect without the textures being blurry I use this ...
4
votes
4answers
424 views

Storing data for a pokemon like game

The game I'm developing is close to Pokemon. How should I store the data? I am currently thinking of text files where I save the map and have a corresponding textfile for the trainers and their teams ...
4
votes
1answer
972 views

How do I draw a full resolution texture to a window of the same resolution?

My image is 1280x800, and my screen size is 1280x800. It should draw perfectly. I'm creating a quad the size of the screen, and setting the texture to fit the quad. But right now it draws a square ...
4
votes
2answers
947 views

Slick2D Isometric TiledMap Rendering Problem

I created a Tiled Map using the Tiled Map Editor. In the Editor it looks like this: Desired State In my java program it looks like this: Actual State My java code is: public class Game extends ...
4
votes
2answers
1k views

Ray Picking Problems

I've read so many answers on here about how to do Ray Picking, that I thought I had the idea of it down. But when I try to implement it in my game, I get garbage. I'm working with LWJGL. Here's the ...
4
votes
1answer
2k views

Distributing cross-platform .jar containing natives for LWJGL?

I'm making a game in Java using Slick2d, which depends on LWJGL. I can get everything to work in my development environment, but when I export it to a .jar, it needs the natives placed in the same ...
4
votes
2answers
4k views

Starting Java 2D Platformer using LWJGL [closed]

Getting started on a 2d platforming project in java. I've decided on using LWJGL and OpenGL, but I don't quite know where to start. What is typically the first thing one would work on with a ...
4
votes
1answer
1k views

Create the right pom.xml for LWJGL and Slick Project (Maven)

can somebody tell me whats wrong with my pom.xml file? At this point i get this error if i start my *.jar file: C:\Users\Michael\git\freezing-robot\target>java -jar ...
4
votes
1answer
275 views

Restricting Camera Movements with OpenGL

I've been programming a game using the Java library LWJGL. I've got a little problem, though. It is a 2D game, and I'm aiming for a game like the original Civilization (I quick Google of "Civilization ...
3
votes
1answer
241 views

Where should I put my mob rendering code?

I'm making a simple LWJGL game. However, I'm a bit confused about rendering. So I have a Mob class and a TriangleMob is a basic enemy. package daniel.entity.Mob; public class TriangleMob { ...
3
votes
1answer
209 views

Minimizing amount of comparisons for collisions?

In my 'Terraria' based game I am having lag issues. The cause of the lag is as follows: Every update loop through all the tiles in the world: If the rectangle that was passed as an arg intersects ...
3
votes
2answers
556 views

Textures on top of other textures when using VBOs

I'm currently making a cube style game. With chunks being drawn with VBOs. I'd like to know if there is a way to create an overlay texture on top of the existing texture without the need to rebuild ...
3
votes
1answer
2k views

Can't get LWJGL lighting to work

I'm trying to enable lighting in lwjgl according to the method described by NeHe and this post. However, no matter what I try, all faces of my shapes always receive the same amount of light, or, in ...
3
votes
1answer
225 views

Rendering a black and white image in OpenGL 1.1

Is there is any way that I can simple disable the color in OpenGL 1.1? Or can I "grey out" textures in LWJGL?
3
votes
1answer
194 views

LWJGL Eclipse Resource Deployment

I'm still experimenting with some OpenGL in LWJGL, and as I get to know more and more about OpenGL, I start to do more complicated things like multi texturing, shadowmapping and more. Now, right now ...
3
votes
1answer
495 views

How can I set the rotation of a shape to the same as my image?

The way you set rotations of images is different from setting shape rotations. So how can I make the shape have the same rotation as my image? This is how my image rotates: ...
3
votes
1answer
1k views

With Slick, how to change the resolution during gameplay?

I am developing a tile-based strategy game using Java and the Slick API. So far so good, but I've come to a standstill on my options menu. I have plans for the user to be able to change the ...
3
votes
1answer
403 views

Best way to Draw a cube for 3D Picking on a specific face

Currently I am drawing a cube for a game that I am making and the cube draw method is below. My question is, what is the best way to draw a cube and to be able to easily find the face that the cursor ...
3
votes
1answer
353 views

How do I call glVertexPointer in Java?

I'm trying to convert the following code to Java: glVertexPointer( 3, GL_FLOAT, 0, &(mesh.m_PositionBuffer[0]) ); Where mesh::mPositionBuffer is std::vector<glm::vec3>; How would I make ...
3
votes
3answers
2k views

Suggest a simple Java math library for matrix operations for use with OpenGL (lwjgl) [closed]

I'm writing an OpenGL app with Java. I need to do some math for camera and frustum culling (for AABB). Could you suggest a simple and fast Java math library for that?
3
votes
1answer
847 views

Ray picking - get direction from pitch and yaw

I am attempting to cast a ray from the center of the screen and check for collisions with objects. When rendering, I use these calls to set up the camera: GL11.glRotated(mPitch, 1, 0, 0); ...
3
votes
3answers
4k views

How to render axometric/isometric tiles that are a 2d array in logic, but inclined 45º visually?

I am making a tile-based strategy game which i plan to have 2.5D visuals in an axometric/isometric fashion. Right now i'm programming it's logic and rendering it as a literal 2-dimensional array ...
3
votes
1answer
757 views

Is there any way to get the HWND from a window in LWJGL?

I've started some experimentation in Java and LWJGL (via Slick), and it seems very solid. However, I have some legacy code that requires a HWND integer as a parameter. I'm not sure how I'd be able to ...