简体   繁体   English

为什么我“在没有当前上下文的情况下调用OpenGL ES API”?

[英]Why am I getting “call to OpenGL ES API with no current context”?

I am new to both openGL and android development so please forgive me if my question is very trivial. 我是openGL和android开发的新手,所以请原谅我,如果我的问题非常简单。

I am trying to build a simple little app that takes input from the user in three EditTexts representing a 0 - 100% value for each component of a RGB color to be displayed in a GLSurfaceView. 我正在尝试构建一个简单的小应用程序,它从三个EditTexts中获取用户的输入,表示RGB颜色的每个组件的0 - 100%值,以显示在GLSurfaceView中。

The catch is that I need this to use openGL ES 2.0 and I need to pass the data into the shading program using a uniform value so that once I get it working I can move on to what I am really trying to accomplish. 问题是,我需要使用openGL ES 2.0,我需要使用统一值将数据传递到着色程序中,这样一旦我开始工作,我就可以继续我真正想要实现的目标了。

Upon running what I have written I can get the GLSurfaceView to correctly display the first solid color, but whenever I change any of the values and make calls to rebuild the uniform slot in the shading program I get this error in the LogCat: 在运行我编写的内容后,我可以让GLSurfaceView正确显示第一个纯色,但每当我更改任何值并调用重建着色程序中的统一插槽时,我在LogCat中出现此错误:

ERROR/libEGL(14316): call to OpenGL ES API with no current context (logged once per thread) ERROR / libEGL(14316):调用没有当前上下文的OpenGL ES API(每个线程记录一次)

and of course the GLSurfaceView remains the initial color. 当然,GLSurfaceView仍然是最初的颜色。

I've been searching all over for a solution to this problem and as best I can tell I might need to be setting up an EGLContext somewhere before setting my renderer. 我一直在寻找解决这个问题的方法,并且我可以告诉我可能需要在设置渲染器之前在某处设置EGLContext。 However, I don't see anything in the API demos about this, and the only information I can find online was written before GLSurfaceView was even available. 但是,我没有在API演示中看到任何关于此的内容,我在网上找到的唯一信息是在GLSurfaceView可用之前编写的。

Do I need to set up an EGLContext still or have I missed something else? 我是否需要设置EGLContext或者我错过了其他内容?


Additional info that may help: 可能有用的其他信息:

-used an XML file to set up the UI (and as far as I can tell doing it in code doesn't help) - 使用XML文件来设置UI(据我所知,在代码中执行它没有帮助)

-having the same trouble when I try to load in a new texture from the sd card in a seperate program. - 当我尝试在单独的程序中从SD卡加载新纹理时遇到同样的麻烦。 I can get the first texture to work fine, but when using the same method to load the second I get the same error and nothing changes. 我可以让第一个纹理工作正常,但当使用相同的方法加载第二个时,我得到相同的错误,没有任何变化。

You're not calling it from the OpenGL thread. 你不是从OpenGL线程调用它。 If a different thread is trying to do something with OpenGL, queue that up and call it during your OpenGL thread instead. 如果另一个线程正在尝试使用OpenGL执行某些操作,请将其排队并在OpenGL线程期间调用它。

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

相关问题 在没有当前上下文的情况下调用OpenGL ES API - Call to OpenGL ES API with no current context ARToolkit-在没有当前上下文的情况下调用OpenGL ES API - ARToolkit - call to OpenGL ES API with no current context 没有当前上下文的opengl es api - opengl es api with no current context 在Android中使用imageloader时“在没有当前上下文的情况下调用OpenGL ES API” - “call to OpenGL ES API with no current context” while using imageloader in android 调用没有当前上下文的OpenGL ES API(每个线程记录一次) - call to OpenGL ES API with no current context (logged once per thread) 错误/libEGL(206):在没有当前上下文的情况下调用 OpenGL ES API - ERROR/libEGL(206): call to OpenGL ES API with no current context 在没有当前上下文的情况下调用OpenGL ES API(每个线程记录一次)-OpenGL ES - call to OpenGL ES API with no current context (logged once per thread) - OpenGL ES 处理和“没有当前上下文的OpenGL ES API” - Processing and “OpenGL ES API with no current context” Android NDK OpenGL glDeleteTextures导致错误:在没有当前上下文的情况下调用OpenGL ES API - Android NDK OpenGL glDeleteTextures causes error: call to OpenGL ES API with no current context E / libEGL:调用OpenGL ES API,没有当前上下文(每个线程记录一次) - Android / SDL - E/libEGL: call to OpenGL ES API with no current context (logged once per thread) - Android/SDL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM