James Black
James Black

Reputation: 41858

Embedding OpenGL, written using NDK, inside a Fragment Layout

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?

Upvotes: 2

Views: 627

Answers (1)

Marcin Orlowski
Marcin Orlowski

Reputation: 75629

I recall no obstacles why GLSurfaceView couldn't be part of Fragment's layout, same way it can be part of "regular" layout, however be aware you can have just one SurfaceView visible at the time. If you target API14 and up you can check TextureView that acts as regular View (contrary to the way GLSurfaceView works).

Upvotes: 1

Related Questions