我在Libgdx项目中有非常简单的代码,它在Android上不起作用,但在桌面上很有效。在Android上,我在几次渲染时间后出现此错误:
E/OpenGLRenderer(1314): Getting MAX_TEXTURE_SIZE from GradienCache
E/OpenGLRenderer(1314): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
W/GL2JNIView(1314): creating OpenGL ES 2.0 context
E/EGL_genymotion(1314): [getAttribValue] Bad attribute idx
E/EGL_genymotion(1314): tid 1328: eglGetConfigAttrib(573): error 0x3004 (EGL_BAD_ATTRIBUTE)
A/libc(1314): Fatal signal 11 (SIGSEGV) at 0x971ae008 (code=2), thread 1328 (Thread-96)
显示方法:
batch = new SpriteBatch();
camera = new OrthographicCamera();
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("cutive.ttf"));
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 30;
font = generator.generateFont(parameter);
generator.dispose();
调整大小方法:
camera.viewportWidth = width;
camera.viewportHeight = height;
camera.update();
渲染方法:
Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.setProjectionMatrix(camera.combined);
batch.begin();
font.draw(batch, "helloabssdadaa", 100, -300);
batch.end();
答案 0 :(得分:0)
我创立了解决方案。它在闪屏上。不要在飞溅中处理任何东西。