0
LwjglGraphics: created OpenGL 3.2+ core profile context. This is experimental!
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f7860b7ba70, pid=14137, tid=140153724778240
#
# JRE version: OpenJDK Runtime Environment (7.0_65-b32) (build 1.7.0_65-b32)
# Java VM: OpenJDK 64-Bit Server VM (24.65-b04 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea 2.5.3
# Distribution: Ubuntu 14.04 LTS, package 7u71-2.5.3-0ubuntu0.14.04.1
# Problematic frame:
# C [libc.so.6+0x98a70]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/jf/WorkspacelibGDX/desktop/hs_err_pid14137.log
#
我有一個資產加載到Libgdx Java項目時出現問題,它運行一會兒(沒有資產,只是黑屏),然後程序關閉。當我註釋行:「batch.draw(Assets.sprite_back,0,0);」它正常運行,屏幕是白色的,它不關閉。我不認爲這是代碼問題 - 我所做的一切都與Youtube教程中顯示的一樣。Libgdx - 正在加載資產
下面是代碼:
public class GameScreen implements Screen {
Test game;
OrthographicCamera camera;
SpriteBatch batch;
public GameScreen(Test game){
this.game=game;
camera = new OrthographicCamera();
camera.setToOrtho(true, 1920, 1080);.
batch = new SpriteBatch();
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(1F, 1F, 1F, 1F);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
camera.update();
batch.setProjectionMatrix(camera.combined);
batch.begin();
batch.draw(Assets.sprite_back, 0, 0);
batch.end();
}
public class Assets {
public static Texture texture_back;
public static Sprite sprite_back;
public static void load(){
texture_back = new Texture(Gdx.files.internal("menu/back.png"));
texture_back.setFilter(TextureFilter.Linear, TextureFilter.Linear);
sprite_back = new Sprite(texture_back);
sprite_back.flip(false, true);
}
}
確保LwjglApplicationConfiguration#useGL30設置爲false。 – Xoppa 2014-11-04 11:49:29
這是該文件中的所有代碼嗎?當你實現屏幕時,應該還有一個實現的方法顯示你初始化你的紋理。 – ilikeyoyo 2014-11-05 00:07:48