开发者

Creating a gl texture outside of GLSurfaceView.Renderer?

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 开发者_如何学Golimiting me because I can't create open gl textures on demand in my code and have to create everything in that method.

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?


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();


you should keep your code separated. GL stuff should be done in gl related classes. logic should be done in logic related classes, having no idea about gl stuff...

so, no, you cant created gl textures if you dont have access to the GL10 variable. also, i think that onSurfaceCreated is the right method to do that stuff.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜