Hello Guest

Recent Posts

Pages: 1 [2] 3 4 ... 10
11
OpenGL / Re: Memory corruption during glfwTerminate
« Last post by jorrit on March 17, 2019, 09:49:53 »
Oh thanks. I totally missed that
12
OpenGL / Re: Memory corruption during glfwTerminate
« Last post by KaiHH on March 17, 2019, 09:47:06 »
Look at your Buffer.init() method. You free the verticesBuffer twice by calling memFree(verticesBuffer) twice.
Code: [Select]
    private void init() {
        FloatBuffer verticesBuffer = MemoryUtil.memAllocFloat(vertices.length);
        verticesBuffer.put(vertices).flip();

        vaoId = glGenVertexArrays();
        glBindVertexArray(vaoId);

        vboId = glGenBuffers();
        glBindBuffer(GL_ARRAY_BUFFER, vboId);
        glBufferData(GL_ARRAY_BUFFER, verticesBuffer, GL_STATIC_DRAW);
        memFree(verticesBuffer); // <- FREE HERE!!!

        glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);

        glBindBuffer(GL_ARRAY_BUFFER, 0);
        glBindVertexArray(0);

        if (verticesBuffer != null) { // <- is true
            MemoryUtil.memFree(verticesBuffer); // <- AND HERE!!!
        }
    }
13
OpenGL / Memory corruption during glfwTerminate
« Last post by jorrit on March 17, 2019, 09:33:44 »
Hi all,

I have a problem with a memory corruption during glfwTerminate. When I run this program and press esc to exit I get this:

Renderer.destroy: 1
malloc(): memory corruption

The problem goes away if I don't create and destroy the Buffer object so I guess it has something to do with that. But I can't figure out what's wrong. I'm using lwjgl 3.2.1.1 on Linux

All the code (minimized as much as I could):
https://gist.github.com/McJty/69a7130ce54caf765434c3af865d1b1a

Thanks in advance
14
This is the GLFW check that triggers the error you're seeing: window->context.client == GLFW_NO_API. I can't guess how that could happen without a code sample that reproduces the issue. You may also want to try LWJGLX/debug to verify that there aren't any obvious issues in your code.

In any case, there's a much better way to toggle fullscreen mode and/or change the resolution: glfwSetWindowMonitor. This function can do both changes without destroying the OpenGL context.
15
I am trying to support changing resolution on the fly. It works fine for me 95% of the time, but very occasionally the game crashes with the following error:

Code: [Select]
GLFW_NO_WINDOW_CONTEXT error
Description : Cannot swap buffers of a window that has no OpenGL or OpenGL ES context
Stacktrace : org.lwjgl.glfw.GLFW.glfwSwapBuffers(GLFW.java:4521)
...

This is significantly more common on less powerful systems; a friend of mine sees this crash consistently.

I haven't been able to find much information about this error and I have no idea what would cause it. I am specifically destroying the old window, creating a new one and setting the context, before I try to render:

Code: [Select]
GLFW.glfwDestroyWindow(window);
...
window = GLFW.glfwCreateWindow(...);
if (window == 0) {
    throw new RuntimeException("Failed to create window");
}
GLFW.glfwMakeContextCurrent(window);

Would you expect this to work, or am I missing something?

EDIT: glSwapBuffers is being called from the same thread, AFTER creating the new window, so I don't understand how this error could come about.

Thanks,
Danjb
16
General Java Game Development / Re: How to do GUI
« Last post by Kgboi on March 05, 2019, 23:33:10 »
How do I actually turn these into libraries. I'm not familiar with maven or gradel, and have no idea on how I actually use these as libraries.
17
General Java Game Development / Re: How to do GUI
« Last post by spasi on March 05, 2019, 14:13:23 »
See:

- https://github.com/orange451/LWJGUI
- https://github.com/SpinyOwl/legui
- https://github.com/SkyAphid/Clear/
- https://github.com/kotlin-graphics/imgui
- https://github.com/LWJGLX/lwjgl3-swt

Other than NanoVG, LWJGL has bindings to the Nuklear & Yoga libraries, which might also help with GUI development.
18
General Java Game Development / How to do GUI
« Last post by Kgboi on March 05, 2019, 12:39:20 »
Are there any GUI libraries that work well with LWJGL 3 and have decent documentation. I tried using NanoVG but there is very little documentation.
19
Vulkan / Re: vkGetInstanceProcAddr doesn't find function address
« Last post by ilum on March 05, 2019, 09:01:38 »
Quote
Sorry, you need to add VK_EXT_DEBUG_UTILS_EXTENSION_NAME for vkCreateDebugUtilsMessengerEXT.
Thank you again. That did the trick.

Quote
Btw, unless you're doing the function lookup manually to familiarize yourself with the low-level details, LWJGL has already done this work for you in the VKCapabilities<Instance/Device> classes
That is good to know.
20
Vulkan / Re: vkGetInstanceProcAddr doesn't find function address
« Last post by spasi on March 05, 2019, 08:21:59 »
Sorry, you need to add VK_EXT_DEBUG_UTILS_EXTENSION_NAME for vkCreateDebugUtilsMessengerEXT.

Btw, unless you're doing the function lookup manually to familiarize yourself with the low-level details, LWJGL has already done this work for you in the VKCapabilities<Instance/Device> classes. For example, you can check if EXT_debug_utils is available with:

Code: [Select]
if (instance.getCapabilities().VK_EXT_debug_utils) { ... }
or an entry point directly (usually not necessary) with:

Code: [Select]
if (instance.getCapabilities().vkCreateDebugUtilsMessengerEXT != NULL) { ... }
Pages: 1 [2] 3 4 ... 10