glGetShaderInfoLog返回空字符串(android) [英] glGetShaderInfoLog returns empty string (android)

查看:122
本文介绍了glGetShaderInfoLog返回空字符串(android)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从OpenGl ES2.0编程指南中修改2d纹理示例的android版本的版本,以更改片段着色器.这是用纯Java编写的,不使用NDK.

I am modifying the version of the android version of the 2d texture example from OpenGl ES2.0 programming guide to change the fragment shader. this is written in pure Java and doesn't use the NDK.

香草示例在我的手机上可以正常工作,但是当我更改着色器代码时,它不再起作用.这是因为修改后的着色器无法编译(显然),但是由于glGetShaderInfoLog返回空字符串,所以我找不到问题的原因.

The vanilla example works just fine on my phone, but when I change the shader code it no longer works. This is because my modified shader doesn't compile (obviously), but I can't find the cause of the problem as glGetShaderInfoLog returns an empty string.

我已经对这个问题进行了搜索,显然,截至7月22日,这是一个已知问题,但是我想知道如何解决这个问题.我发现有一篇文章说他们已经为该功能编写了一个NDK包装器,但是对于Android开发来说我是新手,我真的不知道该怎么做.

I've done a search on this issue, and apparently, as of Jul 22nd, it was a known issue, but I was wondering what ways there are of getting around it. One post I found said they had written an NDK wrapper for the function, but being new to Android development I don't really know how to do this.

推荐答案

您正遭受一个错误.我通过使用旧版GL ES 2.0绑定解决了问题,并获得了正常运行的glGetShaderInfoLog.像这样:

You're suffering from a bug. I worked around by using the old GL ES 2.0 bindings to get a functioning glGetShaderInfoLog. Like this:

import com.badlogic.gdx.backends.android.AndroidGL20;
...
AndroidGL20 gl2 = new AndroidGL20();
Log.e(TAG, gl2.glGetShaderInfoLog(shader));

我仍然将标准的GLES20包装器库用于其他所有内容,因此这很容易放入我的代码库中.这两个包装器显然可以共存而没有任何问题.

I still use the standard GLES20 wrapper library for everything else, so this was simple to drop into my codebase. The two wrappers apparently can coexist without any problems.

这篇关于glGetShaderInfoLog返回空字符串(android)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆