2

I am working on an educational game and I want the graphics part to be rendered with OpenGL, and NDK may be a better choice, but I am running into a problem with how I can make this work with Fragments.

Currently, if I just pass the fragment activity to GLSurfaceView it should work properly (I am still designing out everything), when I do OpenGL from Java, even though this is in a fragment.

I would like fragments so that on a tablet I can show all of the parts at one time, but on a phone the user will see equations on one screen and the results on another.

Is it possible to have my graphics be in a separate fragment and render the image with OpenGL, using NDK?

4

1 回答 1

1

我记得没有障碍为什么 GLSurfaceView 不能成为 Fragment 布局的一部分,就像它可以成为“常规”布局的一部分一样,但是请注意,您当时只能看到一个 SurfaceView。如果您以 API14 及更高版本为目标,则可以检查充当常规视图的TextureView(与 GLSurfaceView 的工作方式相反)。

于 2012-11-20T20:02:08.970 回答