Main Menu

Recent posts

#1
LWJGL Documentation / Re: The HelloWorld sample at h...
Last post by bitlife2org - February 11, 2026, 07:16:17
Wayland does not allow applications to set global window positions, so glfwSetWindowPos will be ignored on Wayland. The HelloWorld sample should clearly mention this platform limitation to avoid confusion for Linux users. Bitlife
#2
OpenGL / Procedural Textures: How to ap...
Last post by subwaycity - February 03, 2026, 07:49:05
Hi, i've found a lot of code about creating a procedural textures, but still i don't have any idea of how to apply them to a terrain surface (or any other kind of 3d object). I think the sequence should be this:

-create an empty texture
-bind the texture
-for every triangle in my surface redraw the texture passing the coordinate to a function which draws my texture
-apply the current texture to the triangle using the classical textCoords method

I think, but i'm not sure, that this should be the right sequence. Can somebody tell me if i'm right and then post some simple and clear code in which a procedural texture is created and then applied? Thank you very much (i apologize about my poor english!!)

Subway Surfers City
#3
Lightweight Java Gaming Library / How do I access the AUX0 buffe...
Last post by fnforg - February 02, 2026, 07:09:58
Hi,

I am trying to save the current buffer contents (including depht buffer) into the aux0 buffer, so I can use it as background and simply use glCopyPixels to init the new backbuffer and render on top of it.

Unfortunatly this does not seem to work, because my system seems to lack the auxiliary buffers. Do I have to initialize or create these buffers first, or do I have to live with the fact that my opengl driver does not support them? Or maybe I can use a pbuffer for the same task, but I have not found out how to copy the pixels to the backbuffer.

With thanks in advance

FNF Game
#4
Lightweight Java Gaming Library / Re: Slang bindings
Last post by codex - January 25, 2026, 21:11:49
Ah, ok, that makes a lot more sense. Thanks for the clarification!
#5
Lightweight Java Gaming Library / Re: Slang bindings
Last post by spasi - January 25, 2026, 21:05:08
First of all, slang does not have a pure C API, so this isn't going to be straightforward. Do not try to support C++ features, LWJGL does not support C++ bindings.

With that said, types like ISession are usually treated as opaque types. E.g.

val ISession = "slang::ISession".opaque

For example, in:

SLANG_EXTERN_C SLANG_API slang::IModule* slang_loadModuleFromSource(
    slang::ISession* session,
    const char* moduleName,
    const char* path,
    const char* source,
    size_t sourceSize,
    ISlangBlob** outDiagnostics = nullptr);

the session parameter would be defined as:

ISession.p("session")

which LWJGL understands as: a paramater with name "session" that has a type "pointer to opaque type slang::ISession".
#6
Lightweight Java Gaming Library / Re: Slang bindings
Last post by codex - January 25, 2026, 19:13:39
Thanks for the guidance. I'm attempting option 1, but slang already seems a lot more complex than shaderc, so I have some questions.

struct ISession : public ISlangUnknown {
    virtual IGlobalSession* getGlobalSession() = 0;
    virtual IModule* loadModule(const char* moduleName, IBlob** outDiagnostics = nullptr) = 0;
}

How do I properly represent ISession? I've tried using both StructType and NativeClass for this, but neither seems to cover all the bases.
#7
Lightweight Java Gaming Library / Re: Slang bindings
Last post by spasi - January 22, 2026, 09:09:45
Hey codex,

There are two options now:

1. Building "offline" bindings as a new LWJGL module. You could start by examining the shaderc bindings and doing something similar for slang. This involves using the LWJGL Kotlin-based bindings generator. A great starting point is the commit that first added the shaderc bindings, it should include everything necessary to get started.

2. Building runtime-generated bindings using LWJGL 3.4.0. If you're able to upgrade to 3.4.0 and JDK 25, then you can use the new FFM-based runtime bindings generator in the org.lwjgl.system.ffm package. With this generator you write simple Java interfaces to describe a C API (downcalls, upcalls, structs/unions) and you get instances of those interfaces generated at runtime by LWJGL. Assuming you have access to prebuilt slang binaries, you should be able to start using it immediately, without building a custom LWJGL or waiting for a fresh snapshot.
#8
Lightweight Java Gaming Library / Slang bindings
Last post by codex - January 22, 2026, 00:51:06
Are there any plans to add bindings for slang? If not, how can I get started on making these bindings for lwjgl myself?
#9
General Java Game Development / Re: CPU load and FPS decrease ...
Last post by rakeshjogi - January 08, 2026, 08:15:43
I agree with you. If you are frequently creating temporary objects, this action may quickly overwhelm the garbage collector. In your case as you say you are frequently creating temp objects like FloatBuffer during each matrix calculation.  This will definitely cause GC pauses and CPU/FPS spikes, exactly as you observed.

As you pointed out, your workaround of minimizing heap movement and constraining the young generation memory is more of a temporary patch than a sustainable solution.

For long-term optimization, reducing object churn (especially in the render loop) is key. Reusing buffers, pooling objects, or switching to off-heap/native memory when appropriate can dramatically reduce GC overhead.
It clearly explains how memory is managed in Java, why large object allocation or frequent temporary allocations lead to performance hits, and what GC does during a pause.

Also, suppose if you want to understand your GC behavior better, then try analyzing your GC  logs using GCeasy. It helps you with visualizing the memory usage, GC durations, and object promotions, which can reveal spikes and inefficiencies much more clearly than VisualVM alone.
#10
Hi, I'm a complete newbie to Java, and I need a bit of a friendly shove to get me started, if someone could be so kind. 

I've tried to find a tutorial, or sample piece of code for what I am trying to do, but I'm either too blind, or too stupid to find what I'm after.

All I want is a bit of code to draw my game map as an isometric grid (hell, right now, I'd just settle for a straight 2D chessboard!).  I've got a 2D array, and I want to be able to map it to a window, and allow scrollbars.

Does anyone know of some source code for this, or a tutorial?

You'd be helping an idiot to begin to figure out where his feet are.  Thanks a bundle!

Geometry Dash Lite