LWJGL Forum

Programming => OpenGL => Topic started by: ShadowDragon on October 28, 2016, 17:24:30

Title: LWJGL 3 - check for successfully initialisation of debug context
Post by: ShadowDragon on October 28, 2016, 17:24:30
Hi,

I'm wondering how I can check in LWJGL 3 with OpenGL 4.5 if a debug context was successfully initialized or not.
I know from a tutorial that in C++ I can check it that way, but no idea how to do it in Java with LWJGL 3:

GLint flags; glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT) { }


Thx in advance.
ShadowDragon
Title: Re: LWJGL 3 - check for successfully initialisation of debug context
Post by: Kai on October 28, 2016, 18:06:01
Almost exactly like in C/C++ :

int flags = GL11.glGetInteger(GL30.GL_CONTEXT_FLAGS);
if ((flags & GL43.GL_CONTEXT_FLAG_DEBUG_BIT) != 0) {
    // ...
}

With LWJGL you just have to know where the constants are defined in (i.e. in which OpenGL core version they were introduced). Or you use an IDE which can figure that out for you automatically.
Title: Re: LWJGL 3 - check for successfully initialisation of debug context
Post by: ShadowDragon on October 28, 2016, 18:38:45
Quote from: Kai on October 28, 2016, 18:06:01
Almost exactly like in C/C++ :

int flags = GL11.glGetInteger(GL30.GL_CONTEXT_FLAGS);
if ((flags & GL43.GL_CONTEXT_FLAG_DEBUG_BIT) != 0) {
    // ...
}

With LWJGL you just have to know where the constants are defined in (i.e. in which OpenGL core version they were introduced). Or you use an IDE which can figure that out for you automatically.
Ah ok thx. I think when the IDE would do this for me it would be faster. Any idea how to let eclipse do this for me?
Sometimes it would just be easier when Java would be like C++ (even when I'm a beginner to C++). :P
Title: Re: LWJGL 3 - check for successfully initialisation of debug context
Post by: Kai on October 28, 2016, 19:04:26
I have to say, that Eclipse really sucks hard in this regards.
If you want an enum constant or a static field to be auto-completed by Ctrl+Space without mentioning the declaring class, the only option is to add all classes, which Eclipse should try, into the Content Assist's "Favorites" list, to be found in "Window" > "Preferences" > "Java" > "Editor" > "Content Assist" > "Favorites" and there add all GLxx classes via "New Type...".

Just a side-node: IntelliJ IDEA achieves this _much_ better.

You can also just "import static" all GLxx classes once at the top of your compilation unit. You could even prepare an Eclipse editor template for that.
Title: Re: LWJGL 3 - check for successfully initialisation of debug context
Post by: ShadowDragon on October 28, 2016, 19:16:24
Quote from: Kai on October 28, 2016, 19:04:26
I have to say, that Eclipse really sucks hard in this regards.
If you want an enum constant or a static field to be auto-completed by Ctrl+Space without mentioning the declaring class, the only option is to add all classes, which Eclipse should try, into the Content Assist's "Favorites" list, to be found in "Window" > "Preferences" > "Java" > "Editor" > "Content Assist" > "Favorites" and there add all GLxx classes via "New Type...".

Just a side-node: IntelliJ IDEA achieves this _much_ better.

You can also just "import static" all GLxx classes once at the top of your compilation unit. You could even prepare an Eclipse editor template for that.
Ok thx.