BladeRunner Posted November 7, 2011 Share Posted November 7, 2011 bonjour, Je voudrais créer une application multithreadé OpenGL ES2 (développée en JNI). Pour ce faire, je crée mon thread avec la bibliothèque pthread en utilisant la fonction pthread_create (& thread_render, NULL, (void *(*)( void *)) renderLoop, NULL); Voici le code de renderLoop() fonction de 'callback': renderLoop void () { while (m_start) { glClearColor (1, 0, 0, 1.0f); checkGlError ("glClearColor"); glClear (GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); checkGlError ("glClear"); LOGI («swap avant"); eglSwapBuffers (engine.eglDisplay, engine.eglSurface); checkEglError ("eglSwapBuffers"); LOGI («swap apres"); } } L'application crash lors de l'appel eglSwapBuffers (engine.eglDisplay,engine.eglSurface); Avez-vous une idée pour résoudre le problème? merci:) Link to comment Share on other sites More sharing options...
BladeRunner Posted November 10, 2011 Author Share Posted November 10, 2011 bonjour, j'ai trouvé il faut mettre dans le nouveau thread eglMakeCurrent(engine.eglDisplay, engine.eglSurface, engine.eglSurface, engine.eglContext); et dans le thread principal une fois que toute les opérations egl et opengl finit eglMakeCurrent(engine.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); a+ Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.