简体   繁体   中英

Black screen without images in my java (libGDX) application on Windows

I got a java (libGDX) application. My app is loading images (sprites) from an assets folder. When i am launching my app on Linux - everything is working fine, but when i am launching jar on Windows - i see only black screen - without images. Could you please help me to solve this problem. I have no ideas what can go wrong, and why this is happening. I saw - my assets - are in the jar.

  1. Could you provide us with some code examples so we can see what you are doing? (eg loading images, files, etc.)

  2. Try executing the jar from the cmd / shell (java -jar ) so you will see if there are any exceptions thrown. Most likely there is an exception thrown but you cannot see it because you dont have a console window. If there is an exception thrown, please post the stack trace in your question so we can analize it.

  3. How are you building the jar? Make sure you are builing the jar correctly.(gradlew desktop:dist)

  4. Are you using any java file input output methods(eg File)? These wont work correctly with libgdx core module in jar. Libgdx handles the files by its own way, so make sure you are reading / writing to files using libgdx's file handling system( Check it out here )

  5. What is your graphics card? Libgdx has a bug where the default shader doesnt work on some AMD cards because some older opengl versions dont seem to be supported for some reason. This bug has not been resolved yet, but the admin has provided us a solution. So if you get a stack trace, when running from command prompt or shell, saying sth like "...error compiling shader ... blah blah blah ... Implicit version 110 not supported by GL3 ..." then Check this thread in libgdx issues page . The admin xoppa provided a solution which seems to work well for all:

Could you try to add the following code to your desktop starter.

config.useGL30 = true; ShaderProgram.prependVertexCode = "#version 140\\n#define varying out\\n#define attribute in\\n"; ShaderProgram.prependFragmentCode = "#version 140\\n#define varying in\\n#define texture2D texture\\n#define gl_FragColor fragColor\\nout vec4 fragColor;\\n";

This answer can be found in the thread I provided.

I hope I helped and im sorry for bad english and bad code formatting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM