How would you select different pictures in a sprite sheet to put on the screen with LWJGL?
Your question is a bit generic: do you have code examples of what you are trying to do?
You may consider using Slick2D or LibGDX, which both support easy-to-use sprite sheets out of the box.
Maybe I misunderstood the question, but isn’t that just done by setting the texture coordinates so that the right area from the sprite sheet is put as texture on the sprite?
So … actually it’s pretty easy.
You’ve got a SpriteSheet, which has dimensions width and height (in pixels).
Usually for Texture coordinates you use these:
1st Vertex: x: 0; y: 0 1st Vertex: x: 1; y: 0 1st Vertex: x: 1; y: 1 1st Vertex: x: 0; y: 1
We could replace this by some variables: lowX, lowY, highX and highY:
1st Vertex: x: lowX; y: lowY 1st Vertex: x: highX; y: lowY 1st Vertex: x: highX; y: highY 1st Vertex: x: lowX; y: highY
To get the above example, we would use 1 for high and 0 for low.
Sooo, to draw “Sprites” from the SpriteSheet, you’d just change your high and low values.
If you’ve got a spritesheet which is 512 pixels of width and 512 pixels of height, and you want the Sprite in the SpriteSheet at position x: 32; y: 32 and width: 64; height: 64, then you’d easily use this:
sprite.lowX = sprite.pixelX / sheet.width;
sprite.lowY = sprite.pixelY / sheet.height;
sprite.highX = sprite.lowX + (sprite.pixelWidth / sheet.width);
sprite.highY = sprite.lowY + (sprite.pixelHeight / sheet.height);
It’s pretty easy actually.