Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

android - Attribute list in eglCreateContext

I'm looking at the android ndk opengl es example. Anyway, it has the lines in there:

int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);

Where EGL_CONTEXT_CLIENT_VERSION is defined as:

private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;

I've been going over the API for that call, and it says that the last parameter is for the attributes list. But I can't seem to find anything that actually gives attributes you might want to put in there, or even explain the two attributes that the example puts in there. Can anyone tell me what these attributes mean? (Or better yet, also point me to some documentation that explains it).

Thank you

Edit: I just realised that a bit of context would help. The particular sample is in samples/hello-gl2. The file is in the view class, in particular, the ContextFactory static class.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Check the spec, page 43:

attrib list may be NULL or empty (first attribute is EGL_NONE), in which case attributes assume their default values as described below.

EGL_CONTEXT_CLIENT_VERSION determines which version of an OpenGL ES context to create. An attribute value of 1 specifies creation of an OpenGL ES 1.x context. An attribute value of 2 specifies creation of an OpenGL ES 2.x context. The default value for EGL_CONTEXT_CLIENT_VERSION is 1.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...