Thursday, November 10, 2011

[android-developers] Re: How to create a EGLContext in new thread with a functional eglswap ?

hello,

I found

must be put in the new thread

eglMakeCurrent (engine.eglDisplay, engine.eglSurface,
engine.eglSurface, engine.eglContext);

and in the main thread once all transactions and egl opengl ends

eglMakeCurrent (engine.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);


a +

On 4 nov, 17:44, Mickaël BERNARD <mickael.bernard...@gmail.com> wrote:
> hello,
>
> I would like to create a multithreaded opengl es2 application (developped
> in JNI).
> To do this, I create my thread with the pthread library by using the
> function pthread_create(&thread_render, NULL, (void *(*)(void *))
> renderLoop, NULL);
>
> Here is the code of the renderLoop() callback function :
>
> void renderLoop() {
>     while (m_start) {
>             glClearColor(1, 0, 0, 1.0f);
>             checkGlError("glClearColor");
>             glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
>             checkGlError("glClear");
>             LOGI("avant swap");
>             eglSwapBuffers(engine.eglDisplay, engine.eglSurface);
>             checkEglError("eglSwapBuffers");
>             LOGI("apres swap");
>     }
>
> }
>
> The application crash when calling eglSwapBuffers(engine.eglDisplay,
> engine.eglSurface);
> Do you have any idea to fix the problem ?
>
> thanks :)

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate