LWJGL Forum

Programming => OpenGL => Topic started by: Steppers on June 14, 2016, 17:41:50

Title: glClear refusing to work.
Post by: Steppers on June 14, 2016, 17:41:50
Hi all!

I'm trying to run the example program for lwjgl 3 from the website. I have done this in the past with no problem. I get no errors and it compiles and runs as expected. However, instead of filling the window with a solid colour it just uses whatever was behind it on initialisation (in my case, the IDE).

I have know idea what's wrong with it, and as it's the basic example I'm stumped. I have the latest nightly but still no luck.

On a side note, I've also tried using glfw in c++ (The glfw example) in a config that previously worked and am getting errors stating that glClear is an undefined reference so this might be a library thing (But still no compile or library loading errors).

I'm running Elementary OS (Based on Ubuntu 14) btw.

Thanks for any advice! :D
Title: Re: glClear refusing to work.
Post by: Kai on June 14, 2016, 18:10:49
This sounds more like a system misconfiguration (or a GLFW bug related to your system) than a bug in LWJGL 3.
If the linker cannot even find the OpenGL library, when you are trying to build an OpenGL program (you surely specified the `-lGL` linker flag after the specification of your source and object files when invoking GCC), then you are likely missing some system packages.
When you do manage to successfully build a native GLFW example, and the bug still persists, you could post an issue on the GLFW Issues page on GitHub.

What does the Java application output when you start that with the JVM argument "-Dorg.lwjgl.util.Debug=true" ?
Also, does glxgears (from package "mesa-utils") work?
Title: Re: glClear refusing to work.
Post by: Steppers on June 14, 2016, 19:57:36
Thanks!  :)
Ok, I'm using CLion with CMake so I've followed the instructions at http://www.glfw.org/docs/latest/build.html#build_link_cmake_source (http://www.glfw.org/docs/latest/build.html#build_link_cmake_source) for CMake and source but still 'undefined reference to glClear' :/

I imagined it was probably something like that but the debug vm option is giving me this
[LWJGL] Version: 3.0.1 build 3
[LWJGL] OS: Linux v3.16.0-70-generic
[LWJGL] JRE: 1.8.0_73 amd64
[LWJGL] JVM: Java HotSpot(TM) 64-Bit Server VM v25.73-b02 by Oracle Corporation
[LWJGL] Loading library (system): lwjgl
[LWJGL] Using SharedLibraryLoader...failed
[LWJGL] Loaded from java.library.path: /home/steppers/git/pottedplant/lib/lwjgl/native/liblwjgl.so
[LWJGL] ThreadLocalUtil state: UnsafeState
[LWJGL] MemoryUtil accessor: MemoryAccessorUnsafe
[LWJGL] Loading library: jemalloc
[LWJGL] Using SharedLibraryLoader...failed
[LWJGL] Loaded from java.library.path: /home/steppers/git/pottedplant/lib/lwjgl/native/libjemalloc.so
[LWJGL] MemoryUtil allocator: JEmallocAllocator
[LWJGL] Loading library: glfw
[LWJGL] Using SharedLibraryLoader...failed
[LWJGL] Loaded from java.library.path: /home/steppers/git/pottedplant/lib/lwjgl/native/libglfw.so
[LWJGL] Loading library: libGL.so.1
[LWJGL] Using SharedLibraryLoader...failed
[LWJGL] libGL.so.1 not found in java.library.path=/home/steppers/git/pottedplant/lib/lwjgl/native
[LWJGL] Loaded from system paths


Which in my view looks like it's successfully loading the libraries (correct me if i'm wrong).

glxgears works fine btw.
Title: Re: glClear refusing to work.
Post by: gudenau on June 15, 2016, 15:55:49
Mind providing some code?
Title: Re: glClear refusing to work.
Post by: Kai on June 15, 2016, 16:23:23
Quote from: Steppers on June 14, 2016, 17:41:50
I'm trying to run the example program for lwjgl 3 from the website.
-> https://www.lwjgl.org/guide
Title: Re: glClear refusing to work.
Post by: Steppers on June 15, 2016, 17:46:19
Yes it's just the example that kai linked.
This is not some newbie mistake btw. I've been using lwjgl for 4 years and never had this problem before. The classpath is setup how I always do it and how the guide specifies.
I might just report it after giving it another few hours of trying...

Cheers
Title: Re: glClear refusing to work.
Post by: Steppers on June 17, 2016, 08:02:30
Ok, on the C++ side it seems to have been an issue with the most recent version of glfw (3.2) as when I run exactly the same example with 3.1.2 it runs fine.

Has lwjgl been updated to use glfw 3.2 recently by any chance? I'm trying to use an older version of lwjgl to see if the new ones are a problem but I can't find a link to older builds. I've tried the nightly and the release and both give the same results.

Steppers
Title: Re: glClear refusing to work.
Post by: spasi on June 17, 2016, 08:06:06
All the builds on lwjgl.org are on GLFW 3.2. You can download 3.0.0a and 3.0.0b from the GitHub releases (https://github.com/LWJGL/lwjgl3/releases) (note: there are API differences).