Assimp static Meshes Black Screen
simagdo opened this issue · 3 comments
Hey,
i recently asked for help with the Chapter for normal mapping. Now i have the same error that i see a black screen when i execute my program. I followed your tutorial and i got stuck in the StaticMeshesLoader. When i execute the Program, i got the following error:
java.lang.Exception: Error loading model at de.simagdo.engine.loaders.assimp.StaticMeshesLoader.load(StaticMeshesLoader.java:32) at de.simagdo.engine.loaders.assimp.StaticMeshesLoader.load(StaticMeshesLoader.java:21) at de.simagdo.game.DummyGame.init(DummyGame.java:55) at de.simagdo.engine.GameEngine.init(GameEngine.java:46) at de.simagdo.engine.GameEngine.run(GameEngine.java:33) at de.simagdo.system.MainComponent.main(MainComponent.java:21)
I fixed it by using the following code:
resourcePath = StaticMeshesLoader.class.getClassLoader().getResource(resourcePath).getPath(); if (resourcePath.startsWith("/")) resourcePath = resourcePath.substring(1);
After that i can finally start the Program without any error, but the only thing i see is a black window. I started again by using the source i saved from chapter 26, without any luck at all ;/
This is my current Window:
I don't know where the error occurs, i have already debugged the part where i am loading the GameItems. Parallel to that i debugged your source and i got the same results.
Link to the Repository: https://github.com/simagdo/3DGameEngine
Currently I am using Java 13 and OpenGL 3.1.2
I'll have a look at it. Unfortunately, Renderdoc is crashing lately on my computer, so it may take some time.
Hi,
I thnik the problem is that you are not setting the material uniform while rendering. This makes some values to be 0 (such us the ambient colour), which makes the nice black window.
In the renderNonInstancedMeshes
method, you removed the following line just after the for
loop:
sceneShaderProgram.setUniform("material", mesh.getMaterial());
Please add this line and let me know if this solves your problem.
Hi,
I thnik the problem is that you are not setting the material uniform while rendering. This makes some values to be 0 (such us the ambient colour), which makes the nice black window.
In the
renderNonInstancedMeshes
method, you removed the following line just after thefor
loop:
sceneShaderProgram.setUniform("material", mesh.getMaterial());
Please add this line and let me know if this solves your problem.
Thank you very much for your fast response. This was exactly the problem. After i added this line, everything works as it should.