LWJGL Forum

Programming => OpenGL => Topic started by: ApexModder on July 05, 2018, 10:07:48

Title: Shader issue
Post by: ApexModder on July 05, 2018, 10:07:48
Hi, Im fairly new to game development although I have been developing with Java for years now, looking to get into game development and creating a simple game using LWJGL. Although I seem to be having this weird issue when rendering a simple triangle to my screen. The triangle renders fine until I wrap it inside of a Shader bind / unbind which then my screen is just pure red (due to the glClearColor call) and no triangle like the shader is by passing my VAO and VBO renders. Anyone any idea why this might be happening?

If it helps my source code is on GitHub (https://github.com/ApexModder/ApexEngine/blob/initial/ApexEngine/Core/src/main/java/com/apex/ApexEngine/Core/Graphics/Renderer.java#L65)

preview (https://gfycat.com/BountifulLeafyLeopardseal?speed=8)
Title: Re: Shader issue
Post by: KaiHH on July 05, 2018, 10:37:39
I tried to checkout the "initial" branch (which you referenced in your Renderer.java link), but that fails due to incorrect loading of the shader text (you only load the first line of the shader file).
Then I tried the "master" branch, but there you don't do anything in the Renderer class.
So the question is: Is there any version in any branch or commit that reproduces your problem?

My advice however is: Use LWJGLX/debug (https://github.com/LWJGLX/debug) by downloading it from https://lwjgl.org/customize (select any release version and check only "LWJGLX/debug" under "Addons"). This will give you a zip file containing lwjglx-debug-1.0.0.jar.
Then you need to run your application with the JVM argument "-javaagent:<dir>/lwjglx-debug-1.0.0.jar", where <dir> is the directory you extracted the lwjglx-debug-1.0.0.jar into.
Title: Re: Shader issue
Post by: ApexModder on July 05, 2018, 10:41:52
I tried to checkout the "initial" branch (which you referenced in your Renderer.java link), but that fails due to incorrect loading of the shader text (you only load the first line of the shader file).
Then I tried the "master" branch, but there you don't do anything in the Renderer class.
So the question is: Is there any version in any branch or commit that reproduces your problem?

My advice however is: Use LWJGLX/debug (https://github.com/LWJGLX/debug) by downloading it from https://lwjgl.org/customize (select any release version and check only "LWJGLX/debug" under "Addons"). This will give you a zip file containing lwjglx-debug-1.0.0.jar.
Then you need to run your application with the JVM argument "-javaagent:<dir>/lwjglx-debug-1.0.0.jar", where <dir> is the directory you extracted the lwjglx-debug-1.0.0.jar into.

ahh lol its always the small issues that get you, reading 1 line rather than the whole damn file xD thanks for pointing that out lol

(https://i.imgur.com/SmP0Zyk.png)
Title: Re: Shader issue
Post by: KaiHH on July 05, 2018, 10:45:57
Solution 3 should work: https://stackoverflow.com/questions/309424/read-convert-an-inputstream-to-a-string#answer-35446009
Title: Re: Shader issue
Post by: ApexModder on July 05, 2018, 11:01:29
Solution 3 should work: https://stackoverflow.com/questions/309424/read-convert-an-inputstream-to-a-string#answer-35446009

thanks, tiny modification to how im reading files and it all works :D

(https://i.imgur.com/ZRHzzRn.png)