Hello Guest

Recent Posts

Pages: [1] 2 3 ... 10
1
General Java Game Development / Framebuffer debug
« Last post by Evgeny on January 17, 2021, 19:36:01 »
I use lwjgl 3.2.3 and I have some problems with fbo. How can I enable debug mode for fbo ? I found  glCheckFramebufferStatus only.
2
This thread is somewhere between a discussion and a question thread, please speak your mind freely...

One of Java's strength is the fact that the JRE exists on multiple platforms. As such, assume we have our nice Java game up and running, playing great and having zero bugs  ;)

Now, how to we pack it together and deploy it best? Users (or customers even) do not want to play through a programming IDE or fiddle with arguments in the command line. They want to double-click on an Exe, a launch-script or a button/link in Steam (or whatever their favorite platform is, mine is GoG). Furthermore, they do not want to manually install any dependencies, ideally they do not want to "install" anything at all, it should just magically "work"  ::).

Granted, of course we still have installers today. Granted, of course we still install dependencies today, just remember how often you installed some Visual C++ Redistributable today. But the purpose of this topic is to discuss how to deal with the problem best in a Java context, an LWJGL-context even, leveraging the fact that our code runs on all the big OS out there if a compatible JRE is tagging along.

In short, we need to deploy the following things to a user's machine:
* our compiled Java Source Code (in some shape or form, e.g a JAR)
* our native codes, e.g. LWJGL or the STB-library, in a distribution matching the platform of the user
* a Java Runtime in a distribution matching the platform of the user
* our game assets, that means its graphics, its sounds and the whatnot

Depending on our build system, aka how we manage our code during development, some of this stuff might be easier, harder or just different. A Maven build works differently from a Gradle one, a manually managed project is an entirely different beast ...

For sake of example, assume we have a Maven-managed project with LWJGL (and thus its natives) only, some graphics and of course some Java Code. If we manage to distribute this, the more complex cases will follow. Furthermore, assume that our distribution simply takes the form of a (zipable) directory which is supposed to run standalone on any somewhat modern PC of today onto which we copy said folder. No "installer", no custom compression, no registering the game in same OS-specific registry, no programmatic removal...

The way I see it, there are two big approaches pre-Java 14:

1.) doing it by hand
You download the JRE for the target OS and place your compiled JARs of your maven-target next to it. Furthermore, you place your game's assets there as well (in the dir-structure your game requires) and you do the same with OS-compatible LWJGL natives you need.
Finally, you write a little native program in some other programming language that, on launch, executes the JRE with your JAR (and potentially all the other relevant file locations) as input.

2.) the build-system approach
This is similar to the above, but you leave the asset management to your build system, e.g. Maven. This probably has benefits if you are using classpath-resources. Natives and graphics get packed into your JARs as well or are already part of a JAR, like lwjgl-natives. Note however that since most OS only load native libraries from a "true" file, files from lwjgl-native will be regularly unarchived into a user's temporary directory by LWJGL.
For the rest, you procced as you did above, that means having the JRE somewhere in your distribution and writing a little launcher application.

With Java 14, a new way has arisen (or came back) and as such, the rather new JPackager needs to be discussed. This thing is supposed to construct a pseudo-native Application containing the relevant parts of the JRE necessary for your program, but I have little experience with this technology thus far. With respect to our example, it seemingly overcommits, since it does in fact build an installer around the distribution, but everything else sounds good. How it interoperates with existing native code of the project, like LWJGL, is unclear to me. If somebody here has experience with the thing, please share your thoughts or even a practical example.

So, considering our goal of deploying a hassle-free, runable distribution, what are your thoughts on the matter?  :)
Is there an established practice for LWJGL programs? Is it worth to check out what libgdx does or is that too far removed from the pure Java with a little lightweight native that LWJGL represents?
3
Lightweight Java Gaming Library / Re: Does LWJGL 3 officially run on M1 Mac?
« Last post by spasi on January 12, 2021, 06:47:56 »
Not yet, but ARM support for macOS and Windows is being worked on for the next release.
4
Lightweight Java Gaming Library / Does LWJGL 3 officially run on M1 Mac?
« Last post by seokhyun0504 on January 11, 2021, 14:20:41 »
When I run on the M1 mac with the tutorial code, I got this Error Message

Code: [Select]
[LWJGL] GLFW_PLATFORM_ERROR error
Description : Cocoa: Failed to find service port for display
Stacktrace  :


How this Message is appeared and how can I fix it?
i dont know the m1 architecture system and macos environment

(sorry for my english writting, cuz i'm learning english now)
5
Lightweight Java Gaming Library / isCloseRequested
« Last post by Jehan on January 10, 2021, 19:54:38 »
hi everyone I have a simple question.

how to send a request to make Display.isCloseRequested() true ?

Code: [Select]
while (!Display.isCloseRequested())
{
Display.update();
nbFrame++;
}
Display.destroy();

thankyou !!
6
OpenGL / Multiple textures for multiple shaders
« Last post by Mihai_Ionut_Floares on January 09, 2021, 04:35:21 »
I have these 2 fragment shaders:
Simple.fragment:
Code: [Select]
#version 330 core

in vec2 UV;

out vec4 color;

uniform sampler2D myTextureSamplerr;
void main(){
//use the texture
}

Unlit.fragment:
Code: [Select]
#version 330 core

in vec2 UV;

out vec4 color;

uniform sampler2D myTextureSamplerr;
void main(){
//use the texture
}
And that's how I load them:
Code: [Select]
public static int loadTexture(String imagepath) {
Image image = new Image();
IntBuffer width = BufferUtils.createIntBuffer(1);
    IntBuffer height = BufferUtils.createIntBuffer(1);
    IntBuffer comp = BufferUtils.createIntBuffer(1);

ByteBuffer data = stbi_load(imagepath, width, height, comp, 4);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);


glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width.get(), height.get(), 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
id = glGenTextures();




stbi_image_free(data);

return id;


}

How to send a texture to first shader and another to the unlit one? Because even if I call the loadTexture method with 1 texture for a lit object and with the 2nd texture for the unlit one the both objects will use the 2nd texture(last called)
I think the problem is this line: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width.get(), height.get(), 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
It searched for uniform sampler2D and give the image to all of them.
7
OpenGL / Draw something in front of every thing else
« Last post by Mihai_Ionut_Floares on January 08, 2021, 21:20:40 »
How to draw an object even if it is behind another object?
8
OpenGL / Re: GLFW 3 Hide cursor
« Last post by Mihai_Ionut_Floares on January 08, 2021, 19:58:44 »
Sorry. I just found the solution:
Code: [Select]
glfwSetInputMode(WINDOW, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
9
OpenGL / GLFW 3 Hide cursor
« Last post by Mihai_Ionut_Floares on January 08, 2021, 19:53:54 »
I'm using this to set the cursor on the center of the screen to be able to pan the view around using mouse input like any other 3d game:
Code: [Select]
glfwSetCursorPos(WINDOW, Main.WIDTH/2, Main.HEIGHT/2);
It is working, but I want to add a crosshair. A simple GUI image centered. I want to keep the mouse functionality, but to hide it and keep only the crosshair.
10
OpenGL / Parent GLFW windows to java awt windows
« Last post by Mihai_Ionut_Floares on January 08, 2021, 02:09:12 »
I drew an schematic image of what I need:


I need to parent a java awt window to another java awt window and parent to that a glfw window.
The hierarchy of the windows would look like this:
Code: [Select]
JAVA AWT WINDOW #1
       JAVA AWT WINDOW #2
       GLFW WINDOW


So the JAVA AWT WINDOW #2 and the GLFW WINDOW are at the same level(childs of JAVA AWT WINDOW #1)

Is this possible?
Pages: [1] 2 3 ... 10