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

查看:34
本文介绍了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天全站免登陆