问题描述
有没有办法对我实施GLSurfaceView.Renderer的外部创建GL纹理?我只能够在onSurfaceCreated方法来创建纹理,因为这是在那里我有GL10 GL变量的访问。它限制了我,因为我不能在我的code按需创建的Open GL纹理并创造该方法的一切。
Is there a way to create gl textures outside of my implementation of GLSurfaceView.Renderer? I've only been able to create textures in the onSurfaceCreated method, since that's where I have access of the GL10 gl variable. It's limiting me because I can't create open gl textures on demand in my code and have to create everything in that method.
另外,有一种方式来获得在GL10 GL变量GLSurfaceView.Renderer之外吗?或者甚至有另一种方式来创建总帐纹理?
Alternatively, is there a way to get at the GL10 gl variable outside of the GLSurfaceView.Renderer? Or is there even another way to create gl textures?
推荐答案
我发现东西的作品,得到了EGLContext。
I found something that works, getting the EGLContext.
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.opengles.GL10;
// in code.
EGL10 egl = (EGL10)EGLContext.getEGL();
GL10 gl = (GL10)egl.eglGetCurrentContext().getGL();
这篇关于创建GLSurfaceView.Renderer的GL质感之外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!