r/LWJGL • • Oct 06 '14

LWJGL is love. LWJGL is life.

5 Upvotes

I was only 16 years old.

I loved LWJGL so much, I read all the books and all the doc

I coded with LWJGL every day, thanking it for the API I've been given.

"LWJGL is love" I say. "LWJGL is life"

My friend hears me and call me a java fag

I knew he was just jealous of my garbage collector, and my awesome APIs.

I called him an ActionScript fag.

He punch me, and erase my code.

I'm crying now, my code erased.

I lay on my desk, it's really cold.

A warmth is moving towards me.

I feel something updating

It's LWJGL 3.0 !

I am so happy.

It whispers in to my ear : "This is my code"

It grabs me with its powerful API optimization, and puts me infront of my monitor.

I am ready.

I start coding for LWJGL

It starts giving me deprecated warnings

It annoys my so much, but I do it for LWJGL

I can feel my code breaking

I code against all those errors

I want to please LWJGL

It renders a mighty cube as it make my FPS go trought the roof.

My friend walks in.

LWJGL looks him straight in the eye and say "c++ rip in pieces"

LWJGL crashes my PC.

LWJGL is love. LWJGL is life.

Just did it on a whim on skype, while I was bored.


r/LWJGL • • Jul 14 '25

I'm building a custom game engine in Java using LWJGL + Vulkan + Arena (Java 24)

0 Upvotes

r/LWJGL • • Sep 25 '15

How to render using glMultiDrawArraysIndirect [x-post /r/OpenGL]

Thumbnail
reddit.com
1 Upvotes

r/LWJGL • • Dec 08 '24

How do I load an image from the resources dir using STB?

Thumbnail learnopengl.com
1 Upvotes

I'm using Kotlin, and I'm following a guide. I ran into a problem when loading the texture. This is the code I use:

val width = intArrayOf()
val height = intArrayOf()
val nrChannels = intArrayOf()
val image = stbi_load("/textures/container.png", width[0], height[0], nrChannels[0], 0)

It's a file on the resources dir, and everytime I try to load it, an error occurs:

Missing termination

r/LWJGL • • Oct 24 '25

How to download?

0 Upvotes

I am trying to download LWJGL on my Model Name: HP Laptop 15-fc0xxx.

I don`t know how to download. I am using GitHub on the LWJGL website to download.

Please give me steps on how to download!🙏

Best Regards /MakeBox Studios


r/LWJGL • • Jun 14 '20

Problem while compiling shaders in LWJGL3

3 Upvotes

Hey, i'm working with LWJGL3 and I keep getting this error with a (i think) proper shader code :

0(1) : error C7502: OpenGL does not allow type suffix 'f' on constant literals in versions below 120

It says "in versions below 120" but i clearly defined the version to be 400 at the beginning of the shader. Here are the shader codes

VERTEX :

#version 400 core

in vec3 position;

in vec2 texCoords;

out vec2 pass_texCoords;

void main(void) {

pass_texCoords = texCoords;

gl_Position = vec4(position, 1.0f);

}

FRAGMENT:

#version 400 core

in vec2 pass_texCoords;

out vec4 out_Color;

uniform sampler2D textureSampler;

void main(void)

{

out_Color = texture(textureSampler, pass_texCoords);

}


r/LWJGL • • Nov 04 '19

What are some of the best LWJGL Vulkan tutorials?

4 Upvotes

r/LWJGL • • Jun 12 '23

Is LWJGL good option to start gamedev?

5 Upvotes

Hi guys, I was thinking of making my first game but I don't know if LWJGL is good for first time gamedevs. I'm searching to make some ps1-like graphics btw.

thanks


r/LWJGL • • Jan 03 '15

The best, most in-depth beginner LWJGL tutorial series I've ever found

Thumbnail
youtu.be
10 Upvotes

r/LWJGL • • Mar 28 '17

[Question] What is the best way of doing nine-patch?

1 Upvotes

So I saw this tutorial https://www.youtube.com/watch?v=sZ70yfwUHBo, and I know what he's doing is called nine-patch. The only problem is that Nine-Patch is for Android, or LibGDX. So how would I implement this in my own engine? Thanks!


r/LWJGL • • Mar 28 '17

[Development] Sudo-Engine

Thumbnail
github.com
1 Upvotes

r/LWJGL • • Apr 08 '17

Trying to learn LWJGL, but not sure if my GC supports it

3 Upvotes

I have an Intel HD 3000 GC on windows 7.

I just downloaded netbeans, and the stable LWJGL 3 release. I included it as a library in my java project. I got a window to open.

But no matter what I do, I can't seem to produce any graphics. It's always just a clear color window. I've tried 5 different tutorials now. I can't even draw a line. I'm wondering if it's because I don't have the proper hardware.

I even ran this line:

System.out.println("OpenGL version " + glGetString(GL_VERSION));

to try and see if I could determine which version of OpenGL I was 'using', and I just got this output:

OpenGL version null

Should I just go back to developing in Unity :P ? Don't have the cash for a hardware upgrade.


r/LWJGL • • Jan 18 '18

Slick2D Loading Assets in Threads?

2 Upvotes

I figured I would post this here since Slick2D is a wrapper for LWJGL and their community is all but dead.

I'm trying to rewrite my asset loader to multi-thread the process of loading assets by spawning a separate thread for each call to my addImage(), addSound(), and addMusic() methods.

However, I get exceptions due to the fact that these threads do not have access to the GLContext.

Is there a way to get around this? Most of the reason I need to do this is because the music takes a really long time to load (15+ seconds). Or is there a better way to do this?

You can find the code I'm using to do this here in the addImage() method:

AssetManager.java

I'd appreciate any help or a nudge in the right direction.


r/LWJGL • • Oct 21 '16

How to draw isometric grid using 3.0.0

1 Upvotes

I was wondering if anyone here knew of any tutorials that talked about how to draw an isometric grid like the one shown here


r/LWJGL • • Jun 19 '23

Delta Time is strange

3 Upvotes

in Java LWJGL, when I made a character controller and using IF conditions if a key is pressed, it can walk, but for gravity, there is no need for IF(!except collision), and here there is a problem, I change the value of the position y, subtract the force of gravity multiplied by delta time, but the position only changed once and that's it, sometimes it changes, but by a very small number, but in the condition IF the key is pressed, it works normally and correctly!

Why?

while(true) //game loop
{
    /////

    if(isKeyPressed("KEY"))
    {
        pos.y -= 9.81f * time_delta; //is working correctly!
    }
    
    pos.y -= 9.81f * time_delta; //is working NOT correctly!

    /////
}

r/LWJGL • • Jun 07 '23

Application slows down during mouse mouse movement

6 Upvotes

I originally asked this on another reddit, but it seems that ones currently doing an online protest and the mods aren't active to approve posts.

This is a little strange to describe, but the initial issue comes in with mouse movement.

First, the program runs just as expected. If I use my gamepad input to move the cursor, all is fine. All my other forms of input detection causes no problems in terms of the game loop. However, as soon as I move the mouse on my desk, if I move it faster than a crawl, it causes the entire program to stutter rendering and updating, almost as if its hung up on something. This issue only seems to affect the program when it is in a windowed state, even in borderless windowed fullscreen. When in exclusive fullscreen mode, this issue does not occur and I can move the mouse however I want. I do have a callback for cursor movement, but all I'm doing is reassigning my mouse x and y positions to the new position, nothing else is in the callback. My update method calls glfwPollEvents, and runs some standard model computation.

I'm using a standard fixed timestep game loop, shown here: https://pastebin.com/zHTUUB4W


r/LWJGL • • Jun 26 '23

stbi_load unable to open file

3 Upvotes

I'm porting my OpenGL engine from C++ to java using LWJGL, and I'm currently working on a wrapper class for textures. Whenever I try to load an image with stbi_load, stbi_failure_reason returns "Unable to open file".

Image loading code:

texture = glGenTextures();
bind();

String desiredPath = getClass().getResource(path).getPath();
stbi_set_flip_vertically_on_load(true);

int width, height;
try (MemoryStack stack = MemoryStack.stackPush()) {
    IntBuffer widthBuffer = stack.mallocInt(1);
    IntBuffer heightBuffer = stack.mallocInt(1);
    IntBuffer nrChannelsBuffer = stack.mallocInt(1);

    imageData = stbi_load(desiredPath, widthBuffer, heightBuffer, nrChannelsBuffer, 0);

    if (imageData != null) {
        width = widthBuffer.get();
        height = heightBuffer.get();

        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, imageData);
        glGenerateMipmap(GL_TEXTURE_2D);
    } else {
        System.err.println("Failed to load texture from path: " + desiredPath);
        System.err.println(stbi_failure_reason());
    }

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
catch (Exception e) {
    e.printStackTrace();
}

(bind is a helper method I made so I can use the texture outside of the class)


r/LWJGL • • Jun 25 '23

.jar problem!

2 Upvotes

There is a project in Eclipse, it is a game with Java LWJGL, it works fine in Eclipse, but after exporting to a runnable jar. It won't launch, I already checked Launch4j, JarSplice no result!

How to run .jar**?**


r/LWJGL • • Jun 23 '23

Looking for Learning material

3 Upvotes

Hello guys. Im learning OpenGL with lwjgl and i was wondering if anyone has some good learning materials, any books anything. That’d be much help. I cant seem to find anything that explains well


r/LWJGL • • Jun 15 '23

Problem with delta time

2 Upvotes

I'm developing a 3D video game in Java LWJGL, I created a flying camera, but the speed depends on the FPS, so I made a Timer class, and here it is:

public static long last_time;

public static long get_time()
{
    return System.nanoTime();
}

public static float delta()
{
    long result = get_time() - last_time;
    return (float)(result / 1000000.0f);
}

public static void update()
{
    last_time = get_time();
} 

FPS shows correctly, but the speed is still not the same, I multiply the speed by delta(), but it turns out, the lower the FPS, the larger the value of delta(), then the speed is higher, then there is a problem, because the speed is still different, sometimes the FPS "jumps" and the speed changes in real time, physically it can be noticed, but that's not all, I divide delta() by 1000000 to get milliseconds instead of nanoseconds, but when 1000000.0f is written as a Float, the camera still moves somehow, but at Int 1000000, at high FPS it doesn't move at all, only at 100+- it can move!

Does anyone know how to properly use delta to get as close as possible to a speed that won't vary much regardless of FPS?????


r/LWJGL • • Jul 05 '23

LWJGL = SFML vs Allegro vs SDL vs Ogre vs ???

3 Upvotes

Does anyone know witch c++/c/c# library comes closer to LWJGL (specially 3D and being cross-platform)?

I'm going crazy comparing them all.

How does Notch manage to code 3D games so fast for GameJams? Are LWJGL functions more higher level? Because OpenGL code for rendering a simple square can get to the 100's lines of code (VAO, VBO, etc) and his stuff don't seem anywhere near that.

https://github.com/skeeto/Prelude-of-the-Chambered


r/LWJGL • • Sep 09 '15

Square textures -> Triangular meshes?

1 Upvotes

Hi,

I'm trying to load a texture (3rd pic) to a triangular mesh.

First try as seen on 1st picture, the wireframe model of mesh is seen on the second. What am i doing wrong?

Code:https://gist.github.com/TheKiwi5000/e1bfd52b99d20fa45398

Images: http://imgur.com/a/miigD


r/LWJGL • • Mar 16 '17

FSEngine Dev Timelapse 2 - Productive Week

Thumbnail
youtube.com
1 Upvotes

r/LWJGL • • Dec 27 '14

How can I learn lwjgl 3?

2 Upvotes

I think LWJGL 2 is cool, and I even used it a little bit. I never got far enough to know how to render 3d models, though (I searched for hours for an up to date tutorial in lwjgl 2.9.1 and found nothing). Seeing that lwjgl 3 is out I want to learn it but can find no learning resources. The website really only goes as far as making a window with a red background. I want to really learn it and get deep into the library.