简体   繁体   English

OpenGl ES 2.0 - 程序未在Moto G上运行

[英]OpenGl ES 2.0 – Program not running on Moto G

I've created a small project that is working on Eclipse via an emulator. 我已经创建了一个通过模拟器处理Eclipse的小项目。 I've tried to run it on a Moto G but it is not working. 我试过在Moto G上运行它,但它不起作用。 EDIT Was reading getError twice so following statement is false - "GLES20.glGetError() is not showing any errors" but logcat is showing the beneath. 编辑两次读取getError,因此以下语句为假-“ GLES20.glGetError()未显示任何错误”,但logcat显示了下面的内容。

W/Adreno-ES20﹕ <core_glUseProgram:1546>: GL_INVALID_OPERATION
W/Adreno-ES20﹕ <core_glGetAttribLocation:639>: GL_INVALID_OPERATION
W/Adreno-ES20﹕ <core_glGetAttribLocation:639>: GL_INVALID_OPERATION

Interestingly using step over debugging the first two of below don't show above problem but final one logs : GL_INVALID_ENUM? 有趣的是,使用逐步调试下面的前两个方法不会显示上述问题,但会显示最后一个日志:GL_INVALID_ENUM?

GLES20.glEnable( GLES20.GL_CULL_FACE );
GLES20.glCullFace(GLES20.GL_BACK);
GLES20.glEnable(GLES20.GL_TEXTURE_2D);

Have you got any ideas? 你有什么想法吗? I've included below in manifest. 我在清单中列出了以下内容。

uses-feature android:glEsVersion="0x00020000" android:required="true" uses-feature android:glEsVersion =“ 0x00020000” android:required =“ true”

One final point is I'm now running on Android Studio with gradle files rather than Eclipse. 最后一点是,我现在在带有gradle文件而不是Eclipse的Android Studio上运行。 This is because the latter updated itself and is no longer working due to dependencies. 这是因为后者由于依赖性而自行更新并且不再工作。

Thanks for any help in advance. 在此先感谢您的帮助。

Mark 标记

This is indeed not a valid call in ES 2.0: 在ES 2.0中,这确实不是有效的调用:

GLES20.glEnable(GLES20.GL_TEXTURE_2D);

Enabling texturing was necessary in old versions of ES (1.x) and OpenGL that used the fixed pipeline. 在旧版本的ES(1.x)和使用固定管道的OpenGL中,必须启用纹理。

With the programmable pipeline, which is the only option in ES 2.0 and later, this does not make sense anymore. 使用可编程管道,这是ES 2.0及更高版本中的唯一选项,这已经没有意义了。 If you want to use texturing, you sample textures in your shaders. 如果要使用纹理,可以在着色器中对纹理进行采样。 If you don't want to use texturing, you... do not. 如果您不想使用纹理化,则...不要。 There's no need to enable texturing. 无需启用纹理。

You can find the valid arguments for glEnable() on the man page . 您可以在手册页上找到glEnable()的有效参数。

Eclipse stopped working and so I tried Android Studio. Eclipse停止工作,所以我尝试了Android Studio。 I'm pretty sure the program was working on Eclipse. 我很确定该程序正在使用Eclipse。 I had a check like this reqGlEsVersion >= 0x20000. 我有一个像这样的支票reqGlEsVersion> = 0x20000。 On Android Studio this was returning 0 and so my EGL context wasn't getting created. 在Android Studio上,这返回0,因此我的EGL上下文没有被创建。 Apparently there is a problem with the value of this and what AVD set up you have. 显然,这个的价值和AVD设置的问题是有问题的。 Once I commented this out it was ok. 一旦我发表评论,就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM