Hello Guest

Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Lightweight Java Gaming Library / Re: LWJGL + JavaFX + MacOS
« Last post by spasi on January 12, 2024, 18:40:36 »
Hey Michael,

Without -XstartOnFirstThread, you must use the async GLFW implementation for macOS. You can do that with Configuration.GLFW_LIBRARY_NAME.set("glfw_async"). This will let you use GLFW from a secondary thread.

I'm not sure how it's going to work with JavaFX though. I've given up on trying to support any kind of integration between JavaFX and GLFW and haven't tested such a configuration. The recommended solution, which doesn't require any interaction with GLFW, is DriftFX: https://github.com/eclipse-efx/efxclipse-drift
22
Lightweight Java Gaming Library / Re: LWJGL + JavaFX + MacOS
« Last post by Michael Tetzlaff on January 12, 2024, 18:12:33 »
I've also now tried updating to LWJGL 3.3.3.  With the latest version of LWJGL, it now seems that if -XstartOnFirstThread is used, JavaFX ALWAYS hangs / fails to launch the window, regardless of initialization order or thread (main vs. non-main).  However, if -XstartOnFirstThread is not used, glfwInit() crashes the program (even when called on the main thread).
23
Lightweight Java Gaming Library / LWJGL + JavaFX + MacOS
« Last post by Michael Tetzlaff on January 11, 2024, 23:31:50 »
Hi, I'm trying to get a project running on MacOS that uses LWJGL and JavaFX.  (This project has run successfully on MacOS a number of years ago, but I haven't tested it in several years, and significant development on the project has happened since then.)

I am currently trying this with LWJGL 3.0.0 and JavaFX 17 (version 17.0.2 from org.openjfx in Maven).  I was previously using LWJGL 3.0.0b and JavaFX 11 (11.0.2).

I am using the XstartOnFirstThread VM argument.  I am running LWJGL / GLFW on the main thread, and launching JavaFX in a separate thread.  I only need LWJGL for offscreen rendering; I'm not trying to create a visible window or poll events.

The basic problem is that it seems that between GLFW and JavaFX, whichever one I initialize second hangs forever on initialization. 

For instance, if I try the following, JavaFX launches fine, but glfwInit() hangs and never returns:

        log.info("Starting JavaFX UI");
        new Thread(() -> kintsugi3d.builder.javafx.MainApplication.launchWrapper("")).start();

        try
        {
            Thread.sleep(5000L);
        }
        catch (InterruptedException e)
        {
            throw new RuntimeException(e);
        }

        if ( glfwInit() != true )
        {
            throw new GLFWException("Unable to initialize GLFW.");
        }

        // finish initializing GLFW, never gets here


(The sleep for 5 seconds is excessive, but just wanted a quick hack to be relatively certain it wasn't a race condition.)

On the other hand, if I use the following code, glfwInit() returns successfully, but my JavaFX application is never created (presumably hanging somewhere in internal JavaFX code):

        if ( glfwInit() != true )
        {
            throw new GLFWException("Unable to initialize GLFW.");
        }


        log.info("Starting JavaFX UI");
        new Thread(() -> kintsugi3d.builder.javafx.MainApplication.launchWrapper("")).start();

        try
        {
            Thread.sleep(5000L);
        }
        catch (InterruptedException e)
        {
            throw new RuntimeException(e);
        }

        // finish initializing GLFW


Any help getting this to work, or even which way is most likely expected to work, would be appreciated.  As I said before, I'm pretty sure I got this to work in the past, but that was before a lot of additional development happened, and probably on different versions of Java/JavaFX/LWJGL/MacOS.
24
LWJGL Documentation / Questions about Struct and StructBuffer
« Last post by p3dr0n on January 05, 2024, 23:40:08 »
Hello, everyone. I'm new here. I was kinda forced to create an account today because I found nothing that could help me with this thing.
I tried searching for tutorials, articles and videos but found nothing.
My problem regards implementing my own Struct<T> to use a StructBuffer<T>, as you might have guessed.
I got somewhere thanks to Netbeans complaints about methods I had to implement.


Code: [Select]
class Vertex extends Struct<Vertex> {
  public float x, y, z;
  public float u, v;
 
  protected Vertex(long l, ByteBuffer bb) {
    super(l, bb);
  }
 
  @Override
  protected Vertex create(long l, ByteBuffer bb) {
    // I really have no idea what to do here. Maybe read from bb using l?
    // Or use l to allocate something, but how?
  }

  @Override
  public int sizeof() {
    return 5 * Float.BYTES; // this makes sense
  }
}

I also don't have a glue if I need to do anything other than implementing Struct<Vertex>.create to get going.
Sorry to take your time and thank you for it. I also apologize for any misuse inside the forum.

Edit: Forgot to mention that I'm using lwjgl 3.3.3
Edit2: I just noted that there was a better "area" to post this. Sorry again...

25
Lightweight Java Gaming Library / Re: Indie Fighting Game using LWJGL!
« Last post by cpope9141 on December 20, 2023, 17:09:23 »
The December release of Area Zero (v0.7.0) is now available at www.EphemeralTechnicalArts.com !

Release Notes 0.7.0 (12/19/2023)
  -Tutorial mode added that covers all the basics:
    -Basic movements, dashing and running.
    -Blocking
    -Normal attacks
    -Evading
    -Grab and grab escape
    -Taunting
    -Special, EX special and super attacks.
  -Finished art assets for all of Richard's and Niven's special and super attacks.
  -Variant of Corporate HQ: Parking Garage (Night) added with unique background music.
  -Fixed audio bug in Violet's projectiles
  -Reset controller bindings on disconnect so that keyboard may be used as a fall back.
26
Lightweight Java Gaming Library / Having program with OpenGL Function
« Last post by Cordeku on December 19, 2023, 06:33:45 »
The function is createCapabilities();

I got a script from my friend and idk if Its required but I think it is so im a little scared.

TLDR: Fixed.
27
Lightweight Java Gaming Library / LWJGL On Macos
« Last post by joecqr on December 08, 2023, 22:15:02 »
Hello everyone,

I'm trying to compile a shader on macos but im getting some errors, I think this has to do that macos doen't support openpl, i saw in the system settings, it actually uses metal.
Im getting this error when i try to compile the shader
Code: [Select]
Error: vertex shader compilation failed
ERROR: 0:1: '' :  version '330' is not supported
ERROR: 0:1: '' : syntax error: #version
ERROR: 0:3: 'layout' : syntax error: syntax error

i saw there is lib called bgfx, but im not sure how to use it.

Is it possible to compile shader on mac that uses metal instead of opengl?

Thanks!
28
Ha, and in that version there is a memory bug fix https://github.com/LWJGL/lwjgl3/commit/9a997a2143e565b83a9bf760e57fcb141856c413 changing the create to a calloc.

So that all makes sense then, I've just been looking at an old version of that demo. Thanks!
29
I was referring to the same demo that was contributed to LWJGL, here: https://github.com/LWJGL/lwjgl3/blob/master/modules/samples/src/test/java/org/lwjgl/demo/openxr/HelloOpenXRGL.java. It's slightly different, not sure which version is more recent.
30
Quote
Yes, that is correct. Memory allocated with .create(), that delegates to BufferUtils -> ByteBuffer.allocateDirect, should not be freed explicitly.

Thanks, I'm glad my understanding is correct

Quote
Note that the LWJGL demo uses calloc for swapchainImageBuffer.

Does it? I was looking at https://github.com/knokko/lwjgl3/blob/origin/fix-xr-gl-sample/modules/samples/src/test/java/org/lwjgl/demo/openxr/HelloOpenXRGL.java#L452 where it seems to be created. Is that the right demo I'm looking at? (Its so hard with github repos to know which is the official one)
Pages: 1 2 [3] 4 5 ... 10