Default SpriteBatch shader fails to compile
See original GitHub issueHi there:
The following code is crashing with the error code posted at the bottom of this issue:
public class Iteration3Main extends Game {
SpriteBatch batch;
private static TextureAtlas atlas;
private static final float colourCycleTime = 30f;
private static HSVColour currentColour = new HSVColour(0, 0.81f, 0.7f, 1f);
public static Colour currentColour() {
return currentColour.toRGB();
}
private static TitleScreen titleScreen;
private static Iteration3Main main;
public static TextureAtlas textureAtlas() {
return atlas;
}
@Override
public void create() {
batch = new SpriteBatch();
atlas = new TextureAtlas(Gdx.files.internal("global.atlas"));
titleScreen = new TitleScreen(this, atlas);
main = this;
setScreen(titleScreen);
}
@Override
public void render() {
float nextHue = currentColour.hue() + Gdx.graphics.getDeltaTime() / colourCycleTime;
nextHue = nextHue > 1 ? 0 : nextHue;
currentColour.hue(nextHue);
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
super.render();
}
}
I’m on a fresh install of Windows 10, in IntelliJ 15.0, running Oracle JDK version 1.8.0_65. This project was working the day before yesterday with an existing Windows10 installation, but I believe an older version of Java 1.8.0 Installed. This is possibly the source of my troubles. I’ll install the previous release and report back.
Exception in thread "LWJGL Application" java.lang.IllegalArgumentException: Error compiling shader: Vertex shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors. No code generated
Fragment shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors. No code generated
at com.badlogic.gdx.graphics.g2d.SpriteBatch.createDefaultShader(SpriteBatch.java:157)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:120)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:73)
at com.deepwallgames.quantumhue.Iteration3Main.create(Iteration3Main.java:29)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Issue Analytics
- State:
- Created 8 years ago
- Comments:29 (9 by maintainers)
Top Results From Across the Web
Developers - Default SpriteBatch shader fails to compile -
Hi there: The following code is crashing with the error code posted at the bottom of this issue: public class Iteration3Main extends Game...
Read more >libGDX throwing an error for the default vertex shader in a ...
The shader error seems to trace back to the SpriteBatch created in my program. Is there something wrong with my code, or is...
Read more >Default shader won't work - Graphics - Community | MonoGame
I load it in with Effect effect = game.Content.Load(@“shaders/Test”);. And then I implement it like this: spriteBatch.Begin(SpriteSortMode.
Read more >libGDX throwing an error for the default vertex shader in a ...
SpriteBatch doesn't support GLES 3 unless you use a GLES 3 compatible shader. One thing to check is that you do not try...
Read more >Post Processing in SadConsole
Sometimes you may want to apply a shader or graphical effect to your game when drawing ... otherwise your shader will not compile...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m sorry. Maybe I’m misreading your tone (one of flustered impatience with one of many “noobish” issues) but I feel that this is a terrible attitude to have. I am someone who is becoming familiar enough with the libgdx codebase such I feel comfortable browsing around the source. I don’t think you want to turn such people away.
I was not looking for help, I am trying to make it clear that a) on a fresh install of Windows 10 b) with an AMD card, c) the default SpriteBatch shader is failing to compile, moreover the ShapeRender’s default shader is failing to compile, but does so in a silent manner.
This is a serious issue. This is a major failing in Libgdx’s introductory user experience. The university I am at uses Libgdx as their engine of choice for their introductory game design course. At that point in my education, I would have had absolutely no clue as to how to debug such a problem, it would have been a major turn off from an ecosystem whose modular approach I have major respect for.
I have reproduced my problem, in a minimal as possible way by creating a desktop project with no extraneous libs, on a dev environment almost as clean as it could be. This IS a new issue, at least for me, I did not encounter it prior to today, when I reformatted and installed Oracle JDK 1.8.65.
But naturally because this involves GL, this is a hardware specific problem. I do not know whether this problem applies to all AMD graphics cards, but with 18% percent of development environments potentially affected (AMD desktop share) it should be of concern to you.
If you give me a bit of time (I’m currently writing finals), I can create a branch to try and architect a solution in a platform agnostic manner.
I ask that you please do not close this, it may be more widespread and simply hitting the silent and inexperienced than you think.
From @crykn: the issue seems to be related to specific hardware, so there’s nothing libGDX can do on its end; the Mac issue mentioned in the last post is a separate problem (only core profile support on Mac).