Skip to main content
8 votes

Random black pixels GLSL shader bug

Unexpectedly black pixels sometimes indicate that you've got an infinity or NaN in the shader somewhere. For example normalize(vec3(0,0,0)) will generate a NaN. To me, the most obvious candidate in ...
Adam's user avatar
  • 7,384
7 votes
Accepted

Difference Between LibGDX and LWGJL

LibGDX is based on LWGL and its advantage are that a lot of the base stuff is already written and you don't need to write it. Some people prefer to write it themselves though. LibGDX is generally used ...
ProRed's user avatar
  • 340
7 votes
Accepted

Can I make color data not render as gradient?

You can try doing this with flat attribute qualifier in shaders, like so: flat vec3 surfColor; It tells GLSL to pass values ...
Kromster's user avatar
  • 10.7k
4 votes

Difference Between LibGDX and LWGJL

LWJGL is Lightweight Java Game Library. It is not engine. LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL), audio (...
SpinyOwl's user avatar
  • 144
4 votes
Accepted

multiply matrix4x4 with vec4

Matrix-vector multiplication works the same as matrix-matrix multiplication, because a 4d vector is basically matrix with one of the dimensions equal to 1. If we have a vector ...
Bálint's user avatar
  • 14.9k
4 votes
Accepted

Wind-blown fire particle effect from scratch

An effect like the one you show is actually pretty simple to code. Create a class Ember that sits at one (x,y) position and ...
Engineer's user avatar
  • 30k
4 votes
Accepted

Only Square Textures loading correctly (Beginner question)

It looks like your pixel lookup is backwards: int pixel = rawPixels[x*width+y]; Should be int pixel = rawPixels[x+width*y];
bornander's user avatar
  • 4,516
3 votes
Accepted

OpenGL is box blur this slow?

Yes and no. Yes, generally: the convolution operation is usually very computationally heavy and if you are sampling 7x7 area, that is 49 times more samples than you would usually do. No, in your ...
wondra's user avatar
  • 4,930
3 votes

How to optimize a cubes made world game?

Basically what you said above answers your question... Split the world into "chunks," and only load these when the player is within a certain distance. Minecraft has that useful "Render Distance" ...
Oliver Yasuna's user avatar
3 votes
Accepted

LibGDX Switching to fullscreen makes sprites blurry

The problem is that you started the game with a specific resolution Width x Height. Next you tell you application to render that on the fullscreen, so it is taking that rendering and upscaling it, ...
walkingBird's user avatar
3 votes
Accepted

LWJGL 3 how to convert screen coordinate to world coordinate?

There are to steps to converting cursor coordinates to world coordinates: 1) Convert the mouse coords to a direction. 2) Perform something like a raycast to find to world coordinate. Step 1: First ...
J22o's user avatar
  • 482
3 votes
Accepted

LWJGL—How to Animate and Render Characters Using a Sprite Sheet

It's much easier than you think. In your shader you need to have a uniform containing the size of one sprite and the position of the current sprite (in a normalized coordinate system, where ...
Bálint's user avatar
  • 14.9k
3 votes
Accepted

What are the different attributes of a vertex array object (VAO)?

There are not 16 attributes with fixed meaning. In old (pre 3.x) OpenGL there are a limited number of fixed function vertex attributes, and it is possible to use these in VAOs in compatibility ...
Maximus Minimus's user avatar
3 votes

Move between two points at a constant speed in LWJGL

Your question is not about lwjgl or implementation. It's about physics and math in fact. Velocity from definition is v = s/t. You want ...
Tooster's user avatar
  • 308
2 votes

Setting Window Icon Using GLFW (LWJGL 3)

I have found an answer!!! After searching far and wide through the depths of the internet, I have found the following method. It works perfectly! ...
Hello World's user avatar
2 votes

How do I pack my game LWJGL game into a single executable JAR with Maven?

This is the plugin you need ...
vesko.trich's user avatar
2 votes
Accepted

2D Camera in LWJGL 3

You put the translation data in the projection matrix. Don't do this, that matrix is strictly for converting 3d to 2d, put the camera stuff in the modelview matrix.
Bálint's user avatar
  • 14.9k
2 votes

Random black pixels GLSL shader bug

A guess (too long to put in a comment): If spotFactor becomes 0.6 at a specific pixel, from this float spotFactor = dot(lightDirection, spotLight.direction); ...
Stormwind's user avatar
  • 1,063
2 votes

Random black pixels GLSL shader bug

There is at least one serious problem in the code. In calcLight(), the test below is invalid. Calling pow with a negative first ...
sam hocevar's user avatar
  • 23.9k
2 votes
Accepted

LWJGL 3.0.0 glMapBuffer

Edited Answer Before writing to a Buffer Object, you must have some space allocated in GPU's memory, you can grow or shrink the Buffer Objects via: ...
Judison's user avatar
  • 36
2 votes
Accepted

How to draw text on screen in LWJGL

Slick-util depends on deprecated API that is not available anymore with the latest version of lwjgl2. You could try to enable deprecated APIs when you create the context, but LWJGL2 is old. If you ...
looper's user avatar
  • 136
2 votes

How to adapt to using a graphics library in a game coded using Java's native graphics methods?

There is only little useful information in your question. The reason, you are getting low fps is that you aren't actually using your graphics card. LWJGL uses OpenGL which is a graphics pipeline/...
l'arbre's user avatar
  • 245
2 votes

How do i eject bullet shells from a gun? Java/slick2d

To give you a pseudo code solution: Get X and Y from the gun (gun position). Work out the relative rotation of the gun from the player (purple arrow), so that you can easily offset the shell fall ...
user3797758's user avatar
  • 3,641
2 votes

How to correctly setup latest LWJGL libraries to Eclipse?

You can create gradle or maven project and add dependencies which you can generate on lwjgl download page. Another way - you can download jar Create simple Java project in eclipse, create folder ...
SpinyOwl's user avatar
  • 144
2 votes

How to correctly setup latest LWJGL libraries to Eclipse?

I've had to do this multiple times as of recent: here's my method. First, head over to the LWJGL homepage, and click on the DOWNLOAD tab up at the top. After that, click "Customize LWJGL 3" From ...
ND523's user avatar
  • 1,022
2 votes

Voxel Game - High Memory and CPU Usage

First of all, we can say with absolute confidence that the culprit is not your glfwSwapBuffers call. On it's own SwapBuffers doesn't do much; what it does however do is take all of the GL commands ...
Maximus Minimus's user avatar
2 votes

Poor performance with LWJGL VBO triangles

This is not how you are supposed to use VBOs and you will likely get better performance from immediate mode (glBegin/glEnd). There are a number of things seriously wrong with your code, including: ...
Maximus Minimus's user avatar
2 votes

Access violation when using shaders in LWJGL 3

Switch the statements glfwMakeContextCurrent() and GL.createCapabilities() ...
cozmic's user avatar
  • 477
2 votes

OpenGL Outlining Cubes in a Greedy Meshed Mesh

Ok, I finally got it to work using this annoying-looking method: ...
CJ Burkey's user avatar
  • 156

Only top scored, non community-wiki answers of a minimum length are eligible