Succesfully created Window does not respond // Stable #3.1.1 build 1

Started by SirFlashexx, November 08, 2016, 13:51:28

Previous topic - Next topic

SirFlashexx

Hello, I have created a simple window with GLFW, but the window does not repsond even though it seems to be successfully created.

GLFW Version: 3.3.0 Win32 WGL EGL VisualC DLL
OpenGL Version: 3.3.0 - Build 20.19.15.4531

Process finished with exit code -805306369 (0xCFFFFFFF)

I'm getting no other error besides the unusual exit code, but I also found that GL11.glClearColor does not change anything at the window, but the window is sized and positioned right. I'm using the IntelliJ IDEA and a customized version of LWJGL with OpenGL, OpenAL and GLFW from the Stable #3.1.1 build 1.

Any help will be greatly appreciated, thanks in advance.

SirFlashexx

spasi


SirFlashexx

import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.GL_FALSE;
import static org.lwjgl.opengl.GL11.GL_TRUE;
import static org.lwjgl.system.MemoryUtil.*;

import org.lwjgl.glfw.GLFWErrorCallback;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GL11;

public class Window {

    private GLFWErrorCallback errorCallback = GLFWErrorCallback.createPrint(System.err);
    private long id;

    private String title;
    private int width, height;

    public Window(String title, int width, int height){
        this.title = title;
        this.width = width;
        this.height = height;
    }

    public void init(){
        glfwSetErrorCallback(this.errorCallback);

        if(!glfwInit()) throw new IllegalStateException("GLFW initialization has failed!");

        glfwWindowHint(GLFW_SAMPLES, 4);
        glfwWindowHint(GLFW_DOUBLEBUFFER, GL_TRUE);

        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);

        glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

        glfwWindowHint(GLFW_VISIBLE, GL_TRUE);
        glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

        this.id = glfwCreateWindow(this.width, this.height, this.title, NULL, NULL);

        if(id == NULL){
            glfwTerminate();
            throw new RuntimeException("GLFW window creation has failed!");
        }

        glfwSetWindowPos(this.id, 100, 100);

        glfwMakeContextCurrent(this.id);
        GL.createCapabilities();

        GL11.glClearColor(1.0f, 1.0f, 0.0f, 1.0f);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        System.out.println("GLFW Version: " + glfwGetVersionString());
        System.out.println("OpenGL Version: " + GL11.glGetString(GL11.GL_VERSION));

        glfwSwapInterval(1);

        glfwShowWindow(this.id);
    }

    public void destroy(){
        glfwDestroyWindow(this.id);
        glfwTerminate();
    }

    //GETTERS
    public long getId(){
        return this.id;
    }

    public String getTitle(){
        return this.title;
    }

    public int getWidth(){
        return this.width;
    }

    public int getHeight(){
        return this.height;
    }
}


In the main method I just create a new window and call the init method and start the loop. I really hope it is not a code error, I think it might have something to do with the natives maybe or so, I have been getting the error since you could customize the lwjgl download file.

spasi

The above code works for me. Some things you could try:

- Use LWJGL's debug mode. You can enable it with -Dorg.lwjgl.util.Debug=true.
- Do not set any hints that affect the OpenGL context (samples, version, profile, etc).
- Check for OpenGL errors.

SirFlashexx

Ok, so I enabled the debug mode and installed jemalloc, because I was getting an error which needed it to be installed... now it doesn't seem to me that I'm getting any errors, that's what the console is giving me:

Connected to the target VM, address: '127.0.0.1:54225', transport: 'socket'
[LWJGL] Version: 3.1.0 build 40
[LWJGL]     OS: Windows 10 v10.0
[LWJGL]    JRE: 1.8.0_102 amd64
[LWJGL]    JVM: Java HotSpot(TM) 64-Bit Server VM v25.102-b14 by Oracle Corporation
[LWJGL] Loading library (system): lwjgl
[LWJGL]    Loaded from java.library.path: natives\lwjgl.dll
[LWJGL] ThreadLocalUtil state: UnsafeState
[LWJGL] MemoryUtil accessor: MemoryAccessorUnsafe
[LWJGL] Loading library: jemalloc
[LWJGL]    Loaded from java.library.path: natives\jemalloc.dll
[LWJGL] MemoryUtil allocator: JEmallocAllocator
[LWJGL] Loading library: glfw
[LWJGL]    Loaded from java.library.path: natives\glfw.dll
[LWJGL] Loading library: opengl32
[LWJGL]    opengl32.dll not found in java.library.path=natives/
[LWJGL]    Loaded from system paths
GLFW Version: 3.3.0 Win32 WGL EGL VisualC DLL
OpenGL Version: 3.2.0 - Build 20.19.15.4531
Disconnected from the target VM, address: '127.0.0.1:54225', transport: 'socket'

Process finished with exit code -805306369 (0xCFFFFFFF)


Any ideas what could make my window not respond? Is there any way to have a crash report for java, so for the window itself, not anything with the IDE or my code?

spasi

Quote from: SirFlashexx on November 16, 2016, 03:21:23Any ideas what could make my window not respond?

One reason could be not calling glfwPollEvents().