0
我已经尝试使用Android中的示例代码来学习OpenGL。但我看不到预期的输出。请指出问题在哪里?无法设置背景颜色并清除EGL中的输出
我已经使用fadden的贡献作为参考。
步骤1:
我已创建renderThread与renderHandler。
public void run() {
Looper.prepare();
mHandler = new RenderHandler(this);
mEconEglCore = new EGLCore(null, EGLCore.FLAG_RECORDABLE);
EGLSurface eglSur = mEconEglCore.createWindowSurface(userSurface);
synchronized (mStartLock) {
mReady = true;
mStartLock.notifyAll();
}
Looper.loop();
}
我在RenderThread构造函数中收到的userSurface。
public RenderThread(Surface surface) {
// Log.d (TAG, "Inside Render Thread..");
userSurface = surface;
}
现在,我在Choreographer回调机制的帮助下调用doFrame()API来绘制曲面中的颜色。
GLES20.glLineWidth(3.0f);
GLES20.glClearColor(0.6f, 1.0f, 0.3f, 1.0f);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
注意:应用程序使用TextureView并按照以下方式接收到曲面。
mytextureView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
Log.d(TAG, "Surface Texture Available..");
userSurface = new Surface(surface);
问题:
我不知道如果我在OpenGL编码与正确的程序一致。此外,我没有看到任何颜色显示在表面,但只有黑色。即使我不做任何事我会做黑色。
请提供输入。另外,让我知道我需要知道的缺失部分?