2

我需要一个 android 的示例教程SurfaceView,或者使用它可以共享的示例代码。API 演示对我来说很难理解。有没有人有替代品?

4

2 回答 2

7

This commit of my WorldMap demo app shows you the changes necessary to convert from an android.view.View to an android.view.SurfaceView with an android.view.SurfaceHolder.Callback.

It cheats a bit by using the View's onDraw() from within the SurfaceView's DrawThread and by calling the View's onSizeChanged() from within the SurfaceView's surfaceChanged. It just makes the diff smaller and easier to understand.

于 2012-04-17T04:31:57.887 回答
2

我不确定你是否需要一个GLSurfaceView,但glbuffer是我最喜欢的例子之一。

这是发生该操作的 java 文件:GlBufferActivity

该项目还依赖于本机方法和 NDK,因此它可能不是您正在寻找的,但如果您想通过普通 C api 使用 OpenGL,这是一个很好的起点。

于 2011-03-08T16:55:13.257 回答